Raspberry booting over PXE -> Shutdown/Restart problem

Hi all

For my new project i decided to boot my raspberry 3B+ over PXE.
It is a little bit confusing because it is not a “normal” (standard) pxe setup. Booting the pi over pxe needs some “tricks”.
Anyway, to keep a long story short: It works! :sunglasses:
Only one thing does not work:
On every shutdown or reboot, my pi stucks on this error:

[ OK ] Started Dietpi-Kill_SSH on shutdown.

Any ideas how to shutdown/restart correctly?

This service kills open SSH sessions on shutdown, so when you run shutdown/reboot/poweoff, your PuTTY will clearly show the session being disconnected. On a raw server system (no systemd-logind active) otherwise your SSH session will look like active still for a really long time, causing confusion.

https://github.com/MichaIng/DietPi/blob/dev/rootfs/etc/systemd/system/dietpi-kill_ssh.service#L7

You could try this by yourself:

  • Open an SSH session
  • Connect to local terminal (keyboard + monitor)
  • Run on local terminal: killall -qw dropbear sshd
  • See if the command finishes immediately or hangs there as well.

If was already thinking to remove the -w option, as this means “wait for processes to be killed”. But if somehow the processes hang or do not react to the default SIGTERM, the killall command will wait forever. To assure most quick kill, SIGKILL and no -w would be best but rude as well to any running sub process.

However please try the above to investigate why the killall hangs.

And in case do to not have the command wait:

sed -i 's/killall -qw/killall -q/' /etc/systemd/system/dietpi-kill_ssh.service
systemctl daemon-reload

Or even, to send the rude SIGKILL command which cannot be ignored by processes:

sed -Ei 's/killall -qw?/killall -9 -q/' /etc/systemd/system/dietpi-kill_ssh.service
systemctl daemon-reload

Thank you!
I will try that, but need some time…
BTW: PXE booting is a very nice thing. :sunglasses: Maybe i write a manual for others if someone is interested.

Edit:
Ok, i killed SSH as you told.
Result: No error, ssh terminated, remote session ended.

Then i tried to shutdown the Pi (ssh is still terminated).
Now it hangs on:

Stopped Rais network interfaces

And i think this points me in the right direction:
The rootfs on my Pi came over NFS (no sd-card inserted). So if the pi is shutting down, it can not stop the network because of the NFS-Share.
Could this be? And if so: How to work around this?

Hm, maybe a bad idea to edit a post because of the missing notification :wink: