I found that mounting NFS shares (via systemd's target remote-fs.target) at boot time does not work, because the network (probably more specifically, the Network Manager) is not ready yet. These are the relevant log lines: ... May 08 23:41:01 droggelbecher dhcpcd[2268]: dev: loaded udev May 08 23:41:01 droggelbecher systemd[1]: Network Manager is not active. May 08 23:41:01 droggelbecher systemd[1]: Dependency failed for Network Manager Wait Online. May 08 23:41:01 droggelbecher systemd[1]: NetworkManager-wait-online.service: Job NetworkManager-wait-online.service/start failed with result 'dependency'. May 08 23:41:01 droggelbecher systemd[1]: Reached target Network. May 08 23:41:01 droggelbecher systemd[1]: Started Privoxy Web Proxy With Advanced Filtering Capabilities. May 08 23:41:01 droggelbecher systemd[1]: Starting CUPS Scheduler... May 08 23:41:01 droggelbecher systemd[1]: Starting OpenSSH server daemon... May 08 23:41:01 droggelbecher systemd[1]: Reached target Network is Online. May 08 23:41:01 droggelbecher systemd[1]: Mounting /media/backup... ... May 08 23:41:01 droggelbecher mount[2282]: mount.nfs: Failed to resolve server colossus: Temporary failure in name resolution ... May 08 23:41:01 droggelbecher systemd[1]: media-backup.mount: Mount process exited, code=exited status=32 May 08 23:41:01 droggelbecher systemd[1]: Failed to mount /media/backup. May 08 23:41:01 droggelbecher systemd[1]: Dependency failed for Remote File Systems. May 08 23:41:01 droggelbecher systemd[1]: remote-fs.target: Job remote-fs.target/start failed with result 'dependency'. ... Manually mounting the shares after logging in with "systemctl restart remote-fs.target" works flawlessly.
What are you using to configure your network interfaces? I see references to both dhcpcd and Network Manager in that log, but I'm guessing you don't have Network Manager enabled.
(In reply to Mike Gilbert from comment #1) > What are you using to configure your network interfaces? > > I see references to both dhcpcd and Network Manager in that log, but I'm > guessing you don't have Network Manager enabled. Uh, I don't remember the setup when installing this machine, but from the systemctl status output, I guess that it's only dhcpcd: # systemctl status dhcpcd.service ● dhcpcd.service - Lightweight DHCP client daemon Loaded: loaded (/usr/lib64/systemd/system/dhcpcd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2016-05-09 17:54:52 CEST; 4h 10min ago Main PID: 2270 (dhcpcd) CGroup: /system.slice/dhcpcd.service └─2270 /sbin/dhcpcd -q --nobackground # systemctl status "NetworkManager.service" ● NetworkManager.service - Network Manager Loaded: loaded (/usr/lib64/systemd/system/NetworkManager.service; disabled; vendor preset: enabled) Active: inactive (dead) And indeed the mounting is being attempted before the dhcpcd even gets an address: journalctl -b 0 _SYSTEMD_UNIT=media-backup.mount _SYSTEMD_UNIT=dhcpcd.service -- Logs begin at Sat 2015-09-12 19:08:00 CEST, end at Mon 2016-05-09 22:10:01 CEST. -- May 09 17:54:52 droggelbecher dhcpcd[2270]: dev: loaded udev May 09 17:54:52 droggelbecher dhcpcd[2270]: no interfaces have a carrier May 09 17:54:52 droggelbecher mount[2295]: mount.nfs: Failed to resolve server colossus: Temporary failure in name resolution May 09 17:54:53 droggelbecher dhcpcd[2270]: enp5s0: waiting for carrier May 09 17:54:55 droggelbecher dhcpcd[2270]: enp5s0: carrier acquired May 09 17:54:55 droggelbecher dhcpcd[2270]: enp5s0: adding address xxxx::xxxx:xxxx:xxxx:xxxx May 09 17:54:55 droggelbecher dhcpcd[2270]: DUID xx:xx:...:xx:xx May 09 17:54:55 droggelbecher dhcpcd[2270]: enp5s0: IAID ... May 09 17:54:55 droggelbecher dhcpcd[2270]: enp5s0: rebinding lease of xxx.xxx.xxx.xxx May 09 17:54:55 droggelbecher dhcpcd[2270]: enp5s0: probing address xxx.xxx.xxx.xxx/24 Maybe adding dhcpcd as a dependency might help? Or is there a common target which is fulfilled by any kind of available non-local network?
This is a known issue with dhcpcd.service, though I cannot find an existing bug report. dhcpcd should provide a synchronous unit with Before=network-online.target.
Created attachment 433806 [details, diff] proposed patch Here's a patch for dhcpcd.service.
Created attachment 433808 [details] new dhcpcd-waitip service Additonally, here's a systemd unit that calls dhcpcd -w, in case dhcpcd starts before the interfaces gain carrier.
(In reply to Mike Gilbert from comment #5) > Additonally, here's a systemd unit that calls dhcpcd -w, in case dhcpcd > starts before the interfaces gain carrier. I can confirm that the first patch changes nothing (dhcpcd forks and remote-fs is started before the interfaces are completely up), but adding the -w option works for me.
Comment on attachment 433808 [details] new dhcpcd-waitip service Discussed this with William Hubbs on IRC. We are going to go with my original patch to switch dhcpcd.service to forking mode and add Before=network-online.target. For people that need the waitip option, that can be configured in /etc/dhcpcd.conf.
I have made the changes to the unit but not revbumped yet because I'm waiting a day or so for another possible bug fix. To test these changes, just re-emerge dhcpcd then if you need the waitip option you can configure it in /etc/dhcpcd.conf.
There is no need to "fix" dhcpcd here. Instead, use dhcpcd-online from the dhcpcd-ui project - it's in portage as net-misc/dhcpcd-ui: https://packages.gentoo.org/packages/net-misc/dhcpcd-ui It even has a systemd unit file, just like nm-online from NetworkManager. Maybe add a not for this to a fine manual?
(In reply to Roy Marples from comment #9) Nice, had no idea that even existed. I think the change we made to dhcpcd.service is still valid though; forking allows systemd to detect startup problems. It might mean that we could drop Before=network-online.target from dhcpcd.service, but that's still useful in case someone uses waitip without dhcpcd-ui installed.