Summary: | net-misc/dhcpcd: provide systemd service which delays network-online.target | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | quazgar <quazgar> |
Component: | Current packages | Assignee: | William Hubbs <williamh> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | base-system, jstein, systemd |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
proposed patch
new dhcpcd-waitip service |
Description
quazgar
2016-05-08 22:23:03 UTC
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. |