DietPi icon indicating copy to clipboard operation
DietPi copied to clipboard

Follow up on issue #4855 from 2021 re DietPi hanging on shutdown in PXE boot environment

Open numbersixnz opened this issue 10 months ago • 2 comments

I'm running 9.9.0 on a Raspberry Pi 5 and everything works great except for shutdown. This hangs the entire system (forever) although the following issue seems to describe the problem perfectly: https://github.com/MichaIng/DietPi/issues/4855

~I haven't tested the steps there yet (will do so tonight)~ I just tested the solution from that issue and it works (more below) but the issue mentions a PR to change the ordering of various things to get around this issue in the first place. Did that PR happen/get merged at some point? I assume not since the issue is still there. I can confirm shutdown when booted from SD card works as expected.

Issue #4855 mentions creating/editing the following file:

/etc/systemd/system/[email protected]/override.conf - This does not work for me. It actually stops networking from coming up at all. The boot screen shows the IP but it doesn't respond to ICMP ping or any attempt to login. My DHCP server shows that IP as offline.

The issue also mentions to create/edit the following file:

/etc/systemd/system/networking.service.d - This does work for me. Networking comes up and the PXE-booted Pi5 can shutdown without any problem. The contents of this file are as follows:

[Service]
ExecStop=

This is probably more of an FYI than an issue but thought it might be worth logging as an issue in case that PR never got done.

numbersixnz avatar Feb 04 '25 05:02 numbersixnz

Hmm it sounds like this issue, which has been however fixed 🤔: #7104

But maybe with PXE boot it is a different thing. Makes sense that ifup@ changes do not fix it, as they do not try to bring down interfaces (anymore). networking.service however does. So bringing down a network interface on shotdown generally hangs, if booted via PXE?

MichaIng avatar Apr 19 '25 15:04 MichaIng

Okay so generally it makes sense: deconfiguring the network breaks the PXE NFS root mount, which makes every rootfs access hang.

Search machines provide a lot of results discussing the very same issues. One contained a somewhat important hint: The system has Internet access already on early boot. Hence it does not make any sense or can even break things when trying to configure the same interface again. It hence makes sense to disable the Internet facing network adapter. dietpi-config calls ifdown explicitly, resulting in the same issue at least once, in a less optimal state. But allow-hotplug eth0 (or wlan0 respectively) can be commented in /etc/network/interfaces to achieve the same from next boot on, probably even for current session already. The networking.service deconfigures only interfaces defined like auto eth0 or allow-hotplug eth0 in /etc/network/interfaces.

We could detect an NFS root mount in dietpi-config and in that case skip the problematic line for the network adapter attached to the default route. When trying to configure it, we could show a notice instead that this network must be configured via initramfs instead.

MichaIng avatar Apr 19 '25 16:04 MichaIng