View previous topic :: View next topic |
Author |
Message |
Bili Oslavi n00b


Joined: 12 Mar 2023 Posts: 23
|
Posted: Sun Jul 30, 2023 8:39 pm Post subject: dhcpcd enabled by default |
|
|
Just did a world update after a couple of months on several machines and dhcpcd is now
enabled. Causes problems when the machines reboot since scripts won't work with the new addresses
being allocated by dhcp.
I can't find it in runlevels, so doing an rc-update delete doesn't help. Right now I'm just unemerging the
package but it gets pulled back in with any new world update.
What's the right thing to do with this if I don't want dhcp running? |
|
Back to top |
|
 |
rab0171610 Guru

Joined: 24 Dec 2022 Posts: 550
|
Posted: Sun Jul 30, 2023 8:57 pm Post subject: |
|
|
Quote: | What's the right thing to do with this if I don't want dhcp running? |
I don't know the answer to that as I did not set up your system. First thing I would want to know is what is pulling it in during updates? After it is installed either with update or --oneshot, try a depclean with pretend and see what is requiring it as a dependency Code: | emerge -pv --depclean dhcpcd |
|
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 55453 Location: 56N 3W
|
Posted: Sun Jul 30, 2023 9:45 pm Post subject: |
|
|
Bili Oslavi,
The answer depends on how you control networking. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3682
|
Posted: Sun Jul 30, 2023 10:05 pm Post subject: |
|
|
It probably got pulled in via net dependency.
Apparently, even though we have this cool dependency graph inside init helper, we're still supposed to explicitly enable network service of choice instead of relying on dependencies being handled in a sane way. |
|
Back to top |
|
 |
Bili Oslavi n00b


Joined: 12 Mar 2023 Posts: 23
|
Posted: Sun Jul 30, 2023 10:57 pm Post subject: |
|
|
Thanks everyone for your answers. All very helpful.
emerge -pv --depclean dhcpcd
Calculating dependencies... done!
net-misc/dhcpcd-9.5.1 pulled in by:
net-misc/netifrc-0.7.5 requires net-misc/dhcpcd
net-misc/netifrc: "This package contains the Gentoo network interface management scripts, which were separated from OpenRC"
It doesn't sound like I should nuke it The package has existed since 2019, and I probably had it installed since then given
what it contains. So something was changed in net-misc/netifrc in the last few months to make dhcpcd active by default.
Maybe it's from when this was put in:
net/dhcpcd.sh: adapt to dhcpcd-10 versioning 2023-04-17
.
I'll check with those guys. |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3682
|
Posted: Sun Jul 30, 2023 11:15 pm Post subject: |
|
|
Yes, netifrc got a new dependency on dhcpcd and it broke systems that had network as a dependency |
|
Back to top |
|
 |
rab0171610 Guru

Joined: 24 Dec 2022 Posts: 550
|
Posted: Sun Jul 30, 2023 11:15 pm Post subject: |
|
|
I don't use RC but the ebuild has a dhcp use flag. Looking at the ebuild it has:
Code: | dhcp? ( || ( net-misc/dhcpcd net-misc/dhcp[client] ) ) |
If you do not need that maybe it is possible to just use -dhcp for that package. Others would know better than me about that. But something to look into if you are using some other mechanism for IP addresses. |
|
Back to top |
|
 |
rab0171610 Guru

Joined: 24 Dec 2022 Posts: 550
|
Posted: Mon Jul 31, 2023 12:47 am Post subject: |
|
|
See section INTERFACE HANDLERS:
https://gitweb.gentoo.org/proj/netifrc.git/tree/doc/net.example.Linux.in
dhcp is the default, you can specify something else, but if not dhcpcd is the default.
The other option is static IP addresses or you can do:
Code: | If you don't want ANY address (only useful when calling for advanced stuff)
config_eth0="null" |
You can also specify a fallback.
*It may help to read through the current document above and make sure you have the configuration up to date for your use case. |
|
Back to top |
|
 |
Bili Oslavi n00b


Joined: 12 Mar 2023 Posts: 23
|
Posted: Mon Jul 31, 2023 1:38 am Post subject: |
|
|
"See section INTERFACE HANDLERS: "
This is interesting. I have all my statics in the /etc/conf.d/net file on each of 9 client machines.
It's been that way for years. All of the dhcp config lines are commented out in the file.
But it seems like my statics are getting ignored now unless I unmerge dhcpcd. Once unmerged,
the conf.d/net file gets read properly and life is good. |
|
Back to top |
|
 |
kimchi_sg Advocate

Joined: 26 Nov 2004 Posts: 3039
|
Posted: Mon Jul 31, 2023 1:40 am Post subject: |
|
|
Bili Oslavi wrote: | Thanks everyone for your answers. All very helpful.
emerge -pv --depclean dhcpcd
Calculating dependencies... done!
net-misc/dhcpcd-9.5.1 pulled in by:
net-misc/netifrc-0.7.5 requires net-misc/dhcpcd
net-misc/netifrc: "This package contains the Gentoo network interface management scripts, which were separated from OpenRC"
It doesn't sound like I should nuke it The package has existed since 2019, and I probably had it installed since then given
what it contains. So something was changed in net-misc/netifrc in the last few months to make dhcpcd active by default.
Maybe it's from when this was put in:
net/dhcpcd.sh: adapt to dhcpcd-10 versioning 2023-04-17
.
I'll check with those guys. |
From netifrc ebuild,
Code: |
IUSE="+dhcp"
RDEPEND="sys-apps/gentoo-functions
>=sys-apps/openrc-0.15
dhcp? ( || ( net-misc/dhcpcd net-misc/dhcp[client] ) )"
|
If the problem is just dhcpcd client being installed where there was none before, just set USE="-dhcp" for net-misc/netifrc. |
|
Back to top |
|
 |
Logicien Veteran


Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Mon Jul 31, 2023 1:59 am Post subject: |
|
|
A workaround could to configure Dhcpcd in a way that it will start but will manage no network interface in /etc/dhcpcd.conf. _________________ Paul |
|
Back to top |
|
 |
Bili Oslavi n00b


Joined: 12 Mar 2023 Posts: 23
|
Posted: Mon Jul 31, 2023 2:06 am Post subject: |
|
|
Hi kimchi_sg,
Quote: | From netifrc ebuild, .... set USE="-dhcp" for net-misc/netifrc. |
This was my first take on it as well. I tried the -dhcp flag as a USE, and also in make.conf. Still gets
clobbered.
Hi Logicien,
Quote: | A workaround could to configure Dhcpcd in a way that it will start but will manage no network interface in /etc/dhcpcd.conf. |
This could be a sweet way around it. I'll give it a try. |
|
Back to top |
|
 |
grknight Retired Dev

Joined: 20 Feb 2015 Posts: 2266
|
Posted: Mon Jul 31, 2023 2:30 am Post subject: |
|
|
Alternatively, this could be caused by the default behaviour of OpenRC to run all providers of "net".
Creating/editing /etc/conf.d/dhcpcd to say rc_provide="!net" would eliminate this if dhcpcd is not to manage interfaces on a machine. |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3682
|
Posted: Mon Jul 31, 2023 8:16 am Post subject: |
|
|
grknight wrote: | Alternatively, this could be caused by the default behaviour of OpenRC to run all providers of "net".
Creating/editing /etc/conf.d/dhcpcd to say rc_provide="!net" would eliminate this if dhcpcd is not to manage interfaces on a machine. |
This will only work if you have explicitly enabled network services you want started.
Otherwise it starts things providing net in alphabetical order, one by one, ignoring the fact that some net down the list might be a better fit, and then you suddenly end up with rc-status reporting dhcpcd started by dependency listed under "dynamic runlevel: manual".
Which is why I consider current implementation of dependencies in openrc to be broken. |
|
Back to top |
|
 |
grknight Retired Dev

Joined: 20 Feb 2015 Posts: 2266
|
Posted: Mon Jul 31, 2023 12:25 pm Post subject: |
|
|
szatox wrote: | grknight wrote: | Alternatively, this could be caused by the default behaviour of OpenRC to run all providers of "net".
Creating/editing /etc/conf.d/dhcpcd to say rc_provide="!net" would eliminate this if dhcpcd is not to manage interfaces on a machine. |
This will only work if you have explicitly enabled network services you want started.
Otherwise it starts things providing net in alphabetical order, one by one, ignoring the fact that some net down the list might be a better fit, and then you suddenly end up with rc-status reporting dhcpcd started by dependency listed under "dynamic runlevel: manual".
Which is why I consider current implementation of dependencies in openrc to be broken. |
This is why I say add/edit the conf.d file to remove net and it will never be started by a dynamic runlevel. |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3682
|
Posted: Mon Jul 31, 2023 12:59 pm Post subject: |
|
|
Sorry, I've been thinking bout something else. Nevermind. |
|
Back to top |
|
 |
pjp Administrator


Joined: 16 Apr 2002 Posts: 20630
|
Posted: Mon Jul 31, 2023 6:47 pm Post subject: |
|
|
grknight wrote: | szatox wrote: | grknight wrote: | Alternatively, this could be caused by the default behaviour of OpenRC to run all providers of "net".
Creating/editing /etc/conf.d/dhcpcd to say rc_provide="!net" would eliminate this if dhcpcd is not to manage interfaces on a machine. |
This will only work if you have explicitly enabled network services you want started.
Otherwise it starts things providing net in alphabetical order, one by one, ignoring the fact that some net down the list might be a better fit, and then you suddenly end up with rc-status reporting dhcpcd started by dependency listed under "dynamic runlevel: manual".
Which is why I consider current implementation of dependencies in openrc to be broken. |
This is why I say add/edit the conf.d file to remove net and it will never be started by a dynamic runlevel. | Wouldn't this be a bug in openrc? Having to use a dhcpcd config file to have openrc not start a dhcpd service seems like an odd approach, especially given the -dhcp USE flag. _________________ Quis separabit? Quo animo? |
|
Back to top |
|
 |
Bili Oslavi n00b


Joined: 12 Mar 2023 Posts: 23
|
Posted: Sat Oct 07, 2023 12:49 am Post subject: |
|
|
So in summary,
net-misc/netifrc now pulls in dhcpcd in an activated form during install. This wipes out any static IP's set
in /etc/conf.d/net once the system is rebooted.
It's possible to just unmerge dhcpcd or remove the rc init for dhcpcd, but it gets pulled back in with world
updates so that's annoying.
FWIW, I've found the simplest way around this so far is just to add an "ipv6only" flag into /etc/dhcpcd.conf.
This seems to stop dhcpcd from hijacking the ipv4 space even when static IP's are configured. |
|
Back to top |
|
 |
dmpogo Advocate

Joined: 02 Sep 2004 Posts: 3524 Location: Canada
|
Posted: Sat Oct 07, 2023 12:56 am Post subject: |
|
|
Bili Oslavi wrote: | So in summary,
net-misc/netifrc now pulls in dhcpcd in an activated form during install. This wipes out any static IP's set
in /etc/conf.d/net once the system is rebooted.
It's possible to just unmerge dhcpcd or remove the rc init for dhcpcd, but it gets pulled back in with world
updates so that's annoying.
FWIW, I've found the simplest way around this so far is just to add an "ipv6only" flag into /etc/dhcpcd.conf.
This seems to stop dhcpcd from hijacking the ipv4 space even when static IP's are configured. |
If you put net-misc/netifrc -dhcp
in /etc/portage/package.use (either file, or in some file under if package.use is a directory), is it still getting pulled back after deletion ? |
|
Back to top |
|
 |
grknight Retired Dev

Joined: 20 Feb 2015 Posts: 2266
|
Posted: Sat Oct 07, 2023 12:59 am Post subject: |
|
|
Bili Oslavi wrote: | So in summary,
net-misc/netifrc now pulls in dhcpcd in an activated form during install. This wipes out any static IP's set
in /etc/conf.d/net once the system is rebooted.
It's possible to just unmerge dhcpcd or remove the rc init for dhcpcd, but it gets pulled back in with world
updates so that's annoying.
FWIW, I've found the simplest way around this so far is just to add an "ipv6only" flag into /etc/dhcpcd.conf.
This seems to stop dhcpcd from hijacking the ipv4 space even when static IP's are configured. |
Many new people want DHCP and are lost without one installed.
When configuring a static, it is not much more of a stretch to change a USE or a different conf.d file like I've mentioned.
Edit:
Because of OpenRC's default of rc_depend_strict="YES", if one service "need net" then all installed services that "provide net" (including netifc, every symlink created, and dhcpcd) will be forcefully started.
It can be argued, because of the default, that it is a bug to have "need net" in a service file when the author means "use net" (use starts only if activated in a runlevel).
Admins can override "need net" locally with rc_need="!net net.foo" but that takes a bit of knowledge as well. |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3682
|
Posted: Sat Oct 07, 2023 12:07 pm Post subject: |
|
|
Quote: | Many new people want DHCP and are lost without one installed. | Fair point. Too bad the chosen dhcp provider happens to install a conflicting service.
I don't recall netifrc ever having problems with dhcp. It actually picked my slack back in the days, calling udhcpc from the day 1, before I even knew what busybox is. I think genkernel used to install busybox though, so maybe this interaction accidentally made things work.
Either way, current solution is ugly, illogical, and breaks the principle of least surprise.
Code: | /lib/netifrc/net # ls *dhc*
dhclient.sh dhclientv6.sh dhcpcd.sh udhcpc.sh
|
I think dhcpcd is the only dhcp client supported by netifrc which gets in netifrc's way and requires manual intervention in 2 places outside of its own configuration to make things work.
(disabling strict dependencies and explicitly enabling other net service)
AFAIR this is a result of change to dhcpcd though. Netifrc was able to use dhcpcd per-interface-client since before dhcpcd got upgraded to a system-wide-service and never dropped it afterwards. |
|
Back to top |
|
 |
grknight Retired Dev

Joined: 20 Feb 2015 Posts: 2266
|
Posted: Sat Oct 07, 2023 2:25 pm Post subject: |
|
|
szatox wrote: | AFAIR this is a result of change to dhcpcd though. Netifrc was able to use dhcpcd per-interface-client since before dhcpcd got upgraded to a system-wide-service and never dropped it afterwards. |
This is still how it is. The problem becomes if dhcpcd is run in "manager" mode which defaults to watching all interface for connections. The "manager" is started via the dhcpcd service.
netifrc still uses per-interface.
The key with static configurations is controlling what service is started. |
|
Back to top |
|
 |
dmpogo Advocate

Joined: 02 Sep 2004 Posts: 3524 Location: Canada
|
Posted: Sat Oct 07, 2023 4:45 pm Post subject: |
|
|
grknight wrote: | szatox wrote: | AFAIR this is a result of change to dhcpcd though. Netifrc was able to use dhcpcd per-interface-client since before dhcpcd got upgraded to a system-wide-service and never dropped it afterwards. |
This is still how it is. The problem becomes if dhcpcd is run in "manager" mode which defaults to watching all interface for connections. The "manager" is started via the dhcpcd service.
netifrc still uses per-interface.
The key with static configurations is controlling what service is started. |
What is the point of netifrc if dhcpd is in manager mode ? (I for one have only dhcpd on my machines). Looks like they are trying to do step on each other feet in this case. |
|
Back to top |
|
 |
Bili Oslavi n00b


Joined: 12 Mar 2023 Posts: 23
|
Posted: Tue Oct 10, 2023 10:17 pm Post subject: |
|
|
An additional note on this for whoever has the same issue:
dhcpcd will overwrite your /etc/resolv.conf file by default. So add a "noconfigure" flag to
/etc/dhcpcd.conf to stop this. My two added dhcpcd.conf entries are:
# Set this up to run on ipv6 only to stop automatic ipv4 dhcp wiping out static entries
ipv6only
# Set this to noconfigure to stop overwriting config files
noconfigure |
|
Back to top |
|
 |
|