raspberrypi / rpi-imager

The home of Raspberry Pi Imager, a user-friendly tool for creating bootable media for Raspberry Pi devices.
https://www.raspberrypi.com/software
Other
1.64k stars 249 forks source link

[BUG]: PI 4 doesn't connect to wifi #901

Open thewh1teagle opened 1 month ago

thewh1teagle commented 1 month ago

What happened?

It may be an issue with Raspbian itself. I just flashed raspbian lite 64 to RPI4, pre configured the wifi and boot. It doesn't connect to the wifi. I verified that the name & password are correct. I'm not sure how to diagnose it to know better if it's an issue with rpi imager.

I can access the shell with keyboard & hdmi.

Update: I re-flashed without configure the WIFI in rpi-imager. Then I configured manually the WIFI through sudo raspi-config and it connected successfully. Something is invalid in rpi-imager.

Version

1.8.5 (Default)

What host operating system were you using?

Windows

Host OS Version

Windows

Selected OS

Bookworm 64

Which Raspberry Pi Device are you using?

Raspberry Pi 4B, 400, and Compute Modules 4, 4S

What kind of storage device are you using?

USB SSD

OS Customisation

Relevant log output

July 4th 2024

archfrog commented 1 month ago

I'm having the same problem, with Bookworm 64, but I'm am a Debian noob. So I switched to Ubuntu Server 24.04 and it works with the exact same OS customizations as was used for Debian.

This just to tell the developers that the problem probably lies with the Raspbian OS support as Ubuntu works as it should. If I try to use raspi-config to specify the already correct wireless SSID and key, I get some obscure error (on Bookworm).

archfrog commented 1 month ago

Just stumbled across this passage while checking out some RPi kiosk software:

"RPi OS bookworm dropped wpa_supplicant.conf support for configuring WiFi and moved to Network Manager."

Guess that explains why configuration of WIFI in RPI Imager no longer works on Bookworm.

Vizzyy commented 1 month ago

I'm pretty sure this is related... but I just wasted like 5 hours troubleshooting (countless reflashes of bookworm, bullseye, separate machines, sdcards, etc) being unable to SSH into a fresh RPI OS image (via rpi-imager, setting a default user, enabling ssh).

Headless SSH works the INITIAL boot, but then any following boot I am not able to SSH until I first sign into the pi locally (via monitor and keyboard), and then I am able to headless ssh from another machine. Clearly there is something going on with Network Manager that does not initialize the connectivity unless the user is already logged in.

I was able to fix this by leveraging the nmtui CLI-GUI tool to edit my preconfigured connection setup through rpi-imager. There is a checkmark for Available to all users that needs to be enabled. For me this was already enabled by rpi-imager, and so I had to disable it and then reenable it and now I am finally able to ssh headlessly every boot.

My money is on rpi-imager doing something wonky with this preconfigured connection setup during the flashing.

XECDesign commented 1 month ago

Guess that explains why configuration of WIFI in RPI Imager no longer works on Bookworm.

Nope, it should still work.

Output of sudo journalctl from the non-working system would help figure out what's going on.

For me this was already enabled by rpi-imager, and so I had to disable it and then reenable it and now I am finally able to ssh headlessly every boot.

Has the content of /etc/NetworkManager/system-connections/preconfigured.nmconnection changed after you've made that change?

remohoeppli commented 1 month ago

I see the same issue.

Here's an output of the journalctl. image

My /etc/NetworkManager/system-connections/preconfigured.nmconnection does contain a configuration.

I tried the latest Debian Bookworm 64-Bit Lite and Full version. I hope this helps.

XECDesign commented 1 month ago

Thank you. Another potentially useful data point. Was it working in the 2023-10-10 image and then broken in the 2023-12-05 image?

GierAffe commented 1 month ago

After writing the image to a micro sd card (or usb etc), a firstrun.sh file should have been created on the boot partition. There is a line:

if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then
   /usr/lib/raspberrypi-sys-mods/imager_custom set_wlan '[my ssid]' '[my psk]' '[my country code]'

can you check if the psk is correct? In a linux shell, the command wpa_passphrase [ssid] [passphrase] will generate your psk. Do you get the same hash? If not, does it work if you replace the psk in the firstrun.hs file with the one you generated by hand?

You can also check if the file /etc/NetworkManager/system-connections/preconfigured.nmconnection has been generated (which it should).

ryepup commented 4 weeks ago

just ran into this using 2024-07-04-raspios-bookworm-arm64-lite.img.xz, rpi-imager v1.7.2, and a PI 5. I'm using Ubuntu 22.04 LTS, and have installed rpi-imager via apt install.

I did not have a /etc/NetworkManager/system-connections/preconfigured.nmconnection file, and used raspi-config to get connected.

I think my problem is that Ubuntu 22.04 LTS package repositories are delivering a really old version of rpi-imager. My firstuse.sh did not have anything about raspberrypi-sys-mods.

manjushsh commented 3 weeks ago

+1 for rpi 5

tdewey-rpi commented 2 weeks ago

just ran into this using 2024-07-04-raspios-bookworm-arm64-lite.img.xz, rpi-imager v1.7.2, and a PI 5. I'm using Ubuntu 22.04 LTS, and have installed rpi-imager via apt install.

I did not have a /etc/NetworkManager/system-connections/preconfigured.nmconnection file, and used raspi-config to get connected.

I think my problem is that Ubuntu 22.04 LTS package repositories are delivering a really old version of rpi-imager. My firstuse.sh did not have anything about raspberrypi-sys-mods.

As a general point, I strongly recommend that users do not use apt install on platforms other than Raspberry Pi OS.

v1.7.2 was released before Raspberry Pi 5, and before the Bookworm release - so it's perfectly expected that it would fail to configure for new hardware and new software.

--

Are any of these failing PSKs using non-ASCII characters?

archfrog commented 2 weeks ago

As a general point, I strongly recommend that users do not use apt install on platforms other than Raspberry Pi OS.

You mean apt install rpi-imager, not apt install in general, right?

Are any of these failing PSKs using non-ASCII characters?

Not here.