2

So i've read all the related searched on this and haven't found a relevant answer that works for a headless remote boot, so here goes: I'm setting up a headless repeatable image for Raspberry pi. I'm using Raspbian buster 64-bit lite image.

I've set a default user with userconf which works fine. I've set the ssh to be auto enabled which works fine.

What's not working is the wlan0 config through wpa_supplicant.

On first boot, all is well and after login, I get the following error:

Wi-Fi is currently blocked by rfkill. Use raspi-config to set the country before use.

So my wpa_supplicant looks like this(and includes a country= line):

country=CA update_config=1 ctrl_interface=/var/run/wpa_supplicant

network={ scan_ssid=1 ssid="SSID1" psk=[encryptedPasswd] } network={ scan_ssid=1 ssid="SSID2" psk=[encryptedPasswd] }

Any thoughts on how to get the wlan0 interface to come up properly without running a command post-boot?

1 Answer 1

0

Here's a snippet from the end of do_wifi_country() in raspi-config, which enables the wifi:1

for filename in /var/lib/systemd/rfkill/*:wlan ; do
  if ! [ -e "$filename" ]; then
    continue
  fi
  echo 0 > "$filename"
done

I'd suspect this is where the rfkill settings are. In case it's not clear, each file ending in :wlan there is being overwritten with a 0. Here's what's in that directory for a Pi 4 I have running bullseye:

> ls -1 /var/lib/systemd/rfkill/
platform-3f300000.mmcnr:wlan  
platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.0:wlan
platform-fe300000.mmcnr:wlan  
platform-soc:bluetooth

> cat /var/lib/systemd/rfkill/*
0
0
0
0

And here's what's in it from the current (May 3/23) bulleye 64-bit lite image, never booted:

> cd /mnt/img/var/lib/systemd/rfkill
> ls -1
platform-3f300000.mmcnr:wlan
platform-fe300000.mmcnr:wlan
> cat *
1
1

Very likely if you change those to zero, rfkill will be disabled for wifi. You may also have to add the third wlan "0" entry from the running Pi example (platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.0:wlan), but try it without first.


  1. I think you've pretty much accomplished the other things there, but you might want to take a look yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.