Translation(s): English - Français - Italiano - Svenska
What is "downgrading a system"?
In the Debian world, it means to move to an older distribution (typically, to move from unstable to testing). Do not expect to get anything stable by downgrading!
Is it supported?
Short answer: No, it isn't supported.
- Long answer: It isn't supported because
- The packages' installation scripts (postinst...) are designed to handle upgrade only.
The installation tools are designed to replace older versions of packages by newer versions.
So, what's the supported way?
- Make a backup of your system before you upgrade, so you can restore your backup to "downgrade" it!
But I am desperate since I have no backup ...
There are some workarounds to save your system, provided you know where your important data is. They may be in your home directory, /etc/, /mail/, ....
- If an upgrade caused your system to break, boot your system with a live CD/USB-key etc., and make a backup of your private data somewhere (USB connected HDD, SSH connected remote system, ...).
- Make a fresh new system install.
- Restore your private data from the back up.
But I am desperate and lazy ...
Here is a totally unsupported trick which may work in some lucky situations. (Desktop focused example)
System downgrade tends to be more successful, if there aren't many packages installed. No GUI program and no TeX is good idea. I mean removing practically all non-essential packages is the trick I know the following is very terse. If this is too cryptic, try the above method with live CD/USB-key, instead.
- Save data and stop all your Desktop tasks.
- CTRL-ALT-F3 to get to console and login as root.
Start aptitude -u
Press l to open a dialog.
- Press 'M' on 'Installed Packages' line and press '['.
- Press 'm' on key packages like 'vim' 'mc' 'git' 'ssh' 'exim4-daemon-light' ... (packages you need to keep.)
- Press '+' on key packages to be installed.
- Press '+' again if key packages show 'B' to resolve broken dependency.
- Press 'g' (resolve broken dependency as needed) to remove all non-essential packages.
Edit /etc/apt/sources.list to point repository to the downgraded distribution.
Set apt_preferences(5) to set the downgraded distribution with PIN 10001
Run "apt update; apt full-upgrade" to downgrade system.
Run aptitude -u to interactively resolve issues.
Remove apt_preferences(5) PIN.
Run aptitude -u and install system. (Use task list in aptitude and information from backed up /var/lib/dpkg/status.)
- If you are lucky, you may have somewhat functioning system. No guarantee of stability!!!
Sometimes it is easier and cleaner to use chroot multiply installations option. This option works for one partition linux install and allows you not just chroot into folder but hot swap currently installed linux.
Idea is to install all chroot linux OS you want into separate chroot folder like /bullseye /bookworm /clearlinux /ubuntu16.20 and then hot swap chroot folder content into your current root /.
This is risky, can fail, or destroy all your data and not guaranteed to work on your system. But practically works!
Here are a little bit technical details. To hot swap running OS your need special statically linked binary which can work without system /lib/libc.* libraries or any system binaries. Because when you move your /lib or /bin folder into /backup folder on running OS all system calls will fail and unable to complete any operations but kernel level ones. At this moment it can fail your system badly but it will not fail if you do all move operations at once using statically linked binary.
To try it on your system you will need two scripts:
then prepare chroot using debootstrap, to the new folder 'debootstrap bullseye /bullseye', install kernel and grub, then:
# 'swapos /bullseye'
There are more safer technique including booting into Live USB then swap all files manually from one folder to another and then reboot. But it takes much longer time and requires you to have external device connected to your PC and several reboots.