-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to wait until /etc/resolv.conf is fully written before forking into the background #258
Comments
-w only waits until an address can be used. Looks to me like you have a few options on how to resolve this.
Any solution needs to cope with carrier droppage or the DHCP server not responding, etc so if you really need DNS working for stuff in a scripted fashion then using the dhcpcd hooks system is really the best option here. |
Any clues on how to make option 3 work? Note the DHCP server is built into the hypervisor (qemu) so to some extent we control it or at least understand how it behaves. |
Also, look at the supplied |
Is there an example of an exit hook? The man page doesn't really explain anything about it. Anyway I'm probably just going to add a loop which busy waits looking for |
Work around this issue with dhcpcd: NetworkConfiguration/dhcpcd#258 Fixes: commit 0e37e5f
The situation is we have an appliance-type environment where we run
dhcpcd eth0
to bring up the interface and set/etc/resolv.conf
:https://github.com/libguestfs/libguestfs/blob/0e37e5feeaf4380bc971a3105ead8e779a94fa36/appliance/init#L123
This generally works well except that
/etc/resolv.conf
does not have anameserver
record added until one or two seconds after dhcpcd forks into the background. In the init script I added:and the output was:
I'd like dhcpcd (or some method) to wait before going into the background until
/etc/resolv.conf
has a nameserver record.Otherwise later commands (which we run immediately after init, no sleeping) fail because they cannot do DNS resolution.
I tried adding the
-w
flag but it didn't make a difference.The text was updated successfully, but these errors were encountered: