Sunday, December 6, 2020

Getting wireless networking working on Ubuntu Server 20.04 with Netplan and Wpa_supplicant

 I'd love to riff on how every time they try to make things easier they actually make them harder, but ain't nobody got time for that..

I installed Linux (the latest version of Ubuntu) on my Macbook Air this week, since Apple says it's too old to get their newest version of MacOS. That went pretty swimmingly. So I thought I would instead install Server, since that's how I tend to relate to Linux, through the CLI via SSH.

So I did the install and immediately came up against a big problem. The networking part of the install choked because I did not have a wired ethernet card. It turns out that the default wireless support is kinda iffy for Server, which makes sense I guess (typical servers don't tend to connect via WIFI). But the Air has two USB ports and an SD card slot and that's it, and so wired ethernet is off the table. (Sure I could get some kind of USB adapter card, but that is really out of scope.)

So I got through the install, without a network connection. Then I dug into seeing if I could set up the wifi. Ubuntu has gone to this new method of network config called "Netplan". Basically 99% of the network commands and files I knew are no longer used with it.

I'll make a long story short and say there was a lot of googling, and trial and error, and banging my head against the wall. Here's a good place to start: 

     https://linuxconfig.org/ubuntu-20-04-connect-to-wifi-from-command-line

That will take you through editing your yaml file, and running the commands to install it.

But most fail to mention that a key software component is missing (wpa_supplicant). And as you have no Internet connection, you can't install it. This is quite a catch-22. But I got the URLs for the debian packages by failing the install- "sudo apt install wpasupplicant" which listed them (there were two dependencies too). So I downloaded them with another machine, and put them on a flash drive. Then I mounted it, and ran the installs (just point sudo apt install at the deb files in the usb mount point, do the dependencies first).

Of course now that I figured it out, I found a link that lays it all out - 

     https://medium.com/@yping88/how-to-enable-wi-fi-on-ubuntu-server-20-04-without-a-wired-ethernet-connection-42e0b71ca198

It took about a day, to do something in Server, that the Desktop version had done automatically and instantly. It was so minor I never saw a notice or dialog about the networking, except to pick a wifi access point. Another nightmare like this, and I'll probably go back to the Desktop :) .