Question

Can not upgrade Ubuntu 22.04 to 24.04

So I’m in the process of upgrading my Ubuntu machines (both local and through DO) from 22.04 to 24.04. The first point release is out (Sept 2024) and I’ve upgraded before. I specifically followed the instructions listed here: https://www.cyberciti.biz/faq/how-to-upgrade-from-ubuntu-22-04-lts-to-ubuntu-24-04-lts/. The upgrade process seems to work, however upon rebooting I can not ssh into the new installation or use the DO console. I’ve used the recovery ISO and chrooted into the installation however I’m not exactly sure where the error is. I’m guessing its a network issue however that’s really a guess. When things happen like this at home on VMs hosted within proxmox or xcp-ng, I’m able to obtain a console directly into the VM which really helps. The DO console seems to use a ssh connection, and if networking is down this ssh connection just doesn’t work. What’s the best strategy here to debug? I’ve rolled back to the last snapshot several times before performing the upgrade and I’m kind of stuck here on what to do. For networking I’m using a netplan config file with networkd as the renderer. I’m wondering if I should just write the systemd-network network files directly rather than depend on netplan (as I do within Arch), however I’m not quite sure this is going to fix things since I’m really missing some debug tools here.

Thanks for any suggestions.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

The issue for me was that networking was not configured correctly.

This stemmed from a defect in cloud-init 24.2.

I had to perform the following steps to resolve the issue:

  1. From the Access tab on the Digital Ocean droplet launch Recovery Console

  2. Edit /usr/lib/python3/dist-packages/cloudinit/net/netops/iproute2.py

    sudo nano /usr/lib/python3/dist-packages/cloudinit/net/netops/iproute2.py
    
  3. Scroll to the bottom and find def flush_addr(interface: str)

  4. Change:

    subp.subp(["ip", "flush", "dev", interface])
    

    to:

    subp.subp(["ip", "addr", "flush", "dev", interface])
    

    We’re only adding "addr",

  5. Reboot

    sudo reboot
    

From that point I was able to get valid network settings via cloud-init during the boot process.

If that doesn’t work for you then you can use the recovery console to manually setup a network interface following this post and troubleshoot further.

Did you ever figure this out?

alexdo
Site Moderator
Site Moderator badge
September 12, 2024

Heya, @kevdog

I’ll also recommend to migrate your data to a new droplet using tools like rsync, scp, FileZilla and etc. In this way you can assure that the droplet will not experience changes and protential problems during the OS upgrade.

It is also a practical solution, especially if the current environment is proving too difficult to troubleshoot quickly. A fresh droplet also gives you a clean slate, free from the complexities and potential misconfigurations that might have occurred during the upgrade process.

Hope that this helps!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.