I recently install Ubuntu 21.04 from 20.04 LTS and now want to go back to Ubuntu 20.04 LTS without any data loss [duplicate]

I just installed a new version of Ubuntu and I want to roll it back to the previous version.

How can I do that? Is that even possible?


Solution 1:

There's a saying in my language which can be roughly translated as "You can't turn mince back into meat by rotating the mincer's handle in the opposite direction" "You can't turn mince back into meat by rotating the mincer's handle in the opposite direction" :)

The upgrade procedure is one-way - while installing new versions of software, your configuration files and settings are modified by packages' post-install scripts to use new format which is required by new software. Basically, there's no opposite procedure - to make a newer configuration file compatible with old software.

Solution 2:

Downgrading releases is possible to some extent. With enough fighting, it can be done (see some of the other answers here for the the technical details).

However the result you end up with is not the same as what you had before the upgrade. During an upgrade certain one-way changes are made to make new packages happy and downgrading them won't reverse those edits. It's impossible to guarantee a downgrade will work at all, let alone if it'll be stable.

In short, your easiest option is always going to be a reinstall. Don't think of it as a chore, look at it as a nice opportunity to trim down on packages and configure things better.

If you want to test things in the future and you fear you might have issues, always make sure you do the following:

  • Test the LiveCD first. If you're going to have immediate hardware issues, this should let you know.
  • Back up before you do anything. I know everybody and their mother has already told you to do this, but it's really important if you think you're going to have issues. If you can't do without your machine for more than 20 minutes, consider some full-disk cloning tools like Clonezilla so you can just restore a previous version of the disk. There are other tools that can offer similar results.
  • Keep your data separate. Having your /home/ within the same partition as your installation is a recipe for a headache if you're constantly upgrading/downgrading things. Push it off to another disk or at least another partition so that when you do need to reinstall, you really just need to set up the mount.
  • There was a critical bug for downgrading that was fixed by the Ubuntu QA team. Make sure you read up on that, as some people will recommend you just stick in an older CD and "upgrade" to it, but this is a bad idea.

Solution 3:

It's possible at the level of the packaging tools (apt). But the resulting system may not be equivalent to doing a reinstall, and you may get errors along the way. This is because many packages contain specific support for upgrades (e.g. handling changes in configuration files) but not for downgrades.

Normally, apt prefers to install the most recent version of a package. But you can change this through pinning: you can declare that packages from the old release have higher priority than the installed packages, so that they will be downgrades when you do aptitude dist-upgrade.

Change your /etc/apt/sources.list to include only the old release (either edit the file or use your favorite GUI), and run aptitude update. Then edit /etc/apt/preferences (documented in the apt_preferences man page) and add the following lines (to downgrade to lucid):

Package: *
Pin: release v=10.04
Pin-Priority: 1001

Then run aptitude dist-upgrade. Every package has a priority greater than 1000, so every package that is present in 10.04 and installed on your system will be downgraded. You'll have to remove packages that weren't in 10.04 manually; they'll be listed under “Obsolete and locally created packages” in aptitude.