So You Deleted Netplan (Or Just Need to Manually Configure Network Settings)

I had a broken install of python in Ubuntu 18.04. To fix it I tried a lot of variations of apt purge, remove, autoclean and autoremove.

Somehow I ended up without netplan, and without network.

Fix Step 1: Enable Network

Without netplan you need to use lower-level commands to get back online, to be able to use apt and reinstall netplan. And some kind of non network-based access to the server of course.

First, find your network interface name:


Next, enable the interface and set an IP:

:>sudo ifconfig eth0 up
:>sudo ip address add dev eth0
:>sudo ip route add default via dev eth0

Next, assign a DNS:

:>sudo systemd-resolve --interface=eth0 --set-dns=

Congratulations! You are back on the network!

Fix Step 2: Restore netplan

Now that you have internet,  you can use  apt to reinstall netplan. Big gotcha: you want, not plain netplan.

:>sudo apt update
:>sudo apt install

Your old settings should still be in /etc/netplan/01-netcfg.yaml.


:>sudo netplan apply

Verify the network still works.

I can't tell you exactly how to get systemd.networkd up and running properly (if any more steps are needed) since at this point I upgraded Ubuntu to 20.04.

comments powered by Disqus
Find me on Mastodon