Unable to connect to wifi in headless mode

Hi all,

I have a raspberry pi 4. It is able to auto-login when it connects to a monitor and connect to wifi automatically. However, if it is not connected to a monitor then it won’t connect to the wifi. Does anyone have any idea of what is going on?
I assumed that probably it couldn’t auto-login in the headless mode for some reason thus won’t be able to connect to wifi automatically. Since if I switched CLI mode, the pi won’t be able to auto-login, the username changed to raspberry instead of ubuntu.
Thank you for any suggestions on how to fix it.

I notice that for some reasons, the raspberry in headless mode enters AP mode directly.
How do I disable this function?
Thank you very much.

Hi @alanypf,

How did you connect the Pi to wifi? If you are using the GUI, then you should make sure that the network is available to all users.

You can also run sudo pifi add SSID PASSWORD on the command line and then reboot.

When I use the GUI, the Pi would be able to connet to my router automaticlly. No further actions needed. However, in GUI mode without a monitor. The Pi would not connet to the router. It would boot into AP mode. I need to connect to the AP hotspot and then connet to my router.
I am curious about why this happened.
Is that possible to disable the AP mode?
Thank you very much.

Hi @rohbotics , I am having what I think is the same issue. I have setup the Magni to use my local wifi, and everything works fine as long as the monitor is attached.

However, when I don’t attached the monitor cable, I can no longer ping the machine or SSH in. I have actually setup auto-login to test, and this works when the monitor is attached, but not when the connection is removed.

I have even set the “PiFi AP Mode” to not “automatically connect to this network when it is available”, but that does not help.

Can you assist? It does seem like there is some logic being triggered in headless mode…but I’m not sure what is happening…

[UPDATE] - I ended up fixing this. What I had done initially was update the wifi to add a my local access, but I did that in the GUI. Once I actually ran the sudo pifi add MyNetwork password command and rebooted, it used the new network and stopped using the built in access point.