View previous topic :: View next topic |
Author |
Message |
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10587 Location: Somewhere over Atlanta, Georgia
|
Posted: Tue Feb 05, 2013 5:02 pm Post subject: nfsmount Doesn't Wait for net.wlan0 to Associate |
|
|
Actually, this happens with ntp-client service as well. These two services fail to complete properly, I believe, because, although the network interface has been started, wpa_supplicant hasn't yet associated to an access point when they try to start.
It doesn't seem to matter what I put in the rc_need in the appropriate /etc/conf.d/ file (or, at least, I haven't come up with the right answer). OpenRC appears to let the services try to start as soon as net.wlan0 has started. So, I end up without my NFS shares mounted and with my clock not most accurately set.
After I login, I can start those services (which show status "stopped") just fine and they always complete successfully. Of course, by then, the network is up and dhcpcd has gotten an IP address.
What am I doing wrong? As far as I know, this used to work but unfortunately I can't point to the change that made it stop working.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10587 Location: Somewhere over Atlanta, Georgia
|
Posted: Fri Feb 08, 2013 3:13 pm Post subject: |
|
|
Polite bump.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Fri Feb 08, 2013 7:09 pm Post subject: |
|
|
This might work, it makes dhcpcd wait in the foreground until it gets an IP:
Code: | # /etc/conf.d/net
dhcpcd_wlan0="-w" |
|
|
Back to top |
|
|
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10587 Location: Somewhere over Atlanta, Georgia
|
Posted: Fri Feb 15, 2013 3:01 am Post subject: |
|
|
Thanks. Alas, that didn't appear to do anything. I located the dhcpcd.conf option that did the same thing (waitip) and this did succeed in producing a very long timeout but didn't actually result in the nfsmount or ntp-client starting successfully. I'll report detailed logging shortly.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
Odward n00b
Joined: 21 Mar 2012 Posts: 65
|
Posted: Fri Feb 15, 2013 8:05 am Post subject: |
|
|
I'd also be glad to know of a better solution, but I had the same problem with distcc failing to start because
the network wasn't ready. At the time I was using wicd, but I think the same thing could work for you.
My solution was to modify /etc/init.d/distccd
Code: | start() {
sleep 10
ebegin "Starting distccd" |
You can of course play with the necessary sleep time to suit your needs. I didn't actually test to see just how
small a sleep value I could get away with.
Also you may want to toy with the need / before / after type values to ensure that, for example, after
wpa_supplicant starts then ntp starts (with the sleep) then nfsmount can start (which won't need an additional
sleep since ntp already waited). Hopefully that makes sense, the goal being to prevent services requiring
the sleep for network to become ready from starting in a different order on a subsequent boot.
**Edit
I also realize this doesn't explain why / when it stopped working, and may not be an ideal solution :D
At the time I was personally using a static IP and had distcc configured to listen on that address, but I couldn't
figure out how else to make it wait for that address to become available for listening. |
|
Back to top |
|
|
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10587 Location: Somewhere over Atlanta, Georgia
|
Posted: Fri Feb 15, 2013 1:39 pm Post subject: |
|
|
Thanks for the thought. Yeah, that occurred to me, too. Since all I have to do to correct the situation for now is runI'm committed discovering the correct solution and living with the only slightly annoying workaround until I do.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54174 Location: 56N 3W
|
Posted: Fri Feb 15, 2013 10:15 pm Post subject: |
|
|
John R. Graham,
For your nfs shares, you can add bg to the mount options, that kicks the mount operation into the background and lets other things continue to start.
If you need the NFS shares for startup things, it may not be so good. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Fri Feb 15, 2013 10:25 pm Post subject: |
|
|
why not wait for your IP to get assign ?
Could add that after dhcp service, could add that as a service itself (says linkup) and make nfsmount depend on linkup
Code: | ifconfig eth0 | grep 'inet' | cut -d: -f2 | awk '{ print $2 }' |
|
|
Back to top |
|
|
antonlacon Apprentice
Joined: 27 Jun 2004 Posts: 257
|
Posted: Wed Apr 03, 2013 3:21 am Post subject: |
|
|
For ntp-client, editing /etc/init.d/ntp-client to 'need net' (instead of 'after net') in the depend() section made it properly wait for wlan0 to authenticate. Filed a bug on it here: https://bugs.gentoo.org/show_bug.cgi?id=463974 |
|
Back to top |
|
|
javeree Guru
Joined: 29 Jan 2006 Posts: 453
|
Posted: Wed Apr 03, 2013 7:52 am Post subject: |
|
|
The problem with any approach is that requirements can vary wildly.
What if you have a PC with multiple network interfaces, of which only some are up depending on varying conditions ? Which interface shoud nfsmount wait for ?
I may have a number of mounts I need to access through eth0 and a number that I need through eth1, and a third one through wlan0. However, when wan0 does not come up for any reason, I still want the mounts for eth0 and eth1 to succeed.
A solution may be to mount as late as possible, but then (as someone pointed out), other services may need one of these mounts.
You may even want nfsmount without any net interface at all (e.g. I share portage over nfs. For consistency of setup all PC's, including the one sharing portage mount it on /mnt/portage. The sharing PC doesn't need net to mount portage).
I have also strugled in the past and finally found there is no single solution that works every time. I have read on the theory of systemd and think this is one point where systemd may have a solution.
My solution was to put rc_after statements in /etc/conf.d/nfsmount, and retry failed mounts in local.start |
|
Back to top |
|
|
|