Linux (Arch) WPA_SUPPLICANT service not starting @ boot

1

Setting up linux "Arch" on my Microsoft Surface Pro 6, installed OK but an issue with wpa_supplicant as service. Service is enabled but fails to start @ boot time. After login as root, "systemctl start wpa_supplicant.service" works great. Seems like a timing issue (to me) but I've not been able to help myself with WiKi or Google. Any help appreciated.

/etc/wpa_supplicant.conf

network={
    ssid="MyWiFi"
    psk=be131c51e250735aab71b89563250cba1e13e513ce53e037cd2351791dd07c52
}

/etc/systemd/system/wpa_supplicant.service

[Unit]
Description=WPA supplicant
Before=network.target
Wants=network.target

[Service]
Type=dbus
BusName=fi.w1.wpa_supplicant1
ExecStart=/usr/bin/wpa_supplicant -u -i wlp1s0 -c /etc/wpa_supplicant.conf

[Install]
WantedBy=multi-user.target
Alias=dbus-fi.w1.wpa_supplicant1.service

journalctl (after boot)

    -- Logs begin at Thu 2019-08-01 03:57:36 MST, end at Fri 2019-08-02 05:28:18 MST. --
Aug 02 05:27:41 surface systemd[1]: Starting WPA supplicant...
Aug 02 05:27:41 surface wpa_supplicant[462]: Successfully initialized wpa_supplicant
Aug 02 05:27:41 surface systemd[1]: Started WPA supplicant.
Aug 02 05:27:41 surface wpa_supplicant[462]: Could not read interface wlp1s0 flags: No such device
Aug 02 05:27:41 surface wpa_supplicant[462]: nl80211: Driver does not support authentication/association or connect commands
Aug 02 05:27:41 surface wpa_supplicant[462]: nl80211: deinit ifname=wlp1s0 disabled_11b_rates=0
Aug 02 05:27:41 surface wpa_supplicant[462]: Could not read interface wlp1s0 flags: No such device
Aug 02 05:27:41 surface wpa_supplicant[462]: wlp1s0: Failed to initialize driver interface
Aug 02 05:27:41 surface systemd[1]: wpa_supplicant.service: Main process exited, code=exited, status=255/EXCEPTION
Aug 02 05:27:41 surface systemd[1]: wpa_supplicant.service: Failed with result 'exit-code'.

journalctl (after manually starting service)

    -- Logs begin at Thu 2019-08-01 03:57:36 MST, end at Fri 2019-08-02 05:28:55 MST. --
Aug 02 05:28:51 surface systemd[1]: Starting WPA supplicant...
Aug 02 05:28:51 surface wpa_supplicant[505]: Successfully initialized wpa_supplicant
Aug 02 05:28:51 surface systemd[1]: Started WPA supplicant.
Aug 02 05:28:55 surface wpa_supplicant[505]: wlp1s0: Trying to associate with e0:3f:49:9b:4f:e8 (SSID='MyWiFi' freq=2437 MHz)
Aug 02 05:28:55 surface wpa_supplicant[505]: wlp1s0: Associated with e0:3f:49:9b:4f:e8
Aug 02 05:28:55 surface wpa_supplicant[505]: wlp1s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Aug 02 05:28:55 surface wpa_supplicant[505]: wlp1s0: WPA: Key negotiation completed with e0:3f:49:9b:4f:e8 [PTK=CCMP GTK=CCMP]
Aug 02 05:28:55 surface wpa_supplicant[505]: wlp1s0: CTRL-EVENT-CONNECTED - Connection to e0:3f:49:9b:4f:e8 completed [id=0 id_str=]

Hose

Posted 2019-08-02T20:07:39.353

Reputation: 21

Answers

1

You didn't specify when to start the service, so it starts too early; it says "wlp1s0 doesn't exist" because the interface indeed does not exist yet at that point in time.

The recommended way is to use:

[Unit]
Requires=sys-subsystem-net-devices-wlp1s0.device
After=sys-subsystem-net-devices-wlp1s0.device

This is also how the stock wpa_supplicant@.service solves the problem (and you could have simply used that unit, instead of making your own).

user1686

Posted 2019-08-02T20:07:39.353

Reputation: 283 655

Well I should have started with the interface-specific service files. Thanks so much for the quick answer, works great. – Hose – 2019-08-03T01:04:22.547

If you plan on using NetworkManager in the future, I would recommend reverting wpa_supplicant.service to its original contents, as NM expects wpa_supplicant to only get its config via D-Bus and not have any predefined networks of its own. – user1686 – 2019-08-03T11:36:44.870

I don't have any plans for that now but I'll keep that in my notes....Thanks – Hose – 2019-08-03T14:52:20.733