1

I am super new to coding and have been trying my hand at setting up a Magic Mirror with a Raspberry Pi 4B (purchased here). I've been doing pretty well but ran into a problem where my WiFi no longer connects after a reboot. I may not have been searching for the correct keywords, but eventually found a command from this post that I can run to successfully obtain a connection...BUT I'd really like to know why this works and what I can do to fix the problem overall.

This is the command that fixes things:

sudo wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -d

and this is what my wpa_supplicant.conf file looks like:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
      ssid="MY_NETWORK_SSID"
      psk="MY_WIFI_PASSWORD"
}

I have edited/re-set the wpa_supplicant.conf file a few different ways from the command line based on posts I viewed to no avail. I've also re-set the WiFi from the raspi-config menu but after rebooting its back to telling me "No Networks Found" from the desktop/GUI.

Please let me know if I am missing any information that could be helpful. I appreciate you taking the time to hopefully help me out :)

1
  • Please do not change the title to "solved" but mark the correct answer instead. Thanks.
    – Ghanima
    Aug 22, 2022 at 20:24

3 Answers 3

1

Well, I still don't know why it was happening but I found a way to have the pi execute the command that fixes things by adding it to my magic mirror start script. So IF for some reason anyone else has the same issue you can get around it by...

  1. Setting up the MM Start Script per HowTo: Magic Mirror – Setting up the autostart
  2. and adding the following text:

cd ~/MagicMirror

sudo wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -d

DISPLAY=:0 npm start

I tested it a few times and now my magic mirror autostarts WITH wifi as expected (yay!)

1
  • Once you can (I think its 24 hours), please accept this answer, unless a better answer comes up, please.
    – NomadMaker
    Jul 23, 2022 at 20:56
0

I have same problem, my magic is running but dont connect my WIFI. Can you help me?

My conf

MY LOGS from script: https://pastecode.io/s/w9b2wrgx

1
0

What you can do is to force the pi to connect to the network when booting.

Edit /etc/network/interfaces, comment all uncommented stuffs and write:

...
#source-directory /etc/network/interfaces.d //Comment it!
auto wlan0
iface wlan0 inet dhcp
    wpa-ssid  {SSID}
    wpa-psk   {PASSWD}

Then, edit /etc/rc.local and add the following on top of exit 0:

...
dhclient wlan0
exit 0 // This indicates the position.

This solves the issue.

So, I guess the issue is that after upgrade or something, the configuration files in /etc/network/interfaces.d disappeared, so it won't reconnect to the WiFi network.

Hope that helps.

Sincerely.

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.