batocera-linux / batocera.linux

batocera.linux
https://batocera.org
Other
1.96k stars 512 forks source link

Reboot/shutdown takes up to 10 minutes when mounting NAS shares via NFS #11117

Open MizterB opened 7 months ago

MizterB commented 7 months ago

Batocera build version

39 2024/02/27 21:48

Your architecture

X86_64

Your Graphic Processor Unit(s) (GPU)

AND Radeon RX580

Issue description

When I mount my NAS via NFS, rebooting or shutting down my system takes 8-10 minutes. This occurs with any of the standard NAS mount locations. Disabling the NAS shares results in a reboot of 20-30 seconds.

Detailed reproduction steps

mount -o remount,rw /boot
batocera-settings-set -f /boot/batocera-boot.conf sharedevice NETWORK
batocera-settings-set -f /boot/batocera-boot.conf sharenetwork_nfs0 CONFIGS@my_nas:/path/to/configs
reboot

Once rebooted, shut down or reboot again via ES or the reboot command. Screen will go blank and appear to 'hang' for up to 10 minutes before completing (likely due to timeout).

Details of any attempts to fix this yourself

After much trial end error, I stumbled across this Discord message: https://discord.com/channels/357518249883205632/357954026916151298/1111606380898570270

This led me to discover that NFS is not being unmounted in the shutdown sequence.

In /etc/init.d/S11share, the unmount command is: umount -l -a -t nfs

If run manually, you will see that NFS shares are NOT unmounted. This is because the mount type is not nfs - it is actually nfs4!

Changing the command to umount -l -a -t nfs4 resolves the slow shutdown/reboot issue.

I am unsure of the most appropriate solution to this problem - switch the existing umount command to nfs4, or keep it as nfs, and add another umount specifically for nfs4. I'll defer to the developers.

Details of any modifications you have made to Batocera.

To debug this, I worked from a fresh install of Batocera.

Logs and data

No response

Tomte-Fan commented 4 months ago

This seems to solve my shutdown issue as well using nfs4, I just added this line and it shuts down cleanly.

lamb0985 commented 3 months ago

Thank you for this, it was driving me nuts that reboot would just hang. It works now!

lamb0985 commented 3 months ago

once you modify the command in /etc/init.d/S11share it looks like you have to run the command batocera-save-overlay to make this persist past a single reboot. I was able to do this and rechecked the file and it still shows the modified code which should help with reboots getting hung up on the nfs share. Hope this helps.