9

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.

3

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.

2

From http://www.marinus.nu/2015/02/enabling-wifi-on-snappy-ubuntu-core.html

You can install dpkg of the necessary wifi tools

Install first from another computer a few tools

wget http://ports.ubuntu.com/pool/main/w/wpasupplicant/wpasupplicant_0.7.3-6ubuntu2.3_armhf.deb \
http://ports.ubuntu.com/pool/main/libn/libnl3/libnl-3-200_3.2.24-2_armhf.deb \ 
http://ports.ubuntu.com/pool/main/libn/libnl3/libnl-genl-3-200_3.2.24-2_armhf.deb \ 
http://ports.ubuntu.com/pool/main/p/pcsc-lite/libpcsclite1_1.8.11-3ubuntu1_armhf.deb \ 

I put it on a flash drive and then moved it over

#Mount External Hard Drive
mount -t vfat /dev/sda1 /media/external -o uid=1000,gid=1000,utf8,dmask=027,fmask=137

then I navigated to /media/external and ran the command

sudo mount -o remount,rw /
sudo dpkg -i *.deb

then added this file to /etc/network/interfaces.d/wlan0

allow-hotplug wlan0
iface wlan0 inet dhcp
  wpa_ssid "<YOUR_WIFI_NAME>"
  wpa_psk "<YOUR_PASSWORD>"

then i rebooted for the effects to take place

sudo reboot

Bonus: for snappy to work remember to set date

sudo date --set 03 Mar 2015 20:55:00
  • 2
    There is also official tips on setting up WIFI at developer.ubuntu.com/en/snappy/start/installation-tips – Anthony Wong Feb 13 '16 at 4:22
  • $ wget http://ports.ubuntu.com/pool/main/w/wpasupplicant/wpasupplicant_0.7.3-6ubuntu2.3_armhf.deb --2016-03-23 18:42:25-- http://ports.ubuntu.com/pool/main/w/wpasupplicant/wpasupplicant_0.7.3-6ubuntu2.3_armhf.deb Resolving ports.ubuntu.com... 91.189.88.151, 2001:67c:1360:8001:1::2 Connecting to ports.ubuntu.com|91.189.88.151|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2016-03-23 18:42:25 ERROR 404: Not Found. – Jacksonkr Mar 23 '16 at 22:43
  • @AnthonyWong I think that guide is worse than this answer; for example, that guide doesn't include the allow-hotplug wlan0 bit which would make it work in my case (without it, it wouldn't work) – knocte Aug 27 '16 at 18:25
  • wget is not present on Ubuntu Core 16.04 how do we can install that? – Riccardo Magrini Jan 24 '17 at 13:12
-2

As for me, I had the raspberry connected to ethernet so I didn't need to download deb files individually.

Also, the official guide (claimed by @AnthonyWong to be here: http://developer.ubuntu.com/en/snappy/start/installation-tips ) didn't work for me because it had some fundamental things missing (allow-hotplug line). Plus it's better to centralize all config in just one file (not two, as this guide encourages, which even tells you to place one in some random /home/ubuntu location...).

So, I made this little script that should set everything up for you:

#!/usr/bin/env bash

sudo apt -y install wpasupplicant

echo "allow-hotplug wlan0" > wlan0.cfg.tmp
echo "iface wlan0 inet dhcp" >> wlan0.cfg.tmp
echo '    wpa_ssid "YOUR_WIFI_SSID"' >> wlan0.cfg.tmp
echo '    wpa_psk "YOUR_WIFI_PASSWORD"' >> wlan0.cfg.tmp
echo "" >> wlan0.cfg.tmp

sudo mv wlan0.cfg.tmp /etc/network/interfaces.d/wlan0.cfg

After that, disconnect the ethernet cable, reboot the machine (e.g. via sudo reboot), and you're dandy.

NB: If you prefer static IP instead of relying on DHCP (e.g. for port mapping purposes...):

#!/usr/bin/env bash

sudo apt -y install wpasupplicant

echo "allow-hotplug wlan0" > wlan0.cfg.tmp
echo "iface wlan0 inet static" >> wlan0.cfg.tmp
echo '    address 192.168.1.151' >> wlan0.cfg.tmp
echo '    netmask 255.255.255.0' >> wlan0.cfg.tmp
echo '    gateway 192.168.1.100' >> wlan0.cfg.tmp

#because my router is rubbish and doesn't provide DNS service
echo '    dns-nameservers 8.8.8.8' >> wlan0.cfg.tmp

echo '    wpa_ssid "YOUR_WIFI_SSID"' >> wlan0.cfg.tmp
echo '    wpa_psk "YOUR_WIFI_PASSWORD"' >> wlan0.cfg.tmp
echo "" >> wlan0.cfg.tmp

sudo mv wlan0.cfg.tmp /etc/network/interfaces.d/wlan0.cfg

protected by Community Jun 24 '15 at 18:02

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.