fstab fails to mount NAS
How do i delay fstab until the network is connected ?
Im trying to mount my NAS at boot. Iv added the fstab line that works on my other comp (mint17.3 cinnamon) but on this comp (mint 18 kde) it does not. mount[3059] mount error(101): Network is unreachable I assume the network is not connected quickly enough but now im back to scratching my head. I tried crontab:- @reboot sleep 10;mount nas that didn't work. manually typing mount nas works fine once the network is up whats the proper way please, thx. EDIT:- update man mount says _netdev The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system). so i tried //192.168.2.1/volume(sda1) /home/user/nas cifs _netdev,users,username=user,password=pass,iocharset=utf8,sec=ntlm 0 0 but that didn't work either. |
If your system is using NetworkManager, then make sure you have "NetworkManager-wait-online" enabled. Otherwise the system can try to do a network mount before the network is really usable (and no, network.target does not ensure that).
|
sorry but how do i do that ? im pretty sure i am using networkmanager though.
|
ok i run systemctl enable systemd-networkd-wait-online.service and reboot but still fails
Quote:
Quote:
|
I didn't think the service was named "systemd-networkd-wait-online.service".
On my system (fedora) it is named "NetworkManager-wait-online.service". As a verification, it should be able to be mounted manually with "mount /home/user/nas". This will verify that the mount actually works, and that the network is functioning (no firewall blocks and such). |
try adding this to fstab: x-systemd.requires=network-online.target
|
yea think there are both but in my case i only have the one i used
https://www.freedesktop.org/wiki/Sof...NetworkTarget/ Ok i made a script to delay the command and stuck it in my auto-start and it actually works. No clue why the crontab does not. linux drives me crazy but almost finished this new OS installation with everything working. Thanks for the help and suggestions. |
Quote:
Quote:
Quote:
|
yep, exactly what i figured eventually.
iv been looking up how to run a script at login but after everything else has finished (well least the network connection), most help was saying .bash_profile, .bash_login, .profile etc but i think i need to look at the /etc/rc[0-6].d folders. |
Another option which will be easier then trying to write a unit file or lsb script is x-systemd.automount. It is similar to autofs where the share is automounted when accessed and unmounted after idle timeout has elapsed.
https://wiki.archlinux.org/index.php/Fstab |
yea i have seen them "auto mounters/dismounters" on my travels but looked overly complicated at the time, now im looking at run levels and im thinking hmmmm
|
Quote:
|
o i wouldn't be surprised , so all this crap im trying to actually get a grasp on is obsolete as far as im concerned :( this is one of the many problems learning linux , all the changes and redundant forum posts. so i suppose RUNLEVELS is used with SysV init and im not using that im using systemd daemon.
well going to try write a script that can be started at boot but will check for my network to be connected before trying to mount. hoping it will just need a loop and a check for a connection by grep'ing something like ifconfig output, just thinking allowed. because i really just want a permanent mount anyhow. Cant believe there is no easy way to run a script after user login has finished loading everything, could be quite a few other things that this behavior could cause a problem with. |
Depends on the distribution but systemd is backwards compatible and will use the old init scripts but using unit files is the better approach.
systemd can run rc.local which is basically the last init script before the desktop starts. I would still go with x-systemd.automount. |
Quote:
|
All times are GMT -5. The time now is 03:06 AM. |