Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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).
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).
ok i run systemctl enable systemd-networkd-wait-online.service and reboot but still fails
Quote:
06/11/2016 19:08 greg-Inspiron-5767 systemd[1] Mounting /home/greg/nas...
06/11/2016 19:08 greg-Inspiron-5767 systemd[1] Started /etc/rc.local Compatibility.
06/11/2016 19:08 greg-Inspiron-5767 kernel [ 34.098833] FS-Cache: Loaded
06/11/2016 19:08 greg-Inspiron-5767 kernel [ 34.120358] FS-Cache: Netfs 'cifs' registered for caching
06/11/2016 19:08 greg-Inspiron-5767 kernel [ 34.120442] Key type cifs.spnego registered
06/11/2016 19:08 greg-Inspiron-5767 kernel [ 34.120449] Key type cifs.idmap registered
06/11/2016 19:08 greg-Inspiron-5767 mount[3046] mount error(101): Network is unreachable
06/11/2016 19:08 greg-Inspiron-5767 mount[3046] Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
06/11/2016 19:08 greg-Inspiron-5767 systemd[1] home-greg-nas.mount: Mount process exited, code=exited status=32
06/11/2016 19:08 greg-Inspiron-5767 systemd[1] Failed to mount /home/greg/nas.
06/11/2016 19:08 greg-Inspiron-5767 systemd[1] Dependency failed for Remote File Systems.
06/11/2016 19:08 greg-Inspiron-5767 kernel [ 34.133251] CIFS VFS: Error connecting to socket. Aborting operation.
06/11/2016 19:08 greg-Inspiron-5767 kernel [ 34.133300] CIFS VFS: cifs_mount failed w/return code = -101
06/11/2016 19:08 greg-Inspiron-5767 systemd[1] remote-fs.target: Job remote-fs.target/start failed with result 'dependency'.
06/11/2016 19:08 greg-Inspiron-5767 systemd[1] home-greg-nas.mount: Unit entered failed state.
check network services
Quote:
greg@greg-Inspiron-5767 ~ $ systemctl -l --type service --all | grep network
networking.service loaded active exited Raise network interfaces
systemd-networkd-resolvconf-update.service loaded inactive dead Update resolvconf for networkd DNS
systemd-networkd-wait-online.service loaded inactive dead Wait for Network to be Configured
systemd-networkd.service loaded inactive dead Network Service
Last edited by JackDinn; 11-06-2016 at 01:25 PM.
Reason: update
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).
That is not sufficient. Systemd assumes the network is ready as soon as it starts NetworkManager, and it isn't started. That is what NetworkManager-wait-online service is for. It directs systemd to wait for a message from NetworkManager before assuming the network is actually usable.
Quote:
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.
The crontab doesn't work because you used the @reboot option. And since cron is being started BEFORE the network it can't work. Now if you put a delay of something like 5 minutes it might have worked.
Quote:
linux drives me crazy but almost finished this new OS installation with everything working.
Thanks for the help and suggestions.
Your problems are strictly due to the uncontrollable nature of systemd, with many interactions that are nearly invisible.
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.
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
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
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.
systemd will run them... but not necessarily when they should be. THEIR order will be correct... but not necessarily in the proper order for the rest of the system. Things can get out of order.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.