Talk:Diskless network boot NBD root

From ArchWiki

Shutdown Hang

Shutdown will hang at "Sending SIGTERM to processes". This probably happens because this also kills the nbd-client process and the connection to the root device is therefore lost. Unfortunately, there is currently no known workaround for this.


(I do know this problem from SystemRescueCD via PXE/NBD. My workaround: Copy /sbin/{reboot,halt,shutdown,whatever} to /tmp, then back to /sbin. The files a stored in the tmpfs overlay then and shutdown/reboot succeeds. Have not tested here, maybe you have to set up an overlay first. Or try to cache the file first... (cat /sbin/halt >/dev/null))


Thanks, but I think I just found a proper fix. There is a function called add_omit_pids in /etc/rc.d/functions. This allows me to add the pid of nbd-client to a list of pids that will not be killed on shutdown. I created a /etc/rc.d/functions.d/omit_kill_nbd:

omit_kill_nbd() {
   add_omit_pids $(pidof nbd-client)
}

add_hook shutdown_prekillall omit_kill_nbd

Seems to work, but needs more testing. I'm gonna add this file to the mkinitcpio-nbd package which I will release in a few days.