Raspberry booting over PXE -> Shutdown/Restart problem

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
The_Raven
Posts: 16
Joined: Sat Aug 12, 2017 12:51 pm

Raspberry booting over PXE -> Shutdown/Restart problem

Post by The_Raven »

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! 8)
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?
User avatar
MichaIng
Site Admin
Posts: 2262
Joined: Sat Nov 18, 2017 6:21 pm

Re: Raspberry booting over PXE -> Shutdown/Restart problem

Post by MichaIng »

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 ... 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:

Code: Select all

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:

Code: Select all

sed -Ei 's/killall -qw?/killall -9 -q/' /etc/systemd/system/dietpi-kill_ssh.service
systemctl daemon-reload
The_Raven
Posts: 16
Joined: Sat Aug 12, 2017 12:51 pm

Re: Raspberry booting over PXE -> Shutdown/Restart problem

Post by The_Raven »

Thank you!
I will try that, but need some time...
BTW: PXE booting is a very nice thing. 8) 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?
The_Raven
Posts: 16
Joined: Sat Aug 12, 2017 12:51 pm

Re: Raspberry booting over PXE -> Shutdown/Restart problem

Post by The_Raven »

Hm, maybe a bad idea to edit a post because of the missing notification ;)
Post Reply