Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 331547 - net-misc/networkmanager-0.8.1-r3 dhcp fails
Summary: net-misc/networkmanager-0.8.1-r3 dhcp fails
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Robert Piasek (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-07 16:56 UTC by Derek Dolney
Modified: 2010-08-24 01:51 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/var/log/messages of dhcp attempt (networkmanager-0.8.1-r1.log,13.88 KB, text/plain)
2010-08-07 17:00 UTC, Derek Dolney
Details
using net-misc/dhcp-4.1.0 (networkmanager-dhcp.log,6.05 KB, text/plain)
2010-08-18 02:50 UTC, Derek Dolney
Details
using net-misc/dhcpcd-5.2.7 (networkmanager-dhcpcd.log,6.02 KB, text/plain)
2010-08-18 02:50 UTC, Derek Dolney
Details
Detailed log of NM connection attempts in 3 different scenarios. (NetworkManager.log,13.83 KB, text/plain)
2010-08-19 05:17 UTC, denysonique
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Derek Dolney 2010-08-07 16:56:57 UTC
I built networkmanager with -dhclient, so that it uses dhcpcd-5.2.7 for dhcp. Networkmanager-0.8.1-r1 fails to get an IP address, but networkmanager-0.8-r1 does get one.
Comment 1 Derek Dolney 2010-08-07 17:00:31 UTC
Created attachment 241793 [details]
/var/log/messages of dhcp attempt
Comment 2 Robert Piasek (RETIRED) gentoo-dev 2010-08-17 14:31:42 UTC
version networkmanager-0.8.1-r2 should fix all the issues.

Closing this bug now. If you still see this problem, please re-open.
Comment 3 Derek Dolney 2010-08-18 02:49:43 UTC
Still fails, using either net-misc/dhcpcd-5.2.7 and net-misc/dhcp-4.1.0 .
Comment 4 Derek Dolney 2010-08-18 02:50:33 UTC
Created attachment 243407 [details]
using net-misc/dhcp-4.1.0
Comment 5 Derek Dolney 2010-08-18 02:50:54 UTC
Created attachment 243409 [details]
using net-misc/dhcpcd-5.2.7
Comment 6 Robert Piasek (RETIRED) gentoo-dev 2010-08-18 10:58:23 UTC
Logs suggests you've got dhcpcd client running and NM configured to use dhclient.

What packages do you have installed and what use flag enabled for NM?

Thanks,
Rob
Comment 7 Alex Buell 2010-08-18 18:50:56 UTC
I am having the exact same problem, NM tries to use dhclient instead of dhcp. Please fix quickly as I am dependent on wireless networks and cannot use dhclient. 

I have dhpcd USE flag enabled and dhcp USE flag is explicitly disabled yet NM still uses dhclient. 

The previous version (0.8.1-r1) worked perfectly with dhpcd, so what's changed between 0.8.1-r1 and 0.8.1-r3? 
Comment 8 denysonique 2010-08-18 19:59:35 UTC
I used to have a similar problem  after dhcpcd from 5.2.6 to 5.2.7 upgrade. Have you tried killall dhcpcd before attempting to connect using NM?
Comment 9 Alex Buell 2010-08-18 20:12:53 UTC
No, this is definitely not dhcpcd. NetworkManager tries to use dhclient despite being explicitly told not to compile in support for dhclient (dhcp) through its  USE flags. I think the ebuild may have left out a patch essential for forcing build with dhcpcd. 
Comment 10 Mike Auty (RETIRED) gentoo-dev 2010-08-18 20:31:34 UTC
This is the automatic selection built into the dhclient code kicking back in again.  Between the two versions[1], the networkmanager-0.8.1-dhcp-configure.patch lost the shortening of the search list:

 --- a/src/dhcp-manager/nm-dhcp-dhclient.c 	 
 +++ b/src/dhcp-manager/nm-dhcp-dhclient.c 	 
 @@ -63,10 +63,6 @@ const char * 	 
  nm_dhcp_dhclient_get_path (const char *try_first) 	 
  { 	 
         static const char *dhclient_paths[] = { 	 
 -               "/sbin/dhclient", 	 
 -               "/usr/sbin/dhclient", 	 
 -               "/usr/pkg/sbin/dhclient", 	 
 -               "/usr/local/sbin/dhclient", 	 
                 NULL 	 
         }; 	 
         const char **path = dhclient_paths;

That needs to go back in to ensure that dhclient doesn't automatically look for, find and use a binary just because it's there.

[1] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.8.1-dhcp-configure.patch?hideattic=0&r1=1.1&r2=1.2
Comment 11 Alex Buell 2010-08-18 21:04:44 UTC
Excellent, can someone please roll a -r4 ebuild and put it out asap then?
Comment 12 Mu Qiao (RETIRED) gentoo-dev 2010-08-19 04:53:22 UTC
For NetworkManager-0.8.1 and above, both dhcpcd and dhclient could be configured in nm-system-settings.conf. I find the code in main.c:
*dhcp_client = g_key_file_get_value (config, "main", "dhcp", NULL);
This variable will be used by get_client_type() in nm-dhcp-manager.c.

So I think if you add one line to the '[main]' section of your nm-system-settings.conf like:
[main]
plugins=ifnet,keyfile
dhcp=dhcpcd
NM would prefer dhcpcd rather than dhclient. 

This won't require the modification to NM source code and it's a one-time solution. Could anyone test this solution? It works fine on my machine.

--- networkmanager-0.8.1-r3.ebuild	2010-08-17 22:39:36.000000000 +0800
+++ networkmanager-0.8.1-r3.ebuild.mod	2010-08-19 12:44:44.000000000 +0800
@@ -62,9 +62,6 @@
 	# Fix up the dbus conf file to use plugdev group
 	epatch "${FILESDIR}/${P}-confchanges.patch"
 
-	# Fix problems with dhcpcd/dhclient (bug #330319)
-	epatch "${FILESDIR}/${P}-dhcp-configure.patch"
-
 	# Backport some important patches
 	epatch "${FILESDIR}/${P}-CVE-2010-1172.patch"
 	epatch "${FILESDIR}/${P}-glib-2.25.12-workaround.patch"
@@ -93,6 +90,7 @@
 		fi
 	else
 		ECONF="${ECONF} --with-dhcpcd"
+		sed -i '/\[main\]/a dhcp=dhcpcd' ${FILESDIR}/nm-system-settings.conf
 	fi
 
 	# default is NSS (if none or both are specified), GnuTLS otherwise

Comment 13 denysonique 2010-08-19 05:17:45 UTC
Created attachment 243531 [details]
Detailed log of NM connection attempts in 3 different scenarios.

NetworkManager-0.8.1-r3 probably attempts to use 
/usr/sbin/dhcpcd net-misc/dhcp (ISC)probably 
thinking that it is net-misc/dhcpcd (Roy Marples)
instead of /sbin/dhcpcd.

After I have removed net-misc/dhcp-3.1.2_p1(ISC)
it tries to get the IP using the appropriate
this time /sbin/dhcpcd but it fails as 
/sbin/dhcpcd is already running(started at boot time
by /etc/init.d/dhcpcd).
After killing the dhcpcd process NetworkManager successfully
connects using /etc/sbin/dhcpcd.

I have attached a detailed log. And I am opening a new bug 
report for this dhcpcd already running issue.
Comment 14 Mu Qiao (RETIRED) gentoo-dev 2010-08-19 05:30:07 UTC
(In reply to comment #13)
> Created an attachment (id=243531) [details]
> Detailed log of NM connection attempts in 3 different scenarios.
> 
> NetworkManager-0.8.1-r3 probably attempts to use 
> /usr/sbin/dhcpcd net-misc/dhcp (ISC)probably 
> thinking that it is net-misc/dhcpcd (Roy Marples)
> instead of /sbin/dhcpcd.
> 
> After I have removed net-misc/dhcp-3.1.2_p1(ISC)
> it tries to get the IP using the appropriate
> this time /sbin/dhcpcd but it fails as 
> /sbin/dhcpcd is already running(started at boot time
> by /etc/init.d/dhcpcd).
> After killing the dhcpcd process NetworkManager successfully
> connects using /etc/sbin/dhcpcd.
> 
> I have attached a detailed log. And I am opening a new bug 
> report for this dhcpcd already running issue.
> 

When NM decide to use dhcpcd or dhclient, it does the following thing:
1. If you defined dhcp=*** in nm-system-settings.conf, *** will be used and done (*** could be dhcpcd or dhclient).
2. If you don't defined dhcp=***(by default now), NM will try to check if you have installed dhclient, if you have, then use it and done.
3. If you don't have dhclient installed, it will try to find dhcpcd, if you have dhcpcd installed, then use it and done.
4. If you don't define dhcp=*** and don't have dhcpcd or dhclient installed, then an error will occur.

So I think the simplest solution is define dhcp=*** in nm-system-settings.conf if you have both dhclient and dhcp installed.

On the other hand, if you are using NM, why do you still run /etc/init.d/dhcpcd?
Comment 15 denysonique 2010-08-19 05:56:56 UTC
well apache depends on /etc/init.d/dhcpcd to be running before it starts. I think this is a bug too. Possibly related to bug #252137. well networking is a bit buggy in Gentoo and we need to improve that part of our favourite distro!

This is the bug ID of the newly reported dhcpcd problem #333381

Comment 16 denysonique 2010-08-19 05:57:56 UTC
bug #333381 - so it turns into a link (;

Comment 17 Alex Buell 2010-08-19 08:24:01 UTC
IMHO that patch to put it in the nm-system-settings.conf does solve a problem when someone's got both variants installed, but I still think that the USE flags should decide which of the dhcpcd variants to use. 

Let's have both. The nm-system-settings solution for someone who's got both installed and the patch for people who only want to use ONE of the dhcpcd variants.

OK? 
Comment 18 Mike Auty (RETIRED) gentoo-dev 2010-08-19 08:29:06 UTC
Mu Qiao, thanks for the information about the nm-system-settings flag.  However, the patch changes are still required to ensure that if networkmanager is compiled without dhclient support that it does not then try to support it anyway.  The configure script checks the version of dhclient, and will reject invalid versions, but the runtime checking does not do this, and therefore will accept any dhclient binary, even if it is not supported.

This also affects those who try to enable dhclient, but have an unsupported version, since configure will say that dhclient support is not available, but then the runtime check will find the binary and things will still go wrong.  Basically the runtime check should adhere to any explicit decision made by the configure script, and it should also check the version of dhclient (as the configure script does).

Denysonique, apache2's init script only needs net, not dhcpcd.  Also dhcpcd isn't necessary to get a DHCP address using either Gentoo's networking scripts or NetworkManger.  If you want to use Gentoo's networking scripts, please read /usr/share/doc/openrc-{VERSION}/net.example.  To use networkmanager, you'll need to set up a system connection that starts automatically.  Since we're talking about a dynamic address, apache's configuration can't be bound to a particular ip, therefore it doesn't matter which order the two services start.  Apache will require the net service to be started, so at least net.lo needs to be running, but apache should start that automatically if necessary.  Either way, please ensure that dhcpcd isn't in any of your runlevels.
Comment 19 Rick Harris 2010-08-19 19:16:42 UTC
Please see bug #332157, if the the new configure options are used then the 'dhcpd' and 'dhclient' USE flags are respected.

--with-dhclient=[yes|no] --with-dhcpcd=[yes|no]

Thanks :)
Comment 20 Robert Piasek (RETIRED) gentoo-dev 2010-08-23 11:39:48 UTC
Can you please let me know if version 0.8.1-r4 from portage tree fixes it for you?

Comment 21 Mike Auty (RETIRED) gentoo-dev 2010-08-23 13:37:10 UTC
Nope, this is still falling back to using dhclient with USE="-dhclient".  Did something change between the two revisions other than the ifnet plugin?  I can't see any changes in the ifnet plugin patch that would fix the dhcp autodetect code that was patched as part of 330319 in -r1 and then removed again in -r2/-r3.

If the part of the patch that was removed (mentioned in comment 10) isn't acceptable, then let me know why it was removed, and I may be able to code up another fix that won't have whatever the problem might be...
Comment 22 Robert Piasek (RETIRED) gentoo-dev 2010-08-23 14:14:14 UTC
Hi Mike,

I've used the patch from upstream, but it seems if not explicitly disabled, dhclient wants to built.

As discussed on IRC, I'll patch ebuild to explicitly disable dhclient when -dhclient USE flag defined.

Comment 23 Robert Piasek (RETIRED) gentoo-dev 2010-08-23 15:48:37 UTC
I've pushed another revision to portage tree. Networkmanager-0.8.1-r6 should hopefully fix all dhcpcd/dhclient{3,4} problems we had. Please test and let me know.

If you can still see the problems, please re-open this bug.
Comment 24 Alex Buell 2010-08-23 21:32:41 UTC
Thumbs up for this latest ebuild, it doesn't try to use dhclient any more. Many thanks for your hard work in resolving this issue, it's much appreciated!
Comment 25 Rick Harris 2010-08-24 01:51:59 UTC
Works like a charm in -r6, big thanks :)