Fstab before network start?[Solved]

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
scewing
Level 1
Level 1
Posts: 2
Joined: Wed Apr 27, 2016 6:09 pm

Fstab before network start?[Solved]

Post by scewing »

I've installed Mint 17.3 XFCE version, and I added a line to my fstab to mount a samba windows share at boot.
It works great if I'm already running and just type 'mount -a'
The problem is at boot, I get an error message to type S to skip, or M to manually fix. I skip and it boots normally but the samba share isn't mounted.
I'm assuming this happens because fstab is processed before the network is up. Can anyone confirm this is the case or is there something else I'm missing? And of course, any suggestions to fix this?
Last edited by scewing on Thu Apr 28, 2016 1:02 pm, edited 1 time in total.
rene
Level 16
Level 16
Posts: 6681
Joined: Sun Mar 27, 2016 6:58 pm

Re: Fstab before network start?

Post by rene »

The problem will not be an fstab/network ordering issue, no. The upstart system divides its mountall(8) action into local and network filesystems all by itself, with network filesystems only being attempted at the point where you during boot (and in /var/log/boot.log) see "Starting Mount network filesystems"; after the network is up.

I recently advised someone on this forum to use fstab for mounting a CIFS share, so I thought I'd double check since I myself use autofs. Indeed, using in my /etc/fstab

Code: Select all

//LIVINGROOM/media	/mnt/tmp	cifs	noexec,guest
this mounts fine for me at boot. Triple checking, indeed the fstype cifs is in what mountall(8) considers network filesystems:
http://bazaar.launchpad.net/~ubuntu-bra ... ll.c#L1057
Also note that this is in fact in the with respect to this issue worst situation of letting NetworkManager manage the connection. No "fast" static configuration or anything like that. Also, my line clearly needs winbind to be up and running. All still well...

You may be hit be a huge timeout? I believe if it takes longer than 30 seconds for the mount to go though, mountall gives up. Or something silly like the mountpoint not being available yet? Please post your fstab line if this doesn't yet help.
altair4
Level 20
Level 20
Posts: 10187
Joined: Tue Feb 03, 2009 10:27 am

Re: Fstab before network start?

Post by altair4 »

@scewing,

May I ask why you want to have the share mounted at boot? Is it just a convenience so you don't have to mount it through the file manager or perhaps because you don't like the default mount point?

The reason I ask is because there is a clever way ( well, I think so anyway ) to do this after you log into your box which should be enough time for the network to be established:

** Make sure your mount point is under /media - this will trigger a udisks event that makes it work as I describe below.
** Then add the following options to your fstab declaration for that mount: noauto,user

I'll give you an example of my own fstab entry for a Win10 share:

Code: Select all

//vwin10.local/users/tester1/documents /media/Win10-Docs cifs username=smbuser,password=smbuserpw,uid=1000,noauto,user,vers=3.0 0 0
The way this works is I will see an entry on the side panel of my file manager ( or any application ) for "Win10-Docs". When selected it will automatically mount that share and display it's contents. After it's use I can right click the link and unmount it. It's sort of a lazy man's AutoFS - well ... it's like AutoFS without the timeout provision.

If you want it to mount at boot for some other reason what you could do is formalize the "mount -a" process by creating a script:

Create a script:

Code: Select all

gksu gedit /etc/network/if-up.d/fstab
With this content:

Code: Select all

#!/bin/sh
mount -a
Save the file, exit gedit, and back in the terminal make the file executable:

Code: Select all

sudo chmod +x /etc/network/if-up.d/fstab
Any script placed in if-up.d will execute only after the network is up.

Side note: Depending on how faithful Mint is to it's Ubuntu roots when Mint goes to version 18 you will have a systemd option that you can add to your fstab declaration that does just what you want without all these workarounds
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
rene
Level 16
Level 16
Posts: 6681
Joined: Sun Mar 27, 2016 6:58 pm

Re: Fstab before network start?

Post by rene »

Now, don't get me wrong, fine addition, but I feel I really should comment on
... which should be enough time for the network to be established.
Really, upstart nor systemd in Mint nor (m)any other distribution(s) is clumsy enough to start mounting network filesystems before it has put the network up :) Things should just work and if not, not something generic but something specific is going on. But as said otherwise, sure...
scewing
Level 1
Level 1
Posts: 2
Joined: Wed Apr 27, 2016 6:09 pm

Re: Fstab before network start?[Solved]

Post by scewing »

I had originally been using "cifs" in the fstab entry, but was having trouble with permissions (still using mount -a), and I switched to "ntfs-3g" which seemed to solve that problem. Then I rebooted and got the error.

As for why I would want to mount network shares at boot, the network share has all of my media. Using Clementine to play mp3's, it wants a local drive for its library, so I found just mounting the network share at boot to be the easiest solution.

I changed the fstab line back to use 'cifs' and changed some permissions on the server and now it works fine.

Thanks very much!
rene
Level 16
Level 16
Posts: 6681
Joined: Sun Mar 27, 2016 6:58 pm

Re: Fstab before network start?[Solved]

Post by rene »

I see. NTFS, -3G or otherwise, is only for mounting local filesystems. That is, if you were to have a Windows install on the same computer you'd (be able to) mount its NTFS filesystems in the same manner as you do your Linux filesystems by specifying their underlying partition as the device, but using the ntfs-3g fstype rather then ext4 or whichever fstype you use on Linux. You need smbfs/cifs for filesystems on a remote Windows machine. Good that it's solved.
Post Reply

Return to “Installation & Boot”