Rollback Strategies
Ubuntu’s do-release-upgrade does not support native downgrades. If serious issues arise after an upgrade, you need to rely on rollback plans prepared in advance. This article covers several practical rollback strategies.
Rollback Option Comparison
| Option | Recovery Speed | Preparation Complexity | Use Case |
|---|---|---|---|
| Timeshift | Fast (minutes) | Low | Desktop and small servers |
| LVM snapshot | Fast (minutes) | Medium | Systems using LVM |
| Btrfs snapshot | Very fast | Medium | Btrfs filesystem |
| dd disk image | Slow (depends on disk size) | Low | Universal option |
| Backup restore + reinstall | Slow | High | Last resort |
| Cloud platform snapshot | Fast | Low | Cloud servers |
Timeshift Snapshot Restoration
Timeshift is the most user-friendly system snapshot tool, supporting both RSYNC and Btrfs modes.
Creating a Snapshot Before Upgrade
# Install Timeshift
sudo apt install timeshift -y
# Create a snapshot
sudo timeshift --create --comments "Pre-upgrade backup" --tags D
# List snapshots
sudo timeshift --listRestoring from a Snapshot
Method 1: System Is Still Bootable
# List available snapshots
sudo timeshift --list
# Restore a specific snapshot
sudo timeshift --restore --snapshot "2026-03-24_10-00-00"
# You will be prompted to confirm; choose what to restore
# Reboot after restoration is complete
sudo rebootMethod 2: System Cannot Boot
- Boot from an Ubuntu Live USB
- Install and run Timeshift in the live environment:
# In the live environment
sudo apt update
sudo apt install timeshift -y
# Timeshift will automatically detect snapshots on disk
sudo timeshift --list
# Restore a snapshot
sudo timeshift --restore --snapshot "2026-03-24_10-00-00"
sudo rebootTimeshift Notes
- Timeshift does not back up
/homeby default (in RSYNC mode); user data needs to be backed up separately - Snapshots require sufficient disk space
- RSYNC mode snapshots grow in size over time (incremental)
- Btrfs mode is more efficient but requires the Btrfs filesystem
LVM Snapshot Rollback
If the system uses LVM (the default option during Ubuntu Server installation), you can use LVM snapshots for quick rollback.
Creating an LVM Snapshot Before Upgrade
# View existing logical volumes
sudo lvs
sudo vgs # Confirm the volume group has enough free space
# Create a snapshot for the root partition (requires free space in the volume group)
sudo lvcreate -L 10G -s -n root-snap /dev/ubuntu-vg/ubuntu-lv
# If there is a separate /var partition
sudo lvcreate -L 5G -s -n var-snap /dev/ubuntu-vg/var-lv
# Verify the snapshot
sudo lvsRolling Back from an LVM Snapshot
# Method 1: Merge the snapshot (requires unmounting or operating from Live USB)
# If you can still access the system
# Mark the snapshot for merge (takes effect on next activation)
sudo lvconvert --merge /dev/ubuntu-vg/root-snap
# The merge will execute automatically after reboot
sudo reboot
# Method 2: Operate from Live USB
# Boot from Live USB
sudo apt install lvm2 -y
sudo vgchange -ay # Activate volume groups
# Execute the merge
sudo lvconvert --merge /dev/ubuntu-vg/root-snap
sudo rebootIf No Free Space Is Available
# View current LVM usage
sudo vgs
# If VFree is 0, you can shrink an existing logical volume (dangerous, proceed with caution)
# Shrink the filesystem first, then shrink the logical volume
# Recommended to do this from a Live USB
# Check the filesystem
sudo e2fsck -f /dev/ubuntu-vg/ubuntu-lv
# Shrink the filesystem to 15G
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv 15G
# Shrink the logical volume to 16G (leave some headroom)
sudo lvreduce -L 16G /dev/ubuntu-vg/ubuntu-lv
# Now there is space to create a snapshot
sudo lvcreate -L 10G -s -n root-snap /dev/ubuntu-vg/ubuntu-lvBtrfs Snapshot Rollback
If using the Btrfs filesystem, snapshot operations are nearly instantaneous.
Creating a Btrfs Snapshot
# View Btrfs subvolumes
sudo btrfs subvolume list /
# Create a read-only snapshot
sudo btrfs subvolume snapshot -r / /snapshots/pre-upgrade-$(date +%Y%m%d)
# List snapshots
sudo btrfs subvolume list / | grep snapshotRestoring from a Btrfs Snapshot
# Boot from Live USB
# Mount the Btrfs partition
sudo mount /dev/sda2 /mnt
# View subvolumes
sudo btrfs subvolume list /mnt
# Rename the current root subvolume
sudo mv /mnt/@ /mnt/@broken
# Create a new root subvolume from the snapshot
sudo btrfs subvolume snapshot /mnt/snapshots/pre-upgrade-20260324 /mnt/@
# Reboot
sudo rebootdd Disk Image Recovery
The simplest but most universal approach, works with any filesystem.
Creating a Disk Image
# Recommended to create from Live USB to ensure partitions are unmounted
# Full disk image
sudo dd if=/dev/sda of=/mnt/external/full-disk.img bs=4M status=progress
# Compressed image
sudo dd if=/dev/sda bs=4M status=progress | gzip > /mnt/external/full-disk.img.gz
# Back up a specific partition only
sudo dd if=/dev/sda2 of=/mnt/external/root-partition.img bs=4M status=progressRestoring from a dd Image
# Boot from Live USB
# Restore the full disk
sudo dd if=/mnt/external/full-disk.img of=/dev/sda bs=4M status=progress
# Restore a compressed image
gunzip -c /mnt/external/full-disk.img.gz | sudo dd of=/dev/sda bs=4M status=progress
# Restore a single partition
sudo dd if=/mnt/external/root-partition.img of=/dev/sda2 bs=4M status=progress
# Update GRUB after restoration
sudo mount /dev/sda2 /mnt
sudo mount /dev/sda1 /mnt/boot/efi
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install /dev/sda
update-grub
exit
sudo rebootCloud Server Snapshot Recovery
Operations for Various Cloud Platforms
# Alibaba Cloud - create a snapshot using CLI
aliyun ecs CreateSnapshot --DiskId d-xxx --SnapshotName pre-upgrade
# Tencent Cloud
tccli cbs CreateSnapshot --cli-input-json '{"DiskId":"disk-xxx","SnapshotName":"pre-upgrade"}'
# AWS
aws ec2 create-snapshot --volume-id vol-xxx --description "pre-upgrade"
# To restore: use "Roll Back Disk" or "Create Disk from Snapshot" in each platform's consolePartial Rollback: Fixing Upgrade Issues
Sometimes a full rollback is not necessary; fixing specific issues may suffice.
Fixing Broken Packages
# Configure unconfigured packages
sudo dpkg --configure -a
# Fix dependencies
sudo apt --fix-broken install
# Reinstall a problematic package
sudo apt install --reinstall package-name
# Force reinstall
sudo dpkg -i --force-overwrite /var/cache/apt/archives/package-name*.debBooting with an Older Kernel
# Select "Advanced options for Ubuntu" from the GRUB menu
# Choose an older kernel version to boot
# If the GRUB menu doesn't appear (countdown too short)
# Hold Shift during boot (BIOS) or press Esc (UEFI)
# After entering the system, fix kernel issues
sudo apt install --reinstall linux-image-$(uname -r)
sudo update-grubRecovery Mode
# Select Recovery Mode from GRUB
# Available options:
# - dpkg fix broken packages
# - fsck check filesystem
# - network enable networking
# - root enter root shell
# In the root shell
mount -o remount,rw /
apt --fix-broken install
dpkg --configure -a
rebootPreventive Measures Summary
Pre-upgrade preparation directly determines the feasibility of a rollback:
- Must do: Full data backup (databases, configurations, user files)
- Strongly recommended: System snapshot (Timeshift, LVM, Btrfs)
- Cloud servers: Create a disk snapshot
- Virtual machines: Create a VM snapshot
- Critical systems: Upgrade in a test environment first for validation
Rollback Decision Flow
Issue found after upgrade
|-- Is the issue fixable?
| |-- Yes -> Fix the specific issue (package repair, config adjustment)
| +-- No -> Continue assessment
|
|-- Is there a system snapshot?
| |-- Yes -> Restore snapshot (Timeshift/LVM/Btrfs)
| +-- No -> Continue assessment
|
|-- Is there a disk image?
| |-- Yes -> dd restore
| +-- No -> Continue assessment
|
+-- Last resort
+-- Reinstall system + restore data and configs from backupThe most important takeaway: Always back up before upgrading — do not rely on rollback alone.