On 10/13/2014 04:56 PM, Canek Peláez Valdés wrote:
> On Mon, Oct 13, 2014 at 6:39 PM, walt <w41...@gmail.com> wrote:
>> I just switched my home LAN from wired to all wifi and I'm having trouble
>> with NetworkManager at boot time.
>>
>> I have systemd start NetworkManager at boot because I need the internet
>> for ntpdate and to start the nfs server for the LAN.  Before I switched
>> to all-wireless this method worked perfectly, but no longer.
>>
>> After bootup I see that NetworkManager started wpa_supplicant in the
>> background, but apparently does *not* run dhcpcd.  (The wlan0 is up
>> but it has no IP address and the routing table is empty.)
> 
> Do you have a system-wide connection for the wireless network? They
> live in /etc/NetworkManager/system-connections. Also, what does "nmcli
> -p general" says? In my case is:
> 
> centurion ~ # nmcli -p general
> =============================================================
>                     NetworkManager status
> =============================================================
> STATE      CONNECTIVITY  WIFI-HW  WIFI     WWAN-HW  WWAN
> -------------------------------------------------------------
> connected  full          enabled  enabled  enabled  enabled
> 
>> As an alternative to NetworkManager I can have systemd start dhcpcd
>> at boot, which almost (but not quite) works well enough.  This
>> causes a race condition because wlan0 takes several seconds to come
>> up properly and by then both ntpdate and nfs-server have already
>> run and failed.
>>
>> So, I asked myself, why not have systemd start dhcpcd at boot in
>> addition to NetworkManager?
> 
> NetworkManager starts wpa_supplicant, but it does *NOT* use
> wpa_supplicant.conf. If you do
> 
> systemctl status wpa_supplicant.service
> 
> you will see that wpa_supplicant runs with the "-u" flag; that enables
> the DBus control interface, and it's through this that NetworkManager
> controls wpa_supplicant. If you do not  have system-wide connections,
> NM will ask wpa_supplicant to *not* enable any connection. NM calls
> the shots in this case.
> 
>> The reason that fails is that they both start wpa_supplicant in
>> the background and the two instances interfere with each other.
>>
>> Anyone see a way around this catch22?
> 
> If I'm not mistaken, you need a system-wide NM connection enabled. You
> can use nm-connection-editor (included with nm-applet), or nmtui
> (ncurses interface since 0.9.10.0).
> 
> Also, and orthogonal to almost all of this; I switched from ntp to
> systemd-timesyncd, and it works *great*, specially in my laptop. With
> my laptop, changing networks all the time, ntpd never quite worked.

Lots of great information, thanks.  What I learned while following up
on your hints is that the NM behavior I thought was a bug is merely
a feature ;)

After boot, but before startx, wlan0 exists but is not properly set
up.  After X is running I can use the nm-applet to click on the name
of my wireless network and *then* NM runs dhcpcd to configure wlan0
and set up the routing table.  It works, but I need to do that manually
after every boot, not really optimal for my purpose.

I tried Neil's suggestion to use systemd-networkd and it works perfectly
for this (desktop) machine.  (BTW enabling systemd-networkd also pulls
in systemd-timesyncd, which works great, just as you said.)

Great advice Canek and Neil, and very much appreciated.


Reply via email to