# [SOLVED] wpa_supplicant connects but NetworkManager does not

## potuz

Hello, with the following I can connect to my wireless network

```
#ifconfig wlp58s0 up && wpa_supplicant -Dnl80211 -B -iwlp58s0 -c /etc/wpa_supplicant/wpa_supplicant.conf && dhcpcd wlp58s0

```

Where wpa_supplicant.conf simply consists of 

```

ctrl_interface=/var/run/wpa_supplicant

network={

   ssid="randomized"

   psk="somepsk"

}

```

However when I try to setup the network with Network manager I get

```

#systemctl start Network-Manager

#journalctl 

....

systemd[1]: Starting Network Manager...

 NetworkManager[5123]: <info>  [1491401360.8997] NetworkManager (version 1.4.4) is starting...

 NetworkManager[5123]: <info>  [1491401360.8998] Read config: /etc/NetworkManager/NetworkManager.conf

 NetworkManager[5123]: <info>  [1491401360.9022] manager[0x1f3f0c0]: monitoring kernel firmware directory '/lib/firmware'.

 NetworkManager[5123]: <info>  [1491401360.9033] dns-mgr[0x1f21950]: init: dns=default, rc-manager=symlink

 NetworkManager[5123]: <info>  [1491401360.9042] rfkill1: found WiFi radio killswitch (at /sys/devices/pci0000:00/0000:00:1c.4/0000:3a:00.0/ieee80211/phy0/rfkill1) (driver ath10k_pci)

 NetworkManager[5123]: <info>  [1491401360.9043] manager[0x1f3f0c0]: WiFi hardware radio set enabled

 NetworkManager[5123]: <info>  [1491401360.9043] manager[0x1f3f0c0]: WWAN hardware radio set enabled

 systemd[1]: Started Network Manager.

 dbus[1961]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'

 dbus[1961]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.nm-dispatcher.service': Unit dbus-org.freedesktop.nm-dispatcher.service not found.

 NetworkManager[5123]: <error> [1491401360.9075] dispatcher: could not get dispatcher proxy! Error calling StartServiceByName for org.freedesktop.nm_dispatcher: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit dbus-org.freedesktop.nm-dispatcher.service not found.

 NetworkManager[5123]: <info>  [1491401360.9076] settings: loaded plugin keyfile: (c) 2007 - 2015 Red Hat, Inc.  To report bugs please use the NetworkManager mailing list.

 NetworkManager[5123]: <info>  [1491401360.9161] keyfile: new connection /etc/NetworkManager/system-connections/radomizedagain (28c900d2-4f3b-4156-9675-613d21c3b6a4,"some-key")

 dbus[1961]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'

 systemd[1]: Starting Hostname Service...

 dbus[1961]: [system] Successfully activated service 'org.freedesktop.hostname1'

 systemd[1]: Started Hostname Service.

 NetworkManager[5123]: <info>  [1491401361.0001] settings: hostname: using hostnamed

 NetworkManager[5123]: <info>  [1491401361.0003] dhcp-init: Using DHCP client 'dhclient'

 NetworkManager[5123]: <info>  [1491401361.0004] manager: WiFi enabled by radio killswitch; enabled by state file

 NetworkManager[5123]: <info>  [1491401361.0004] manager: WWAN enabled by radio killswitch; enabled by state file

 NetworkManager[5123]: <info>  [1491401361.0005] manager: Networking is enabled by state file

 NetworkManager[5123]: <info>  [1491401361.0006] Loaded device plugin: NMVxlanFactory (internal)

 NetworkManager[5123]: <info>  [1491401361.0006] Loaded device plugin: NMVlanFactory (internal)

 NetworkManager[5123]: <info>  [1491401361.0007] Loaded device plugin: NMVethFactory (internal)

 NetworkManager[5123]: <info>  [1491401361.0007] Loaded device plugin: NMTunFactory (internal)

 NetworkManager[5123]: <info>  [1491401361.0007] Loaded device plugin: NMMacvlanFactory (internal)

 NetworkManager[5123]: <info>  [1491401361.0008] Loaded device plugin: NMIPTunnelFactory (internal)

 NetworkManager[5123]: <info>  [1491401361.0008] Loaded device plugin: NMInfinibandFactory (internal)

 NetworkManager[5123]: <info>  [1491401361.0009] Loaded device plugin: NMEthernetFactory (internal)

 NetworkManager[5123]: <info>  [1491401361.0009] Loaded device plugin: NMBridgeFactory (internal)

 NetworkManager[5123]: <info>  [1491401361.0009] Loaded device plugin: NMBondFactory (internal)

 NetworkManager[5123]: <info>  [1491401361.0019] Loaded device plugin: NMWifiFactory (/usr/lib64/NetworkManager/libnm-device-plugin-wifi.so)

 NetworkManager[5123]: <info>  [1491401361.0025] Loaded device plugin: NMAtmManager (/usr/lib64/NetworkManager/libnm-device-plugin-adsl.so)

 NetworkManager[5123]: <info>  [1491401361.0042] device (lo): link connected

 NetworkManager[5123]: <info>  [1491401361.0060] manager: (lo): new Generic device (/org/freedesktop/NetworkManager/Devices/0)

 NetworkManager[5123]: <info>  [1491401361.0103] manager: (sit0): new IPTunnel device (/org/freedesktop/NetworkManager/Devices/1)

 NetworkManager[5123]: <info>  [1491401361.0114] (wlp58s0): using nl80211 for WiFi device control

 NetworkManager[5123]: <info>  [1491401361.0119] device (wlp58s0): driver supports Access Point (AP) mode

 NetworkManager[5123]: <info>  [1491401361.0140] manager: (wlp58s0): new 802.11 WiFi device (/org/freedesktop/NetworkManager/Devices/2)

 NetworkManager[5123]: <info>  [1491401361.0160] device (wlp58s0): state change: unmanaged -> unavailable (reason 'managed') [10 20 2]

 kernel: IPv6: ADDRCONF(NETDEV_UP): wlp58s0: link is not ready

 kernel: IPv6: ADDRCONF(NETDEV_UP): wlp58s0: link is not ready

 NetworkManager[5123]: <info>  [1491401363.3315] device (wlp58s0): set-hw-addr: set MAC address to A6:6B:D9:B9:31:1C (scanning)

```

And I cannot connect. The dispatcher error is irrelevant. 

I am completely new to network-manager so I do not know where to start debugging this. I'd appreciate any help.Last edited by potuz on Thu Apr 06, 2017 3:52 am; edited 1 time in total

----------

## potuz

UPDATE: it seems that this has to do with dhclient vs dhcpcd, if I replace in the last step for dhclient for example:

```
#ifconfig wlp58s0 up && wpa_supplicant -Dnl80211 -B -iwlp58s0 -c /etc/wpa_supplicant/wpa_supplicant.conf && dhclient -4  -v wlp58s0 

Internet Systems Consortium DHCP Client 4.3.5 Gentoo-r0

Copyright 2004-2016 Internet Systems Consortium.

All rights reserved.

For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlp58s0/9c:b6:d0:dc:fb:c3

Sending on   LPF/wlp58s0/9c:b6:d0:dc:fb:c3

Sending on   Socket/fallback

DHCPDISCOVER on wlp58s0 to 255.255.255.255 port 67 interval 4

DHCPDISCOVER on wlp58s0 to 255.255.255.255 port 67 interval 8

DHCPDISCOVER on wlp58s0 to 255.255.255.255 port 67 interval 14

DHCPDISCOVER on wlp58s0 to 255.255.255.255 port 67 interval 21

DHCPDISCOVER on wlp58s0 to 255.255.255.255 port 67 interval 14

No DHCPOFFERS received.

```

I tried however with the obvious choice that would be to add USE="-dhclient"  to networkmanager and on top of that remove the line "--without-dhcpcd"  from the ebuild. But it also does not connect... I am clueless and this laptop is unusable by its destined owner who does not know what a terminal is.

----------

## potuz

One last update: things I've tried, fixing the MAC address in /etc/NetworkManager/system-connections/myconn and then passing the same address with send dhcp-client-identifier in /etc/dhcp/dhcpclient.conf. I've also tried the internal dhcp client and anyway I always get to something like this:

```

NetworkManager[22542]: <info>  [1491445803.4010] device (wlp58s0): state change: disconnected -> prepare (reason 'none') [30 40 0]

 NetworkManager[22542]: <info>  [1491445803.4013] manager: NetworkManager state is now CONNECTING

 NetworkManager[22542]: <info>  [1491445803.4668] device (wlp58s0): set-hw-addr: set-cloned MAC address to 9C:B6:D0:DC:FB:C3 (permanent)

 kernel: IPv6: ADDRCONF(NETDEV_UP): wlp58s0: link is not ready

 NetworkManager[22542]: <info>  [1491445805.7184] device (wlp58s0): supplicant interface state: ready -> disabled

 NetworkManager[22542]: <info>  [1491445805.7195] device (wlp58s0): state change: prepare -> config (reason 'none') [40 50 0]

 NetworkManager[22542]: <info>  [1491445805.7202] device (wlp58s0): Activation: (wifi) access point 'RandomConn' has security, but secrets are requi

 NetworkManager[22542]: <info>  [1491445805.7206] device (wlp58s0): state change: config -> need-auth (reason 'none') [50 60 0]

 NetworkManager[22542]: <info>  [1491445805.7303] device (wlp58s0): state change: need-auth -> prepare (reason 'none') [60 40 0]

 NetworkManager[22542]: <info>  [1491445805.7306] device (wlp58s0): state change: prepare -> config (reason 'none') [40 50 0]

 NetworkManager[22542]: <info>  [1491445805.7307] device (wlp58s0): Activation: (wifi) connection 'RandomConn' has security, and secrets exist.  No 

 NetworkManager[22542]: <info>  [1491445805.7307] Config: added 'ssid' value 'RandomConn'

 NetworkManager[22542]: <info>  [1491445805.7307] Config: added 'scan_ssid' value '1'

 NetworkManager[22542]: <info>  [1491445805.7307] Config: added 'key_mgmt' value 'WPA-PSK'

 NetworkManager[22542]: <info>  [1491445805.7307] Config: added 'auth_alg' value 'OPEN'

 NetworkManager[22542]: <info>  [1491445805.7308] Config: added 'psk' value '<omitted>'

 NetworkManager[22542]: <info>  [1491445805.7314] sup-iface[0x26268b0,wlp58s0]: config: set interface ap_scan to 1

 NetworkManager[22542]: <info>  [1491445805.7315] device (wlp58s0): supplicant interface state: disabled -> scanning

 wpa_supplicant[21122]: wlp58s0: SME: Trying to authenticate with f2:9f:c2:3e:1e:3a (SSID='RandomConn' freq=5220 MHz)

 kernel: wlp58s0: authenticate with f2:9f:c2:3e:1e:3a

 kernel: wlp58s0: send auth to f2:9f:c2:3e:1e:3a (try 1/3)

 NetworkManager[22542]: <info>  [1491445809.9004] device (wlp58s0): supplicant interface state: scanning -> authenticating

 kernel: wlp58s0: authenticated

 wpa_supplicant[21122]: wlp58s0: Trying to associate with f2:9f:c2:3e:1e:3a (SSID='RandomConn' freq=5220 MHz)

 kernel: wlp58s0: associate with f2:9f:c2:3e:1e:3a (try 1/3)

 kernel: wlp58s0: RX AssocResp from f2:9f:c2:3e:1e:3a (capab=0x411 status=0 aid=1)

 kernel: wlp58s0: associated

 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): wlp58s0: link becomes ready

 wpa_supplicant[21122]: wlp58s0: Associated with f2:9f:c2:3e:1e:3a

 wpa_supplicant[21122]: wlp58s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0

 wpa_supplicant[21122]: wlp58s0: WPA: Key negotiation completed with f2:9f:c2:3e:1e:3a [PTK=CCMP GTK=TKIP]

 wpa_supplicant[21122]: wlp58s0: CTRL-EVENT-CONNECTED - Connection to f2:9f:c2:3e:1e:3a completed [id=0 id_str=]

 NetworkManager[22542]: <info>  [1491445809.9216] device (wlp58s0): supplicant interface state: authenticating -> associating

 NetworkManager[22542]: <info>  [1491445809.9217] device (wlp58s0): supplicant interface state: associating -> completed

 NetworkManager[22542]: <info>  [1491445809.9217] device (wlp58s0): Activation: (wifi) Stage 2 of 5 (Device Configure) successful.  Connected to w

 NetworkManager[22542]: <info>  [1491445809.9232] device (wlp58s0): state change: config -> ip-config (reason 'none') [50 70 0]

 NetworkManager[22542]: <info>  [1491445809.9244] dhcp4 (wlp58s0): activation: beginning transaction (timeout in 60 seconds)

 NetworkManager[22542]: <info>  [1491445809.9369] dhcp4 (wlp58s0): dhclient started with pid 22576

 dhclient[22576]: DHCPDISCOVER on wlp58s0 to 255.255.255.255 port 67 interval 6

 dhclient[22576]: DHCPDISCOVER on wlp58s0 to 255.255.255.255 port 67 interval 8

 dhclient[22576]: DHCPDISCOVER on wlp58s0 to 255.255.255.255 port 67 interval 18

 dhclient[22576]: DHCPDISCOVER on wlp58s0 to 255.255.255.255 port 67 interval 8

 dhclient[22576]: DHCPDISCOVER on wlp58s0 to 255.255.255.255 port 67 interval 12

 dhclient[22576]: DHCPDISCOVER on wlp58s0 to 255.255.255.255 port 67 interval 9

 NetworkManager[22542]: <warn>  [1491445870.0040] dhcp4 (wlp58s0): request timed out

```

----------

## potuz

Success! I forced the driver my modifying wpa_supplicant.service to add -Dnl80211 and this solved my problem. Then I realized that I had made the mistake originally by adding a connection with nmcli of type wifi instead of 802-11-wireless. This was passing the wrong driver to the DBus service of wpa_supplicant. Marking as solved

----------

