You are not logged in.
My laptop has both a wired and a wireless NIC, and I'm using dhcpcd on the wired interface. Everything work well as long as the Ethernet cable always connects. However, if I plug the cable out (to use the wireless NIC) and reboot, the rebooting will take a lot longer because dhcpcd tries to obtain the IP address on a disconnected line. My question is, how can I have dhcpcd obtain IP only if the cable is connected? Thanks in advance.
Last edited by yorkz (2020-04-08 16:28:31)
Offline
Offline
2ManyDogs, the link you pointed to starts with this:
Tip: dhcpcd provides the same feature out of the box.
The problem is not dhcpcd, but rather the (frankly silly) default systemd service that is packaged with it. The solution is in the wiki page for dhcpcd.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thank you 2ManyDogs. "ifplugd" works, but I found that I had to write the ifplugd.action script to call "dhcpcd" on the "up" event.
Thank you Trilby, the "dhcpcd drop-in file" solution is simple, clean, and works perfectly!
Offline
Please remember to mark your thread [SOLVED] (edit the title of your first post).
Offline
Thanks 2ManyDogs for reminding me of marking this thread as [SOLVED]. I'll definitely do that but I've noticed a "side effect" of not having dhcdcd wait for a successful connection. The problem is that the daily pkgfile database update failed the first time the system booted in the morning:
systemd[1]: Failed to start pkgfile database update.
I enabled the pkgfile database update by:
sudo systemctl enable pkgfile-update.timer
after I installed pkgfile. This isn't a big deal though, but would be best if there's a simple way to address it.
Last edited by yorkz (2020-04-08 14:41:36)
Offline
That's a seperate issue. You could adjust the timer to wait with an OnBootSec, or make it depend on dhcpcd. But really, why are you using pkgfile at all - I just checked and was surprised that it's still in the repos. Pacman has the -F flag that now does the same thing.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
That's a seperate issue.
Agreed, I was just too lazy to start a brand new thread, sorry about that.
You could adjust the timer to wait with an OnBootSec, or make it depend on dhcpcd.
Thanks for the suggestion.
Pacman has the -F flag that now does the same thing
I'm not sure whether "pacman -F" is a full replacement of pkgfile because with pkgfile one can search which package owns a file without having the package installed. However, according to the pacman manpage:
-F, --files
Only packages that are part of your sync databases are searched.
My understanding is that the package has to be installed first. Please correct me if my understanding is wrong.
Last edited by yorkz (2020-04-08 15:41:46)
Offline
Your understanding is wrong.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Your understanding is wrong.
I realized that after some searching, thanks.
Offline