Debian OS Upgrade
Safe upgrade workflow (CLI)
This page documents a practical Debian upgrade process. The exact Debian versions (buster, bullseye, bookworm) can change, but the flow stays the same: backup, update, adjust sources, upgrade, reboot, verify.
Step 1) Backup your system
sudo cp -v /etc/apt/sources.list /root/
sudo cp -rv /etc/apt/sources.list.d/ /root/
sudo cp -rv /etc/nginx/ /root/
Tip: also back up your critical service configs (mail, firewall, VPN, DNS) before continuing.
Step 2) Update all installed packages
lsb_release -a
uname -mrs
sudo apt update
sudo apt upgrade -y
sudo apt full-upgrade -y
sudo apt --purge autoremove -y
sudo reboot
Step 3) Update apt sources
Example: replace old codename with new
cat /etc/apt/sources.list
# Replace "buster" with "bullseye" (example)
sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list
sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list.d/*
sudo apt update
If you use third party repositories, verify they support your target Debian release. Remove or disable unsupported ones before upgrading.
Step 4) Minimal system upgrade
sudo apt upgrade
During the upgrade you may be asked about config file changes. In most cases: keep your local config unless you are sure.
Step 5) Full upgrade
sudo apt full-upgrade
sudo reboot
Step 6) Verification and cleanup
sudo apt install -y lsb-release
lsb_release -a
uname -r
sudo apt --purge autoremove -y
sudo apt autoclean
Notes
Checklist
- Backup configs
- Disable unsupported repos
- Upgrade + reboot
- Verify version
- Clean old packages