Ubuntu Core wifi configuration issue

6,306

Solution 1

This took a long while to figure out.

I can only guess Ubuntu Core does things differently from the previous versions of Ubuntu and Raspbian. Otherwise editing the /etc/network/interfaces file as I did in my original post should have worked.

I want to give my sincere thanks to chili555 for all his efforts to help me with this problem.

Solution:

Ubuntu Core operates the SNAP package manager. I assume it is SNAP which is responsible for the sudo console-conf command. Upon execution, you should see something like the following:

enter image description here

Press enter on the highlighted OK button and you will have access to the network connections area:

enter image description here In this area, as in all others under console-conf, you use the arrow keys to navigate to sections of interest. The wlan0, wireles card #1, is of interest to me so I have it highlighted in the screen shot. Then, I press enter.

enter image description here

Notice the Configure WIFI settings menu. When you hit enter with that menu highlighted, the resulting interface is where you set your wifi SSID and password.

Same applies for my attempts to set a static IP address. Just hit the down arrow once to land on the Use a static IPv4 configuration and hit enter to provide the IP details you want to make your Pi wifi accessible.

The subnet mask gave me a lot of trouble. I'm not network engineer and I assumed it was supposed to be 255.255.255.0/?? but the menu complained with error messages. Below is the data that worked ( I guessed upon the correct subnet mask ):

enter image description here

I hope people find this time saving and helpful.

Solution 2

You have failed to specify the SSID, normally a router, that you wish to connect to, you haven’t provided the WPA2 password, you haven’t provided DNS nameservers and, finally, the broadcast declaration is unnecessary. I suggest that you amend the file to:

source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopbak

auto wlan0
iface wlan0 inet static
address 192.168.0.30
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1 8.8.8.8
wpa-ssid <your_router>
wpa-psk <ypur_secret_key>

Restart the interface:

sudo ifdown wlan0 && sudo ifup -v wlan0

Check:

ping -c3 www.ubuntu.com

You should be all set.

Share:
6,306

Related videos on Youtube

sisko
Author by

sisko

Professional web developer making the transition into Robotics

Updated on September 18, 2022

Comments

  • sisko
    sisko over 1 year

    My static IP address settings are being wiped out each time I reboot my Raspberry Pi.

    I just installed Ubuntu Core on a Raspberry Pi 3 but I have struggled to establish a wifi static IP address.

    The following are the steps I went through:

    1. Once logged in to the Pi, I executed sudo classic
    2. Executed sudo nano /etc/network/interfaces and added the following content:

      source-directory /etc/network/interfaces.d

      auto wlan0
      iface wlan0 inet static
        address 192.168.0.30
        broadcast 192.168.0.255
        netmask 255.255.255.0
        gateway 192.168.0.1
      
    3. Saved the file and I execute sudo ifup wlan0

    4. At this point when I execute ifconfig, the IP Address and other settings are visible under wlan0. Punched the air in celebration.

    5. I execute exit to return to snap and then I execute sudo reboot to restart the Pi. I also immediately remote the ethernet cable from the Pi so wifi can handle the Internet requirements.

    This is where my problems begin.

    I check my routers IP address listings and my static IP is not included.

    I log back into my Pi and execute ifconfig again the IP Address and other settings for wlan0 are no longer present.

    The wifi ID and password are contained in the /etc/wpa_supplicant/wpa_supplicant.conf file and below are the contents:

    network={
            ssid="SKY8317B"
            psk="TRUMBOX"
            key_mgmt=WPA-PSK
    }
    

    I would really appreciate some help in fixing this issue where my static IP address fails to persist.

    UPDATE#1: The following is verbose debug output based on the very helpful input of @chili555

    sudo ifdown wlan0 && sudo ifup -v wlan0
    
    ifdown: interface wlan0 not configured
    Reading directory /etc/network/interfaces.d
    Configuring interface wlan0=wlan0 (inet)
    /bin/run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
    run-parts: executing /etc/network/if-pre-up.d/bridge
    run-parts: executing /etc/network/if-pre-up.d/wireless-tools
    run-parts: executing /etc/network/if-pre-up.d/wpasupplicant
    wpa_supplicant: wpa-driver nl80211,wext (default)
    wpa_supplicant: /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -C /run/wpa_supplicant
    Starting /sbin/wpa_supplicant...
    wpa_supplicant: creating sendsigs omission pidfile: /run/sendsigs.omit.d/wpasupplicant.wpa_supplicant.wlan0.pid
    wpa_supplicant: ctrl_interface socket located at /run/wpa_supplicant/wlan0
    wpa_supplicant: configuring network block -- 0
    wpa_supplicant: wpa-ssid "SKY8317B" -- OK
    wpa_supplicant: wpa-psk ***** -- OK
    wpa_supplicant: enabling network block 0 -- OK
    /bin/ip addr add 192.168.0.30/255.255.255.0 broadcast 192.168.0.255       dev wlan0 label wlan0
    /bin/ip link set dev wlan0   up
     /bin/ip route add default via 192.168.0.1  dev wlan0 onlink
    /bin/run-parts --exit-on-error --verbose /etc/network/if-up.d
    run-parts: executing /etc/network/if-up.d/000resolvconf
    run-parts: executing /etc/network/if-up.d/openssh-server
    run-parts: executing /etc/network/if-up.d/ubuntu-fan
    run-parts: executing /etc/network/if-up.d/upstart
    run-parts: executing /etc/network/if-up.d/wpasupplicant
    

    UPDATE#2:

    Result of executing => lsb_release -d:

    Description:    Ubuntu 16.04.4 LTS
    

    Result of executing => cat /etc/netplan/*:

    network:
        version: 2
        ethernets:
            all-en:
                match:
                    name: "en*"
                dhcp4: true
            all-eth:
                match:
                    name: "eth*"
                dhcp4: true
    

    UPDATE#3:

    On my travels across the Internet I came across a post somewhere which said updates manually made to the /etc directory will not persist. I opted not to believe that at the time but I just found the sudo console-conf command which seems to be the built in solution.

    Using that command, you can provide the wifi SSID and password. Resetting the Pi and logging back in shows that the settings I provided are still in place.

    Another setting to be provided is static IPv4 data but I don't know how to set that info i:e subnet in CIDR format. Below is a screen shot of my attempted settings:

    enter image description here

  • sisko
    sisko about 6 years
    Actually, I did not fail to set the SSID. The ssid and psk were set the the /etc/wpa_supplicant/wpa_supplicant.conf file. However, I tried making the amendments you suggested and it did not fix the problem.
  • chili555
    chili555 about 6 years
    Is the selected address outside the DHCP pool in the router? Is the wpa-psk key in clear text not hex? Any clues in ifup -v for verbose?
  • sisko
    sisko about 6 years
    If by "outside the DHCL pool" you mean addresses reserved for other devices/services by the router the honest truth is I don't know. I had previously looked for such reserved addresses but found none. The wpa-psk is in clear text. The verbose output does not seem to contain any clues as to why it's not working but just incase I missed something, I have added it to my original post.
  • chili555
    chili555 about 6 years
    Please add: lsb_release -d and also: cat /etc/netplan/* Most routers and modems have, in the administration pages, a section related to DHCP, like this: abyssunderground.co.uk/images/router/dhcp.gif In this example, DHCP pool is x.110 to x.159. Static addresses in the range of, for example, x.2 to x.100 are safe.
  • sisko
    sisko about 6 years
    I have added the information you requested
  • chili555
    chili555 about 6 years
    I am entirely unfamiliar with console-conf but I think I can help you with a few details. I suspect that the address you want needs to be in the form, in console-conf, at least, of 192.168.0.30/24. I think the netmask will fill in automatically, but, in case not, 255.255.255.0. Finally, the gateway is 192.168.0.1.
  • chili555
    chili555 about 6 years
    Files in /etc are retained on reboot except for /etc/resolv.conf which is not a file at all but a symbolic link. There may be others but not any that are relevant to networking. It is easy enough to verify; check the file after a reboot, for example: cat /etc/network/interfaces Is the file the same as you set it or is it changed?
  • sisko
    sisko about 6 years
    Sorry, I miss represented what I meant to say. The files and the edits I added under the /etc directory are still there when I reboot. What I should have said is that the settings those files effect don't persist between resets.
  • sisko
    sisko about 6 years
    I also tried the 192.168.0.30/24 ip address setting you suggested and unfortunately found the system will not allow non numeric and dot characters. So the forward slash is not accepted :-(
  • chili555
    chili555 about 6 years
    Then just try 192.168.0.30 and then 255.255.255.0 and then 192.168.0.1. Any improvement?
  • sisko
    sisko about 6 years
    No joy, I'm afraid. It still shows the "should be in CIDR form (xx.xx.xx.xx/yy)" message beneath the subnet message. I'm really out of my depth with this.
  • sisko
    sisko about 6 years
  • sisko
    sisko about 6 years
    When I try random numbers for /yy, like /24, it seems to accept it but then it complains "'192.168.0.30' is not contained in '255.255.255.0/24'"