Translation(s): English - Español - Français - Italiano - Português (Brasil) - Русский - Svenska

(!) ?Discussion


This page provides directions to upgrade your Debian distribution using apt-get. While Aptitude is Debian's recommended package management tool, apt-get is the recommended tool for doing upgrades from one Debian GNU/Linux release to another.

How to release upgrade your distribution

Upgrading from one stable release to the next (e.g. bullseye to bookworm) is done by following the release notes for your architecture. For most users, that means the Release Notes for AMD64 or Release Notes for ARM64.

Back up your data

Performing a release upgrade is never without risk. The upgrade may fail, leaving the system in a non-functioning state. USERS SHOULD BACKUP ALL DATA before attempting a release upgrade. DebianStability contains more information on these steps.

Encrypted Root

On systems which rely on the initramfs integration, one can mark 'cryptsetup-initramfs' as being manually installed so APT never selects it for auto-removal with the following command: apt-mark manual cryptsetup-initramfs.

Upgrading a system can take several hours, depending on the number of installed packages and the speed of the system, especially its hard disks. While the download portion of the upgrade can be done separately, the actual install portion should be done in a single pass. Most of the upgrade process is quite hands-off, but some administrator action is needed towards the end of the process if the system has a custom configuration.

Upgrades are done with package management tools, root or sudo access, and generally involve the following steps.

# First, ensure your system is up-to-date in it's current release.
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get full-upgrade

# If you haven't already, ensure all backups are up-to-date.  

# In a text editor, replace the codename of your release with that of the next release in APT's package sources
# For instance, the line
#    deb https://deb.debian.org/debian/ buster main
# should be replaced with
#    deb https://deb.debian.org/debian/ bullseye main
$ sudo nano /etc/apt/sources.list /etc/apt/sources.list.d/*

# If you are migrating to Bookworm or later, then a new repo for non-free firmware is available.
# If you wish, you can add non-free and non-free-firmware, depending on your specific needs.
# For instance, the line
#    deb https://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
# or
#    deb https://deb.debian.org/debian/ stable main contrib non-free non-free-firmware

# Clean and update package lists
$ sudo apt-get clean
$ sudo apt-get update

# Perform the major release upgrade, removing packages if required
# Interrupting this step after downloading has completed is an excellent way to stress-test your backups
$ sudo apt-get upgrade
$ sudo apt-get full-upgrade

# Remove packages that are not required anymore
# Be sure to review this list: you may want to keep some of them
$ sudo apt-get autoremove

# Reboot to make changes effective (optional, but recommended)
$ sudo shutdown -r now

Now check the output of  uname -a ; lsb_release -a  and you should see info about the upgraded system.


CategoryPackageManagement