Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 540326

Summary: dhcpcd is not started automatically
Product: Gentoo Hosted Projects Reporter: Philip Webb <purslow>
Component: OpenRCAssignee: OpenRC Team <openrc>
Status: RESOLVED TEST-REQUEST    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: 'emerge --info' for Desktop machine
'emerge --info' for Netbook
Addition config + other info for the Desktop machine
Addition config + other info for the Netbook

Description Philip Webb 2015-02-17 02:36:25 UTC
On my Desktop machine, Openrc fails to start Dhcpcd even with +newnet or +netifrc, but on my Netbook, it starts Dhcpcd without either being set or Dhcpcd being added to the default runlevel.


Reproducible: Always

Steps to Reproduce:
1. Boot into Desktop machine using Openrc with +newnet or +netifrc.
2. Boot into Netbook using Openrc without either flag set or Dhcpcd in default runlevel.
3.
Actual Results:  
Check availability of I/net : Netbook has started Dhcpcd, Desktop hasn't.

Expected Results:  
Either both machines have Dhcpcd started or neither does.

I have checked config files carefully, looked for help via the Forum, Users' list, Gentoo docs & Google : there seems to be no difference in settings between the 2 machines, no similar cases reported & limited documentation.
I can have automatic I/net access on the Desktop machine by adding 'dhcpcd' to the default runlevel, but my understanding of the 'newnet' & 'netifrc' flags is that they should cause an automatic start of Openrc's built-in DHCP without needing to do that.  Something is causing Openrc to start the connection in the Netbook even without those flags or change in the default runlevel.
The documentation of network access seems to be lagging behind actual features:
the new flags are scarcely mentioned & the earlier change (c 2012) to drop 'noipv4ll' as default, allowing auto-reconnect after a physical disconnect, was also not reported in news or elsewhere.
Comment 1 Philip Webb 2015-02-17 02:37:29 UTC
Created attachment 396648 [details]
'emerge --info' for Desktop machine
Comment 2 Philip Webb 2015-02-17 02:37:56 UTC
Created attachment 396650 [details]
'emerge --info' for Netbook
Comment 3 Philip Webb 2015-02-17 02:38:37 UTC
Created attachment 396652 [details]
Addition config + other info for the Desktop machine
Comment 4 Philip Webb 2015-02-17 02:39:10 UTC
Created attachment 396654 [details]
Addition config + other info for the Netbook
Comment 5 Philip Webb 2015-02-17 02:41:15 UTC
The versions of Openrc & Dhcpcd are not quite the same on the 2 machines, but this should not affect the behaviour described.  The 'newnet' 'netifrc' flags were tested on the Desktop machine, tho' the attachment shows them not set.
Comment 6 Philip Webb 2015-02-17 23:46:32 UTC
The change in the bug title mb misleading.  As I said in the original report, there are  2  different behaviours which are unexplained : (1) Openrc does not start its built-in DHCP on my Desktop machine when the 'newnet' or 'netifrc' flags are set (that much is correctly described by the new title) ; (2) Openrc does start DHCP without either of those flags & without it being included in the dft runlevel on a different machine (my Asus EEE Netbook).  I can see no obvious difference in config files etc which explains this difference in behaviour.  Both of (1) & (2) are equal parts of this bug report.

I also see that in the attached files I didn't edit out my own names for the  2  machines : 'ANB4' is the Desktop, 'Horace' is the Netbook.
Comment 7 William Hubbs gentoo-dev 2015-02-20 01:20:05 UTC
(In reply to Philip Webb from comment #0)
> On my Desktop machine, Openrc fails to start Dhcpcd even with +newnet or
> +netifrc, but on my Netbook, it starts Dhcpcd without either being set or
> Dhcpcd being added to the default runlevel.

You are correct. Neither machine should automatically start dhcpcd if it is not in a runlevel.

I would guess that, on your netbook, you have a service that has "need net" in its dependencies and that is causing dhcpcd to start automatically.

To verify this, add the following line to /etc/conf.d/dhcpcd:

rc_provide="!net"

Once you do that, restart and see which services fail because they need net.

File bugs against these services, blocking bug #439092, asking that they remove "need net" from their init scripts.
Comment 8 Philip Webb 2015-02-20 07:42:45 UTC
There is no file  /etc/conf.d/dhcpcd  on either machine.  There is a file /etc/dhcpcd.conf  on both machines, but when I tried adding 'rc_provide="!net"' to the one in the Netbook & rebooted,  /var/log/rc.log  reported : "dhcpcd[802]: unknown option: rc_provide="!net".

I ran 'grep net *' in  /etc/init.d  in both machines, but a gvimdiff of the results shows no line in the Netbook scripts which is not in the Desktop,
so the puzzle remains.

You didn't comment on the other half of the puzzle, ie whether the flag 'newnet' should cause Openrc to start its own built-in version of DHCPCD.  Comments on the users' mailing-list & elsewhere suggested that it should.  Am I wrong ?

Thanks for your prompt response.
Comment 9 William Hubbs gentoo-dev 2015-02-20 22:05:28 UTC
(In reply to Philip Webb from comment #8)
> There is no file  /etc/conf.d/dhcpcd  on either machine.  There is a file
> /etc/dhcpcd.conf  on both machines, but when I tried adding
> 'rc_provide="!net"' to the one in the Netbook & rebooted,  /var/log/rc.log 
> reported : "dhcpcd[802]: unknown option: rc_provide="!net".

You are correct; /etc/conf.d/dhcpcd doesn't exist by default. However, if you create it, it will be picked up by /etc/init.d/dhcpcd automatically.

rc_provide is not a valid option for dhcpcd itself, that is why you got the error. It is, however, valid for the dhcpcd service script. What you are doing is tweaking the dependencies. Look at the "service configuration variables" section of /etc/rc.conf for more info about this. OpenRC allows these kinds of adjustments for any service script on your system.

> I ran 'grep net *' in  /etc/init.d  in both machines, but a gvimdiff of the
> results shows no line in the Netbook scripts which is not in the Desktop,
> so the puzzle remains.

You would actually want to look for  service scripts that have net on a need line in their dependencies, so a better search would be:

grep 'need.*net' /etc/init.d/*

> You didn't comment on the other half of the puzzle, ie whether the flag
> 'newnet' should cause Openrc to start its own built-in version of DHCPCD. 
> Comments on the users' mailing-list & elsewhere suggested that it should. 
> Am I wrong ?

OpenRC does not have, and never has had,  a built in dhcp client, so I'm not sure where that idea came from.

newnet will cause openrc to install /etc/init.d/{network,staticroute} and /etc/conf.d/{network,staticroute}, which are used to configure static network interfaces.

Newnet, along with dhcpcd in master mode (adding the dhcpcd service to the default runlevel) was the proposed replacement for netifrc, which some users do not like because they feel it is less flexable.

I partially agree with Roy's comments in README.newnet, but not completely. I don't want to get into that discussion on this bug because that is a separate issue. ;-)

> Thanks for your prompt response.

No problem. :-)
Comment 10 Philip Webb 2015-02-21 04:30:46 UTC
I created /etc/init.d/dhcpcd with the line suggested & rebooted : rc.log shows an error "netmount needs service net" &  dhcpcd  wasn't started.  netmount  is listed in the default runlevel on both machines, so the difference in behaviour between the machines is still unexplained.

'grep 'need.*net' /etc/init.d/*' lists  gkrellmd sshd , neither of which is in the default runlevel.

 netmount  belongs to  openrc , of which Netbook has 0.3.8 , Desktop 0.3.9 ; 'gvimdiff' of the  2  versions of  netmount  shows only that 0.3.9 added an item to the "depend ... use" section, ie 'nfsclient'.

To test 0.3.9 on Netbook, I would have to 'eix-sync' to get the ebuild
(IIRC it won't pass security if I simply copy the ebuild from Desktop).
In that case, I would feel the need to do 'emerge -Dup world' & update all the pkgs listed thereby, which is a bit of work (I can do it if necessary).

I will try any further tests you suggest, incl 'eix-sync'.

Thanks for the explanation of 'newnet' etc : docs in this area need improvement.
Comment 11 William Hubbs gentoo-dev 2015-10-09 20:20:07 UTC
Hi Phillip,

I need you to test this again with OpenRC-0.18 and let me know what the
behaviour is now since "need net" has been removed from netmount.

Again, dhcpcd should not start automatically; it would have to be added
to a runlevel. Also, if you want the "built-in" dhcp client, use
netifrc, and add net.interface to the default runlevel instead.

Thanks, and let me know if you have any questions.

William
Comment 12 Philip Webb 2015-10-09 21:29:36 UTC
(In reply to William Hubbs from comment #11)
> I need you to test this again with OpenRC-0.18 and let me know
> what the behaviour is now since "need net" has been removed from netmount.
> 
> Again, dhcpcd should not start automatically; it would have to be added
> to a runlevel. Also, if you want the "built-in" dhcp client,
> use netifrc, and add net.interface to the default runlevel instead.

I had forgotten all about this (smile).

I will leave the e-mail of this bug in my 'gentoo' mail folder,
but at the moment I'm in the midst of moving to a newly built machine,
so getting Horace (netbook) out to test the change will be delayed a bit.