Gentoo Archives: gentoo-user

From: walt <w41ter@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: [systemd] Is this a NetworkManager bug?
Date: Tue, 14 Oct 2014 22:48:48
Message-Id: m1k97g$34k$1@ger.gmane.org
In Reply to: Re: [gentoo-user] [systemd] Is this a NetworkManager bug? by "Canek Peláez Valdés"
1 On 10/13/2014 04:56 PM, Canek Peláez Valdés wrote:
2 > On Mon, Oct 13, 2014 at 6:39 PM, walt <w41ter@×××××.com> wrote:
3 >> I just switched my home LAN from wired to all wifi and I'm having trouble
4 >> with NetworkManager at boot time.
5 >>
6 >> I have systemd start NetworkManager at boot because I need the internet
7 >> for ntpdate and to start the nfs server for the LAN. Before I switched
8 >> to all-wireless this method worked perfectly, but no longer.
9 >>
10 >> After bootup I see that NetworkManager started wpa_supplicant in the
11 >> background, but apparently does *not* run dhcpcd. (The wlan0 is up
12 >> but it has no IP address and the routing table is empty.)
13 >
14 > Do you have a system-wide connection for the wireless network? They
15 > live in /etc/NetworkManager/system-connections. Also, what does "nmcli
16 > -p general" says? In my case is:
17 >
18 > centurion ~ # nmcli -p general
19 > =============================================================
20 > NetworkManager status
21 > =============================================================
22 > STATE CONNECTIVITY WIFI-HW WIFI WWAN-HW WWAN
23 > -------------------------------------------------------------
24 > connected full enabled enabled enabled enabled
25 >
26 >> As an alternative to NetworkManager I can have systemd start dhcpcd
27 >> at boot, which almost (but not quite) works well enough. This
28 >> causes a race condition because wlan0 takes several seconds to come
29 >> up properly and by then both ntpdate and nfs-server have already
30 >> run and failed.
31 >>
32 >> So, I asked myself, why not have systemd start dhcpcd at boot in
33 >> addition to NetworkManager?
34 >
35 > NetworkManager starts wpa_supplicant, but it does *NOT* use
36 > wpa_supplicant.conf. If you do
37 >
38 > systemctl status wpa_supplicant.service
39 >
40 > you will see that wpa_supplicant runs with the "-u" flag; that enables
41 > the DBus control interface, and it's through this that NetworkManager
42 > controls wpa_supplicant. If you do not have system-wide connections,
43 > NM will ask wpa_supplicant to *not* enable any connection. NM calls
44 > the shots in this case.
45 >
46 >> The reason that fails is that they both start wpa_supplicant in
47 >> the background and the two instances interfere with each other.
48 >>
49 >> Anyone see a way around this catch22?
50 >
51 > If I'm not mistaken, you need a system-wide NM connection enabled. You
52 > can use nm-connection-editor (included with nm-applet), or nmtui
53 > (ncurses interface since 0.9.10.0).
54 >
55 > Also, and orthogonal to almost all of this; I switched from ntp to
56 > systemd-timesyncd, and it works *great*, specially in my laptop. With
57 > my laptop, changing networks all the time, ntpd never quite worked.
58
59 Lots of great information, thanks. What I learned while following up
60 on your hints is that the NM behavior I thought was a bug is merely
61 a feature ;)
62
63 After boot, but before startx, wlan0 exists but is not properly set
64 up. After X is running I can use the nm-applet to click on the name
65 of my wireless network and *then* NM runs dhcpcd to configure wlan0
66 and set up the routing table. It works, but I need to do that manually
67 after every boot, not really optimal for my purpose.
68
69 I tried Neil's suggestion to use systemd-networkd and it works perfectly
70 for this (desktop) machine. (BTW enabling systemd-networkd also pulls
71 in systemd-timesyncd, which works great, just as you said.)
72
73 Great advice Canek and Neil, and very much appreciated.

Replies

Subject Author
Re: [gentoo-user] Re: [systemd] Is this a NetworkManager bug? "Canek Peláez Valdés" <caneko@×××××.com>