Return to Level1Techs.com

Linux Boot Delay - Connection NFS Server

Hello everyone :wave:,

Please help! I am having loading/boot time issues in Pop OS 20.04 LTS due to my connection to my NAS (TrueNAS) :cry:. Due to my electric bill, I turn on/off my NAS whenever I am watching my movies. Looking at internet guides, I added the following lines to connect at boot in my PC /etc/fstab file.

(My Local IP address):/mnt/Peliculas01-01/Peliculas01 /media/asuka/Peliculas01 nfs defaults,_netdev 0 0

My problem comes when I turn on/off the PC and the server is off. It takes like 2 minutes to turn on/off. Is there a way to speed the boot time during this type of scenario?

The problem is the boot time in my main PC, not the NAS (I believe). I think it is trying and retrying to make connections to the server that it is down. Not sure if it is possible to establish the connection once and if it is off then it moves along.

Thanks in advance for helping this normie :hugs:. Regards.

I’m not sure if TrueNAS supports things like hibernate, but that would certainly improve your situation although with increased power usage compared to power=off. I’m from germany and I know how pricey a kWh can get (28,6ct/kWh here)

Thanks for the reply, sorry I might not have described my issue correctly. I will update, the problem is my main PC, not the NAS (I believe). It takes a lot of time to boot because it is trying to make the connection to the server and the server is down. Any thoughts?

Reduce the timeout on the connection. Been a while since I’ve done this, but I think you add timeo=10 or sth like that to fstab. Google “NFS timeout fstab” should result in some good hits. Changing timeouts isn’t rocket science.

1 Like

Great Thanks, let me try that! :hugs:

For me, reducing the timeout only made other timeouts appear, every single time. :frowning:

The solution to this is to not automount your remote file system on boot and to unmount it on shutdown / reboot.

Here are a few discussions on the subject. I prefer autofs, because I don’t always use systemd and like to keep my setups similar.

Anyway, the solution should probably be to add “noauto” in your fstab config

(My Local IP address):/mnt/Peliculas01-01/Peliculas01 /media/asuka/Peliculas01 nfs defaults,noauto,_netdev 0 0

So, when your NAS is off or when you are not at home with your laptop, your NAS won’t be automatically mounted. If you want to mount it, you just (sudo) mount /media/asuka/Peliculas01. If it is mounted and you turn your NAS off before your laptop, you should (sudo) umount /media/asuka/Peliculas01 before you shutdown your NAS, but if you forget, use the lazy option (umount -l /media/asuka/Peliculas01) and you shouldn’t have a problem with systemd waiting a whackton of time to timeout the mount.

2 Likes

Thanks @Exard3k and @Biky. The unintentional best solution I found was from @Biky. The noauto part was the key. It makes the system to not mount it by default. For mounting and unmounting, I created a script run by my StreamDeckUI for easy access and convenience.

I tried the timeo=10 but unfortunately the loading time was the same. Perhaps I made a mistake somewhere :point_right: :point_left:.

At any rate, thanks everyone for your help, this solved my issue :hugs:.

2 Likes

For an NFS mount that might disappear on you, you also want to use the “soft” and “intr” flags. Found in man 5 nfs

2 Likes

or use autofs?

2 Likes

Yeah, I like autofs, I use it on my systems (because I’m not running systemd on most of them). But on systemd autofs gets a little buggy (especially because systemd has a long timeout to kill it, even if you change the timeout to 10sec, you will get a timeout for something else and still have to wait 1.5 minutes for your system to reboot or shutdown). Anyways, systemd vs autofs has been in the post I linked to (“Having issues automounting samba share”).

Personally, it was easier for me to script autofs to refresh samba shares when a new folder shows up, than to use systemd mount. It is true that autofs has some bugs here and there, because it’s old, but it still gets the job done (especially in non-systemd distros, like Void and Alpine).

The options soft and intr are useful even with autofs. You don’t want your system to hang when something is accessing the share and it goes unreachable on you.

Do you need it to specifically automount?
I had the same problems years ago and the worst was when you boot and it cant find the network share for some ungodly reason… just stuck there with a hung boot… painful.
I have a couple network shares that I have mount points noted in gnome-disks or whatever and after boot i can just basically click it and it will auto mount it to the folder I want… not as flash and auto however my boot times are seconds…