Upgrading from Ubuntu 22.04 to 24.04 on a Digital Ocean droplet

August is the end of summer, but it’s also the time that Ubuntu lets their servers access the latest distro of Ubuntu.

sudo apt update
sudo apt upgrade -y
sudo reboot

Once you have finished applying your updates, I ran the following:

sudo apt install update-manager-core
sudo do-release-upgrade -d

So far so good! When prompted on whether to use the new version of the package’s configuration files, I reviewed and tried to kept the original version of the files.

After the upgrade, I rebooted and unfortunately, was unable to connect to my server via SSH as I received a connection timeout error. Same thing when when pinging the server. Troubleshooting further by using the ip a command (not ip -a!) and checking the eth0 interface, it appeared that the server was fitted with an IPv6 address.

Then began the investigation to find out how to supply the server with an IPv4 IP and eventually, my research took me to Netplan and the /etc/netplan/50-cloud-init.yaml file.

Taking a look the network connectivity troubleshooting documentation from Digital Ocean eventually led me to update the configuration file to this format:

network:
  version: 2
  ethernets:
    eth0:
  addresses:
    - <<Removed intentionally>>
  gateway4: <<Removed intentionally>>
  match:
    macaddress: "<<Removed intentionally>>"
  dhcp4: false
  nameservers:
  addresses:
    - 67.207.67.2
    - 67.207.67.3
  set-name: "eth0"

Afterwards, I used the following command(s) to apply my settings:

sudo netplan try --debug
sudo netplan apply
sudo reboot

After trying the Netplan changes, I was able to ping my server but after rebooting the server, I was surprised to discover that all of my changes were gone!

More research ensued and I finally settled on the solution to add a config file and disable the cloud-init service from overriding the cloud-init.yaml file.

To do this I created the following file: /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg and added this line:

network: {config: disabled}

One last time, I reboot the server and everything was now ready to go!