Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

dhcpcd enabled by default

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
24 posts • Page 1 of 1
Author
Message
Bili Oslavi
n00b
n00b
User avatar
Posts: 23
Joined: Sun Mar 12, 2023 7:09 pm

dhcpcd enabled by default

  • Quote

Post by Bili Oslavi » Sun Jul 30, 2023 8:39 pm

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?
Top
rab0171610
l33t
l33t
Posts: 721
Joined: Sat Dec 24, 2022 1:41 am

  • Quote

Post by rab0171610 » Sun Jul 30, 2023 8:57 pm

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: Select all

emerge -pv --depclean dhcpcd
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56094
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sun Jul 30, 2023 9:45 pm

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.
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Sun Jul 30, 2023 10:05 pm

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.
Top
Bili Oslavi
n00b
n00b
User avatar
Posts: 23
Joined: Sun Mar 12, 2023 7:09 pm

  • Quote

Post by Bili Oslavi » Sun Jul 30, 2023 10:57 pm

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.
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Sun Jul 30, 2023 11:15 pm

Yes, netifrc got a new dependency on dhcpcd and it broke systems that had network as a dependency
Top
rab0171610
l33t
l33t
Posts: 721
Joined: Sat Dec 24, 2022 1:41 am

  • Quote

Post by rab0171610 » Sun Jul 30, 2023 11:15 pm

I don't use RC but the ebuild has a dhcp use flag. Looking at the ebuild it has:

Code: Select all

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.
Top
rab0171610
l33t
l33t
Posts: 721
Joined: Sat Dec 24, 2022 1:41 am

  • Quote

Post by rab0171610 » Mon Jul 31, 2023 12:47 am

See section INTERFACE HANDLERS:
https://gitweb.gentoo.org/proj/netifrc. ... e.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: Select all

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.
Top
Bili Oslavi
n00b
n00b
User avatar
Posts: 23
Joined: Sun Mar 12, 2023 7:09 pm

  • Quote

Post by Bili Oslavi » Mon Jul 31, 2023 1:38 am

"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.
Top
kimchi_sg
Advocate
Advocate
Posts: 3039
Joined: Fri Nov 26, 2004 11:11 am

  • Quote

Post by kimchi_sg » Mon Jul 31, 2023 1:40 am

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: Select all

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.
Top
Logicien
Veteran
Veteran
User avatar
Posts: 1555
Joined: Fri Sep 16, 2005 8:04 am
Location: Montréal

  • Quote

Post by Logicien » Mon Jul 31, 2023 1:59 am

A workaround could to configure Dhcpcd in a way that it will start but will manage no network interface in /etc/dhcpcd.conf.
Paul
Top
Bili Oslavi
n00b
n00b
User avatar
Posts: 23
Joined: Sun Mar 12, 2023 7:09 pm

  • Quote

Post by Bili Oslavi » Mon Jul 31, 2023 2:06 am

Hi kimchi_sg,
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,
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.
Top
grknight
Retired Dev
Retired Dev
Posts: 2565
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Mon Jul 31, 2023 2:30 am

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.
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Mon Jul 31, 2023 8:16 am

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.
Top
grknight
Retired Dev
Retired Dev
Posts: 2565
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Mon Jul 31, 2023 12:25 pm

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.
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Mon Jul 31, 2023 12:59 pm

Sorry, I've been thinking bout something else. Nevermind.
Top
pjp
Administrator
Administrator
User avatar
Posts: 20668
Joined: Tue Apr 16, 2002 10:35 pm

  • Quote

Post by pjp » Mon Jul 31, 2023 6:47 pm

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?
Top
Bili Oslavi
n00b
n00b
User avatar
Posts: 23
Joined: Sun Mar 12, 2023 7:09 pm

  • Quote

Post by Bili Oslavi » Sat Oct 07, 2023 12:49 am

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.
Top
dmpogo
Advocate
Advocate
Posts: 3716
Joined: Thu Sep 02, 2004 9:21 pm
Location: Canada

  • Quote

Post by dmpogo » Sat Oct 07, 2023 12:56 am

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 ?
Top
grknight
Retired Dev
Retired Dev
Posts: 2565
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Sat Oct 07, 2023 12:59 am

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.
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Sat Oct 07, 2023 12:07 pm

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: Select all

/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.
Top
grknight
Retired Dev
Retired Dev
Posts: 2565
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Sat Oct 07, 2023 2:25 pm

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.
Top
dmpogo
Advocate
Advocate
Posts: 3716
Joined: Thu Sep 02, 2004 9:21 pm
Location: Canada

  • Quote

Post by dmpogo » Sat Oct 07, 2023 4:45 pm

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.
Top
Bili Oslavi
n00b
n00b
User avatar
Posts: 23
Joined: Sun Mar 12, 2023 7:09 pm

  • Quote

Post by Bili Oslavi » Tue Oct 10, 2023 10:17 pm

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
Top
Post Reply

24 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic