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.72k stars 263 forks source link

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

Open thewh1teagle opened 3 months ago

thewh1teagle commented 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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 months ago

+1 for rpi 5

tdewey-rpi commented 3 months 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 months 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.

drewtoto commented 1 month ago

Host OS Version MacOS

Selected OS Bookworm 64, Bookworm 32, Bookworm Lite

Which Raspberry Pi Device are you using? Raspberry Pi 4B

What kind of storage device are you using? Micro SD

OS Customisation Yes, enabled wifi and ssh.

Comments Also tried editing the psk value in firstrun.sh and replacing the hashed password with plain text.

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

Just ascii chars.

efkann commented 3 weeks ago

I have a Raspberry Pi 3 Model B.

I installed Raspberry Pi OS, Bookworm64 with rpi-imager on my macOS using a Micro SD, setting up WiFi and everything.

Note: After the installation, I changed my locale from tr to en-US. I dont know if this is related to this issue though.

Everything was working perfect. After a power outage, the WiFi didn't want to reconnect, prompting me to enter my password again and again even though I was sure the password was correct.

After hours of troubleshotting I decided to remove the underscore in my SSID. I also removed the * and # characters in the password.

I reconnected to my new WiFi using nmtui and it worked, hope this helps.

octalparrot commented 1 week ago

Rpi 3A+

Installed bookworm lite 32bit, windows rpi-imager, setting wifi, rsa keys.

Plugged SDcard to RPi, no wifi connection, plugged hdmi monitor and keyboard, shows ip addr 127.0.0.1

Managed to enter cmd "nmcli radio wifi on" - working fine even afer reboot

gasparramoa commented 6 days ago

I also have this problem. Rpi 4B.

I lost around ~4 hours flashing and trying different setups, from setting wpa_supplicant.conf to setting the NetworkManager .nmconnection.

Bullseyes LITE 32-bit can set the wifi and ssh connection with the Imager. Bookworm LITE 32-bit or 64-bit never connects to wifi. I am using Imager 1.8.5, which I downloaded for Windows. https://www.raspberrypi.com/software/

Is this problem already fixed for newer build versions?

Thanks

PaulCampbell commented 6 days ago

I am seeing the same here Pi OS Lite (32 bit) Bookworm released 2024-11-13 on Pi Zero 2Ws

tdewey-rpi commented 6 days ago

Could you please try against the Bookworm release from 19th November?

PaulCampbell commented 6 days ago

@tdewey-rpi The latest release is working for me. Thanks!

Pi OS Lite (32 bit) Bookworm 2024-11-19

gasparramoa commented 6 days ago

Same here! The 19th November release is also working for me!

I am using Imager 1.8.5 and Raspberry Pi 4B. One note: I had to power cycle the device by unplugging and reconnecting the power cable. On the second boot, it connected to the Wi-Fi successfully!

Thank you @tdewey-rpi !!

tdewey-rpi commented 6 days ago

While I'd love to accept the credit, true credit must go to @XECDesign, who has championed this (and additionally, drawn my attention more acutely). We'll be introducing steps to avoid this sort of issue going forward - with the hope you won't even notice that being introduced!