Networking issues after upgrading from Ubuntu 16.04 to 18.04.
I recently upgraded my Ubuntu 16.04 machines to 18.04 (a bit late I know – 20.04 is almost here). The upgrade was fairly painless, expect for two things: gksu was missing (which is another story) and networking issues.
I’ve been using Ubuntu for over a decade and it seems that every major release has changed the network stack. I wouldn’t mind that so much but often vestiges of the previous versions remain so that you can make what appear to be sensible changes with no effect, only later realizing that these configurations were not being used. For something as critical (and obscure to most people) as network configuration it just ‘has to work’. Hopefully netplan is the last iteration – for a while anyway.
The laptop was the first of my machines to be upgraded and this should have been a simple process as it is only a basic install without any special applications or configuration. The networking was set to be dynamically configured by DHCP using wired ethernet or WiFi.
The actual upgrade process ran flawlessly and initially everything appeared to be working, but it quickly became apparent that the network was non functional. Some searching found this to be a known problem due to an incorrect symbolic link.
Fix symbolic link
ls -al /etc/resolv.conf
sudo rm -f /etc/resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
ls -al /etc/resolv.conf
This helped but did not resolve the issues. More research found that the network stack had now been changed to use netplan and there were known issues with conflicts with old configurations after upgrading.
To enable netplan and remove the old configuration the following steps were applied. Netplan should have been installed with 18.04 so the following command should not be necessary, but if you need to install netplan use this.
sudo apt install netplan.io
Create a netplan yaml according to your required configuration. In my case I only needed the most basic configuration to pass control to Network Manager. There are many other common configurations described below.
sudo nano /etc/netplan/config.yaml network: version: 2 renderer: NetworkManager ^X and save sudo netplan apply sudo apt purge ifupdown sudo reboot sudo rm /etc/network/interfaces sudo rm -R /etc/network/interfaces.d
After configuring the network settings in the Network Manager GUI and rebooting (several times) the network seemed to be fully functional using WiFi, however the wired connection was not working at all. More research found this to be a known problem also.
sudo apt-get install --reinstall linux-headers-$(uname -r) linux-headers-generic build-essential dkms
After a few more reboots everything was operational.