System not mounting network drive on boot

I have been working at solving this for a bit. I finally have a couple fstab lines that will mount with

sudo mount -a

I was getting errors when I would reboot. It could not mount these locations. I finally came to the conclusion it was because the network had not “come up” yet.

Searching the forums, I found a few instances of the same problem where others were told to add “_netdev” to the fstab line. I never clearly found an example of the correct syntax.

Once I added it, I am now able to boot without the boot error related to mounting the location, but now it never mounts the location. If I go to the CLI and run sudo mount -a, they mount fine.

my fstab format currently:

//“ipaddress”/“location_path” /mnt/“mount_path”/ cifs
_netdev,credentials=/home/tony/.smb,iocharset=utf8,noperm 0 0

Any ideas on what to try?

You could try adding x-systemd.automount to the fstab parameters, and hopefully it will automatically mount the location when you try to access it. This won’t necessarily “mount it at boot time”, but it should likely allow you to mount it on demand simply by browsing to the location, or accessing it via another program.

You can also add nofail for an unimpeded boot process.

When you mount network shares in fstab - the mount is depending on your network which must be up and connected for the mount to succeed.

The easiest method is to use systemd units.

And for your own sanitys sake - don’t use /mnt - it’s designated temporary mounts - you are likely to get permission errors or worse when a script you use rely on temporary mount.

1 Like

That’s why I’m not a fan of the purists “fstab-only” approach.

Having a “network up” doesn’t mean the destination server is available or reachable yet (or at all.)

That’s the problem with the general idea of “network is up”, since there are different end points that may or may not suffice depending on the goal:

  • Network adapter is up
  • Local IP address is assigned
  • Local network server is reachable
  • Remote destination (“over the internet”) is reachable

In other words “network is up” doesn’t really mean anything in particular and differs for each person’s needs.

1 Like

It’s a little complicated but I got this to work for me.

Since I am a noob, how should I add it to the fstab? Simply put it somewhere in the string below as displayed?

//“ipaddress”/“location_path” /mnt/“mount_path”/ cifs
_netdev,x-systemd.automount,credentials=/home/tony/.smb,iocharset=utf8,noperm 0 0

Whew, this will be a whole new learning curve. I will need to take some time to read and endeavor to understand it… Thanks.

Thanks, this looks to be a subset link within the response from @linux-aarhus

Yeah, this is a bit complicated at first read for a noob like me. But I may need to learn it.

With Linux there’s always many roads that lead to the same destination - that includes shares.

The mount appears to be a personal mount - the credentials are stored in your home.

The easiest method - no fstab - no mount units - just a script utilizing gio mount.

Create the script from the topic above and edit the variables section then run it.

# your samba server's hostname or IP address

# the share name on the server

# symlink name

# symlink is placed in this folder

# credentials


When you get more confident with Linux - you can create a user service for it. Also explained in the topic linked.

Mounting using fstab can be frustrating and over the years it has given me headache more than once.

Especially when you mount network shares using fstab. With systemd you never know in which order anything becomes available because everything initializes in parallel using threading.

This causes shares to become arbitrarily unavailable more often than most will admit.

Over the years, I found the only reliable method on systemd is to use mount units.

Once setup they just work - no mounting on boot - but mounting on access - umount when idle for a configurable time.

1 Like

Apparently don’t say this over on /r/linux :roll_eyes:

Reddit is just weird.

OK, I finally got it working and coming up as expected at boot using systemd mount units. That was an interesting learning curve, but I think I must be missing something.

The new problem (or irritation), is the system now takes 90 seconds to shut down. I get a "system is going to shut down NOW??? message, and then it takes 90 seconds. When I disable the systemd mount, the system shuts down normal (like three seconds with no message). I then enable and start the mount. The shutdown now takes 90 seconds. I don’t know how to troubleshoot this (noob again)…

My mount below (found a script that helped a little). Is it something in there? Thanks for the help.

Description=TrueNAS - Remote Mount

What=// - Remote


remove requires and after

add _netdev to options

create and enable an automount unit instead of enabling the mount unit.

A sample mount and automount can be found

1 Like

Add a automount unit. If it is 10sec in idle it will automatically unmount it.

1 Like

Success!!! Thanks to @linux-aarhus and @megavolt and @winnie @MAYBL8

It was a rewarding learning experience…

Steps I had to learn through (for others)

1 - Create Mount Unit (must have prior to Automount … I learned) and save in /etc/systemd/system
- Filename MUST BE named after mount path. eg Mount Path = /home/jim/1_TrueNAS/Remote -----> File Name = home-jim-1_TrueNAS-Remote.mount
My Mount Unit

Description=Mount TrueNAS - Remote

What=// - Remote


2 - Create Automount in same folder using same naming convention other than automount at the end instead of mount → home-jim-1_TrueNAS-Remote.automount

My Automount

Description=Automount TrueNAS - Remote



3 - Enable and Start Automount

sudo systemctl enable home-jim-1_TrueNAS-Remote.automount
sudo systemctl start home-jim-1_TrueNAS-Remote.automount

Thanks for the Timeout settings. That helped me.
I had that problem also.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.