Raspberry Pi WiFi – How to Connect WiFi Network from Raspberry Pi 2 (Snappy)

raspberrypiubuntu-core

I've set up new raspberry pi 2 with snappy core.
And I couldn't find how to connect wifi network from snappy terminal.

My wifi dongle working correctly but there is no iwconfig in snappy core.
Wlist not found too. Anyone can help me?

Thanks in advance.

Best Answer

So I just received my Raspberry Pi 3 Model B in the mail and installed Ubuntu Snappy Core 16 in the recommended way. I performed the initial setup via HDMI and usb keyboard, ethernet, & DHCP. Then I created my ssh connection over ethernet and disconnected the monitor and keyboard. From there, I wanted to connect my device to WiFi and stumbled upon this post.

I like to try things without extra installations or workarounds, so I consulted Installation Tips as recommended above and saw that WPA_Supplicant was supposed to be pre-installed. With very little meddling and less effort than the Tips suggested, I found that you can configure the wifi by simply adding a config file consisting of four lines to the default location searched by wpa_supplicant and nothing else. Though it was asked a while ago about a Raspberry Pi 2 I see from recent comments that it might still be relevant and it was so simple I am inclined to share.

I know this answer looks long, but it is very simple and detailed with pictures. Anyone who has a basic knowledge of Terminal and was able to set up their raspberry Pi initially will be able to follow it.

Tl;Dr

  • Setup your Rasberry Pi and establish a LAN connection via SSH
  • Shutdown your Raspberry Pi with sudo shutdown -P now
  • Plug your SD card into a linux distro
  • In a text editor add a config file called "wpa_supplicant.conf" to the /writable/system-data/etc/ folder on the Writable partition of the SD card
  • I did this by creating the conf file on my desktop and then using sudo cp to move it to the correct directory
  • The config file should be:
    network={
    ssid="Typhon Secure" Use your network SSID
    psk="*******" Use your network Passkey
    }
  • Note: This works for Hidden Networks as well
  • Eject your SD, plug it into your Pi, boot your Pi; it should connect to your WiFi

My tutorial begins from the point of having an ssh connection via ethernet, which can be achieved by following the instructions at Ubuntu Core Get Started Raspberry Pi 2/3.

Connected via SSH

Then type wpa_supplicant and you will see that it does not need to be installed as it is pre-built into Snappy Core. As you'll see in the below images, just running wpa_supplicant will return a lot of options, but notice the last line:

wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf

What this tells you is first the Driver, then the Interface, then the location that it is looking for the interface file: -c/etc/wpa_supplicant.conf

WPA_Supplicant WPA_Supplicant Continued

Now that I knew where the configuration file needed to be, I shutdown the Raspberry Pi with sudo shutdown -P now and once it shutdown; disconnected the power and inserted the SD into a linux box with Fedora. Somehow the file system shows differently so you'll find the location where wpa_supplicant.conf needs to be location is at writable/system-data/etc and the SD card mounted in /run/media/cregger/ for me, so you'll see my file path is /run/media/cregger/writable/system-data/etc/.

Nano Location

I used nano to create a new file called "wpa_supplicant.conf" with the following four lines:

network={ ssid="Typhon Secure" (My network SSID) psk="*******" (Obviously the asterisks represent my WiFi passkey) } Don't forget to terminate.

Note that this works for hidden networks with no extra configuration. My network has a hidden SSID and I changed nothing. It has WPA-PSK 2 security; pretty standard fare. Config Example

You'll notice that I saved it to the desktop. I then copied it to the proper location with terminal as it is owned by root.

Copy to SD card

Then eject your SD card from Linux, plug it back into your Raspberry Pi, plug your power source back into your Raspberry Pi; let it boot and it will seek your wifi.

You'll see in my case both Eth and Wlan have taken an IP Eth0 & Wlan0

I can now ssh via either LAN or WLAN

Double connection

I know this was long, but I hope it was helpful in helping you to keep from mucking up your FS and installing a bunch of needless applications.