0

I'm using VNC viewer to connect to my Raspberry Pi 3 running Raspbian Stretch. I set up my wifi connection using the wifi setting on the menu bar. However, after I reboot the Pi it does not connect to wifi automatically and I have to manually connect it. Extensive google research yielded no working solutions. I have tried editing the interfaces file and wpa_supplicant.conf but nothing has worked so far.

my /etc/network/interfaces file:

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

my /etc/wpa_supplicant/wpa_supplicant.conf file:

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

network={
        ssid="mywifiname"
        psk="mywifipassword"
        key_mgmt=WPA-PSK
}
  • I can only assume that in the field psk you actually didn't write the wifi password itself but the encrypted version of it as provided by wpa_passphrase, right? – eftshift0 Apr 25 '18 at 14:45
  • er no I've written my wifi password as is. Unencrypted. – Rithika Chowta Apr 25 '18 at 15:14
  • and it actually connects to the wifi at any given time? I don't think that's going to hold water, to the best of my knowledge – eftshift0 Apr 25 '18 at 17:07
  • Apparently it's possible to use ascii text for the password so I think it's ok. Nevermind. https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md – eftshift0 Apr 25 '18 at 17:11
  • What's your system clock time? [check it with `date` in the terminal] – Hunter Akins Apr 25 '18 at 19:54
  • hmm it was Thu 26 Apr 04:31:31 UTC 2018 which is wrong for my city. i updated it. but how does that affect the wifi? – Rithika Chowta Apr 26 '18 at 04:35
  • i set the correct time and rebooted but it still doesn't auto connect to wifi – Rithika Chowta Apr 26 '18 at 04:41
  • dont mix interfaces and dhcpcd (raspbian usually messes with dhcpcd for you through the gui so avoid interfaces if possible). Much conflict and botched settings are possible. If you have a spare sd, load a fresh graphical raspbian, set up the wifi to auto connect and then look at the resulting configs (maybe post them) – Abel Jun 27 '21 at 16:13

2 Answers2

0

What you have looks correct (assuming SSID and Password are correct) and you haven't modified any other files.

How are you accessing VNC if networking is not set?

See How to set up networking/WiFi

Milliways
  • 54,718
  • 26
  • 92
  • 182
-2

Try adding a line auto wlan0 in the /etc/network/interfaces file. That should make it work.

RalfFriedl
  • 2,160
  • 2
  • 9
  • 11
  • You should at least explain why the OP should ignore the second line **Please note that this file is written to be used with dhcpcd** in `/etc/network/interfaces` and what he **must** do with `dhcpcd`. We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed or you risk to get down votes. – Ingo Feb 07 '19 at 23:26