Skip to content

wpa_supplicant service fails at boot, but starts fine after boot (with systemctl start wpa_supplicant) #101963

@codyps

Description

@codyps

Describe the bug
On the Raspberry Pi 4B, I've enabled wireless with the following configuration.nix fragment:

  networking.wireless.enable = true;
  networking.wireless.networks = {
    "my_network" = {
      psk = "my passphrase";
    };
  };

When the system is rebooted, wpa_supplicant tries to start, but instead we just get a print out of the wpa_supplicant usage. Starting it manually after the system boots with systemctl start wpa_supplicant causes it to start without issue

`journalctl -u wpa_supplicant` from after a reboot and a `systemctl start wpa_supplicant`
-- Reboot --
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]: Successfully initialized wpa_supplicant
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]: wpa_supplicant v2.9
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]: Copyright (c) 2003-2019, Jouni Malinen <[email protected]> and contributors
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]: This software may be distributed under the terms of the BSD license.
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]: See README for more details.
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]: This product includes software developed by the OpenSSL Project
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]: for use in the OpenSSL Toolkit (http://www.openssl.org/)
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]: usage:
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   wpa_supplicant [-BddhKLqqstuvW] [-P<pid file>] [-g<global ctrl>] \
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:         [-G<group>] \
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:         -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:         [-b<br_ifname>] [-e<entropy file>] [-f<debug file>] \
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:         [-o<override driver>] [-O<override ctrl>] \
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:         [-N -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:         [-m<P2P Device config file>] \
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:         [-p<driver_param>] [-b<br_ifname>] [-I<config file>] ...]
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]: drivers:
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   nl80211 = Linux nl80211/cfg80211
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   wext = Linux wireless extensions (generic)
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   wired = Wired Ethernet driver
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]: options:
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -b = optional bridge interface name
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -B = run daemon in the background
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -c = Configuration file
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -C = ctrl_interface parameter (only used if -c is not)
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -d = increase debugging verbosity (-dd even more)
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -D = driver name (can be multiple drivers: nl80211,wext)
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -e = entropy file
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -f = log output to debug file instead of stdout
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -g = global ctrl_interface
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -G = global ctrl_interface group
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -h = show this help text
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -i = interface name
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -I = additional configuration file
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -K = include keys (passwords, etc.) in debug output
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -L = show license (BSD)
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -m = Configuration file for the P2P Device interface
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -N = start describing new interface
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -o = override driver parameter for new interfaces
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -O = override ctrl_interface parameter for new interfaces
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -p = driver parameters
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -P = PID file
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -q = decrease debugging verbosity (-qq even less)
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -s = log output to syslog instead of stdout
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -t = include timestamp in debug messages
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -u = enable DBus control interface
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -v = show version
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   -W = wait for a control interface monitor before starting
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]: example:
Oct 25 23:53:01 skeeter wpa_supplicant-start[633]:   wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf
Oct 25 23:53:01 skeeter systemd[1]: Started WPA Supplicant.
Oct 25 23:53:01 skeeter systemd[1]: wpa_supplicant.service: Main process exited, code=exited, status=255/EXCEPTION
Oct 25 23:53:01 skeeter systemd[1]: wpa_supplicant.service: Failed with result 'exit-code'.
Oct 25 23:55:25 skeeter systemd[1]: Started WPA Supplicant.
Oct 25 23:55:25 skeeter wpa_supplicant[789]: Successfully initialized wpa_supplicant
Oct 25 23:55:27 skeeter wpa_supplicant[789]: wlan0: Trying to associate with SSID '123456'
Oct 25 23:55:30 skeeter wpa_supplicant[789]: wlan0: Associated with ec:08:6b:bb:06:82
Oct 25 23:55:30 skeeter wpa_supplicant[789]: wlan0: CTRL-EVENT-CONNECTED - Connection to ec:08:6b:bb:06:82 completed [id=0 id_str=]
Oct 25 23:55:30 skeeter wpa_supplicant[789]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0

I believe what is happening here is likely the wifi interface (wlan0) not showing up until after the wpa_supplicant-start script (which tries to enumerate the wifi interfaces) runs, resulting in a bad set of args being passed to wpa_supplicant.

To Reproduce
Steps to reproduce the behavior:

  1. Install nixos on a rpi4
  2. Add the wireless configuration noted above to /etc/nixos/configuration.nix
  3. nixos-rebuild switch
  4. reboot
  5. note that wpa_supplicant has not started.

Expected behavior
wpa_supplicant service starts after reboot without intervention

Additional context
This is a new rpi4 install using the sd-card image from hydra

Notify maintainers

Metadata

# nix-shell -p nix-info --run "nix-info -m"
these paths will be fetched (0.05 MiB download, 0.28 MiB unpacked):
  /nix/store/99dkh8kwwzbs1pc8qy4p02v1l3ai5a4m-bash-interactive-4.4-p23-dev
copying path '/nix/store/99dkh8kwwzbs1pc8qy4p02v1l3ai5a4m-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...
 - system: `"aarch64-linux"`
 - host os: `Linux 4.19.118, NixOS, 21.03pre248334.02daf3f0768 (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.7`
 - channels(root): `"nixos-21.03pre248236.bd017760509"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions