rpi-imager icon indicating copy to clipboard operation
rpi-imager copied to clipboard

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

Open thewh1teagle opened this issue 1 year ago • 24 comments

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

  • [x] Yes, I was using OS Customisation when the bug occurred.

Relevant log output

July 4th 2024

thewh1teagle avatar Aug 04 '24 03:08 thewh1teagle

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 avatar Aug 08 '24 17:08 archfrog

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.

archfrog avatar Aug 08 '24 18:08 archfrog

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.

Vizzyy avatar Aug 10 '24 14:08 Vizzyy

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?

XECDesign avatar Aug 12 '24 07:08 XECDesign

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.

remohoeppli avatar Aug 13 '24 09:08 remohoeppli

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?

XECDesign avatar Aug 13 '24 10:08 XECDesign

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).

GierAffe avatar Aug 15 '24 04:08 GierAffe

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.

ryepup avatar Aug 17 '24 22:08 ryepup

+1 for rpi 5

manjushsh avatar Aug 22 '24 18:08 manjushsh

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?

tdewey-rpi avatar Aug 28 '24 10:08 tdewey-rpi

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.

archfrog avatar Aug 29 '24 05:08 archfrog

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.

drewtoto avatar Oct 25 '24 00:10 drewtoto

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.

efkann avatar Oct 31 '24 14:10 efkann

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

octalparrot avatar Nov 19 '24 10:11 octalparrot

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

gasparramoa avatar Nov 19 '24 17:11 gasparramoa

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

PaulCampbell avatar Nov 20 '24 08:11 PaulCampbell

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

tdewey-rpi avatar Nov 20 '24 10:11 tdewey-rpi

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

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

PaulCampbell avatar Nov 20 '24 10:11 PaulCampbell

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 !!

gasparramoa avatar Nov 20 '24 10:11 gasparramoa

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!

tdewey-rpi avatar Nov 20 '24 11:11 tdewey-rpi

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.

I just realized that using that console command utility I was trying with ssid and password for wireless band my raspberry (4B in my case) does not detect or compatible for (?).

fedebuyito avatar Jan 28 '25 17:01 fedebuyito

I just realized that using that console command utility I was trying with ssid and password for wireless band my raspberry (4B in my case) does not detect or compatible for (?).

@fedebuyito If you're reporting a problem with the console command line utility not being able to connect to your WiFi, then that sounds like an OS-level problem, rather than a problem with Raspberry Pi Imager 😉 Please open a new issue at https://github.com/raspberrypi/bookworm-feedback/issues explaining your problem in as much detail as possible.

lurch avatar Jan 29 '25 09:01 lurch

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.

After some outages, my connection started dropping again. I spent hours debugging, replacing every component in my setup, and was about to lose my mind. Guess what? I switched to an HDMI display, and everything worked. Thinking the issue was my VGA to HDMI adapter, I replaced it with a new one—but it still wouldn’t connect. That’s when I became certain the adapter was the root cause.

Out of curiosity, I wrapped the adapter in aluminum foil and secured it with tape. To my surprise, both the old and new VGA to HDMI adapters worked flawlessly as long as they were covered. I suspect these cheap adapters interfere with WiFi signals, but I’m not entirely sure. Hopefully, my experience saves someone else from hours of frustration!

efkann avatar Mar 29 '25 15:03 efkann

Closing this, as I believe the OP is resolved by a coordinated fix between rpi-imager and Raspberry Pi OS.

tdewey-rpi avatar May 01 '25 10:05 tdewey-rpi

Cannot confirm I think? I tried both Bookworm 64-bit and Bullseye 32-bit, but configuring wifi does not allow me to SSH into the rpi. When I had plugged it into LAN and manually configured wifi it did work though.

Using a Raspberry Pi 4, and just downloaded rpi-imager.

minisbett avatar Jun 08 '25 21:06 minisbett

I ran into the same issue on both a Raspberry Pi 3B+ and 4B using Raspberry Pi Imager 1.8.5 and 1.9.4 on Windows 11 with Raspberry Pi OS Bookworm (32-bit and 64-bit respectively).
Even though WiFi was correctly configured in the Imager (SSID and PSK were valid), both Pis didn’t connect on first boot.

After inspecting the generated firstrun.sh, I noticed that some parameters contained unexpected newline characters (\n) — specifically:

  • XKBLAYOUT="de\n" instead of XKBLAYOUT="de"
  • set_wlan '[SSID]' '[PSK]' 'DE\n' instead of 'DE'
  • /usr/lib/raspberrypi-sys-mods/imager_custom set_keymap 'de\n' instead of 'de'

These newlines broke both the keyboard layout config and the WiFi setup silently.


Fix:

I only removed the newline characters at the end of those values in firstrun.sh, and after that, WiFi worked immediately on first boot.

sakuv3 avatar Jun 09 '25 11:06 sakuv3

@sakuv3 could you make a new issue around your good findings?

jedahan avatar Jun 09 '25 13:06 jedahan

After inspecting the generated firstrun.sh, I noticed that some parameters contained unexpected newline characters (\n) — specifically:

  • XKBLAYOUT="de\n" instead of XKBLAYOUT="de"
  • set_wlan '[SSID]' '[PSK]' 'DE\n' instead of 'DE'
  • /usr/lib/raspberrypi-sys-mods/imager_custom set_keymap 'de\n' instead of 'de'

These newlines broke both the keyboard layout config and the WiFi setup silently.

Iiiinnnnteresting! Perhaps #1060 will fix this?

lurch avatar Jun 09 '25 13:06 lurch