Chapter 4. Upgrades From Debian 10 (Buster)
Chapter 4. Upgrades From Debian 10 (Buster)
Chapter 4. Upgrades From Debian 10 (Buster)
The main things you'll want to back up are the contents of /etc,
/var/lib/dpkg, /var/lib/apt/extended_states and the output of dpkg
--get-selections "*" (the quotes are important). If you use aptitude to
manage packages on your system, you will also want to back up
/var/lib/aptitude/pkgstates.
The upgrade process itself does not modify anything in the /home directory.
However, some applications (e.g. parts of the Mozilla suite, and the GNOME
and KDE desktop environments) are known to overwrite existing user settings
with new defaults when a new version of the application is first started by a user.
As a precaution, you may want to make a backup of the hidden files and
directories (“dotfiles”) in users' home directories. This backup may help to
restore or recreate the old settings. You may also want to inform users about
this.
If you wish to take extra precautions, back up or unmount the /home partition
before upgrading.
The precise downtime for these services will vary depending on the number of
packages being upgraded in the system, and it also includes the time the
system administrator spends answering any configuration questions from
package upgrades. Notice that if the upgrade process is left unattended and the
system requests input during the upgrade there is a high possibility of services
being unavailable[1] for a significant period of time.
If the system being upgraded provides critical services for your users or the
network[2], you can reduce the downtime if you do a minimal system upgrade,
as described in Section 4.4.4, “Minimal system upgrade”, followed by a kernel
upgrade and reboot, and then upgrade the packages associated with your
critical services. Upgrade these packages prior to doing the full upgrade
described in Section 4.4.5, “Upgrading the system”. This way you can ensure
that these critical services are running and available through the full upgrade
process, and their downtime is reduced.
For this reason it makes sense to ensure that you will be able to recover if your
system should fail to reboot or, for remotely managed systems, fail to bring up
networking.
If you are upgrading remotely via an ssh link it is recommended that you take
the necessary precautions to be able to access the server through a remote
serial terminal. There is a chance that, after upgrading the kernel and rebooting,
you will have to fix the system configuration through a local console. Also, if the
system is rebooted accidentally in the middle of an upgrade there is a chance
you will need to recover using a local console.
For emergency recovery we generally recommend using the rescue mode of the
bullseye Debian Installer. The advantage of using the installer is that you can
choose between its many methods to find one that best suits your situation. For
more information, please consult the section “Recovering a Broken System” in
chapter 8 of the Installation Guide and the Debian Installer FAQ.
If that fails, you will need an alternative way to boot your system so you can
access and repair it. One option is to use a special rescue or live install image.
After booting from that, you should be able to mount your root file system and
chroot into it to investigate and fix the problem.
Basic things to check are: presence of correct device files in /dev; what
modules are loaded (cat /proc/modules); output of dmesg for errors
loading drivers. The output of dmesg will also show what device files have been
assigned to which disks; you should check that against the output of echo
$ROOT to make sure that the root file system is on the expected device.
If you do manage to fix the problem, typing exit will quit the debug shell and
continue the boot process at the point it failed. Of course you will also need to fix
the underlying problem and regenerate the initrd so the next boot won't fail
again.
If the boot fails under systemd, it is possible to obtain a debug root shell by
changing the kernel command line. If the basic boot succeeds, but some
services fail to start, it may be useful to add systemd.unit=rescue.target
to the kernel parameters.
# mount -o remount,rw /
More information on debugging a broken boot under systemd can be found in
the Diagnosing Boot Problems article.
Important
If you are using some VPN services (such as tinc) consider that
they might not be available throughout the upgrade process. Please
see Section 4.1.3, “Prepare for downtime on services”.
In order to gain extra safety margin when upgrading remotely, we suggest that
you run upgrade processes in the virtual console provided by the screen
program, which enables safe reconnection and ensures the upgrade process is
not interrupted even if the remote connection process temporarily fails.
The main configuration file that APT uses to decide what sources it should
download packages from is /etc/apt/sources.list, but it can also use
files in the /etc/apt/sources.list.d/ directory - for details see
sources.list(5). If your system is using multiple source-list files then you will need
to ensure they stay consistent.
$ cat /etc/debian_version
Please follow the instructions in the Release Notes for Debian 10 to upgrade to
Debian 10 first.
Some users may have unofficial backported “newer” versions of packages that
are in Debian installed on their buster system. Such packages are most likely to
cause problems during an upgrade as they may result in file conflicts[4].
Section 4.5, “Possible issues during upgrade” has some information on how to
deal with file conflicts if they should occur.
# dpkg --audit
You could also inspect the state of all packages on your system using aptitude
or with commands such as
# dpkg -l | pager
or
Note that aptitude uses a different method for registering packages that are on
hold than apt and dselect. You can identify packages on hold for aptitude with
# aptitude search "~ahold"
If you want to check which packages you had on hold for apt, you should use
If you changed and recompiled a package locally, and didn't rename it or put an
epoch in the version, you must put it on hold to prevent it from being upgraded.
If there is anything you need to fix, it is best to make sure your APT source-list
files still refer to buster as explained in Section A.2, “Checking your APT source-
list files”.
APT will consider all packages that can be found via any configured archive,
and install the package with the highest version number, giving priority to the
first entry in the files. Thus, if you have multiple mirror locations, list first the
ones on local hard disks, then CD-ROMs, and then remote mirrors.
Debian provides two announcement mailing lists to help you stay up to date on
relevant information related to Debian releases:
To make use of the CDN service, add a line like this to your APT source
configuration (assuming you are using main and contrib):
After adding your new sources, disable the previously existing “deb” lines by
placing a hash sign (#) in front of them.
However, if you get better results using a specific mirror that is close to you in
network terms, this option is still available.
http://mirrors.kernel.org/debian/dists/bullseye/main/binary-amd64/...
http://mirrors.kernel.org/debian/dists/bullseye/contrib/binary-amd64/...
To configure APT to use a given mirror, add a line like this (again, assuming you
are using main and contrib):
Note that the “dists” is added implicitly, and the arguments after the release
name are used to expand the path into multiple directories.
Again, after adding your new sources, disable the previously existing archive
entries.
To use this with apt, add this line to your sources.list file:
Note that the “dists” is added implicitly, and the arguments after the release
name are used to expand the path into multiple directories.
After adding your new sources, disable the previously existing archive entries in
the APT source-list files by placing a hash sign (#) in front of them.
Make sure there is a line in /etc/fstab that enables mounting your CD-ROM
drive at the /media/cdrom mount point. For example, if /dev/sr0 is your CD-
ROM drive, /etc/fstab should contain a line like:
Note that there must be no spaces between the words noauto,ro in the fourth
field.
Next, run:
# apt-cdrom add
for each Debian Binary CD-ROM you have, to add the data about each CD to
APT's database.
apt is meant for interactive use, and should not be used in scripts. In
scripts one should use apt-get, which has a stable output better
suitable for parsing.
Don't forget to mount all needed partitions (notably the root and /usr partitions)
read-write, with a command like:
Next you should double-check that the APT source entries (in
/etc/apt/sources.list and files under /etc/apt/sources.list.d/)
refer either to “bullseye” or to “stable”. There should not be any sources
entries pointing to buster.
Note
or similar. If you have to rerun the typescript (e.g. if you have to reboot the
system) use different step values to indicate which step of the upgrade you are
logging. Do not put the typescript file in a temporary directory such as /tmp or
/var/tmp (files in those directories may be deleted during the upgrade or
during any restart).
The typescript will also allow you to review information that has scrolled off-
screen. If you are at the system's console, just switch to VT2 (using Alt+F2)
and, after logging in, use less -R ~root/upgrade-bullseye.script to
view the file.
After you have completed the upgrade, you can stop script by typing exit at
the prompt.
apt will also log the changed package states in /var/log/apt/history.log
and the terminal output in /var/log/apt/term.log. dpkg will, in addition,
log all package state changes in /var/log/dpkg.log. If you use aptitude, it
will also log state changes in /var/log/aptitude.
If you have used the -t switch for script you can use the scriptreplay program
to replay the whole session:
# apt update
Note
4.4.3. Make sure you have sufficient space for the upgrade
You have to make sure before upgrading your system that you will have
sufficient hard disk space when you start the full system upgrade described in
Section 4.4.5, “Upgrading the system”. First, any package needed for installation
that is fetched from the network is stored in /var/cache/apt/archives (and
the partial/ subdirectory, during download), so you must make sure you have
enough space on the file system partition that holds /var/ to temporarily
download the packages that will be installed in your system. After the download,
you will probably need more space in other file system partitions in order to both
install upgraded packages (which might contain bigger binaries or more data)
and new packages that will be pulled in for the upgrade. If your system does not
have sufficient space you might end up with an incomplete upgrade that is
difficult to recover from.
apt can show you detailed information about the disk space needed for the
installation. Before executing the upgrade, you can see this estimate by running:
# apt -o APT::Get::Trivial-Only=true full-upgrade
[ ... ]
XXX upgraded, XXX newly installed, XXX to remove and XXX not
upgraded.
Need to get xx.xMB of archives.
After this operation, AAAMB of additional disk space will be
used.
Note
If you do not have enough space for the upgrade, apt will warn you with a
message like this:
In this situation, make sure you free up space beforehand. You can:
# apt autoremove
Remove packages that take up too much space and are not currently
needed (you can always reinstall them after the upgrade). If you have
popularity-contest installed, you can use popcon-largest-unused
to list the packages you do not use that occupy the most space. You can
find the packages that just take up the most disk space with dpigs
(available in the debian-goodies package) or with wajig (running
wajig size). They can also be found with aptitude. Start aptitude in
full-terminal mode, select Views → New Flat Package List, press l and
enter ~i, then press S and enter ~installsize. This will give you a
handy list to work with.
Remove translations and localization files from the system if they are not
needed. You can install the localepurge package and configure it so
that only a few selected locales are kept in the system. This will reduce the
disk space consumed at /usr/share/locale.
Note
# apt clean
# umount /var/cache/apt/archives
5. remove the remaining /media/usbkey/archives.
Note that in order to safely remove packages, it is advisable to switch your APT
source-list files back to buster as described in Section A.2, “Checking your APT
source-list files”.
Important
In some cases, doing the full upgrade (as described below) directly might
remove large numbers of packages that you will want to keep. We therefore
recommend a two-part upgrade process: first a minimal upgrade to overcome
these conflicts, then a full upgrade as described in Section 4.4.5, “Upgrading the
system”.
This has the effect of upgrading those packages which can be upgraded without
requiring any other packages to be removed or installed.
The minimal system upgrade can also be useful when the system is tight on
space and a full upgrade cannot be run due to space constraints.
# apt full-upgrade
This will perform a complete upgrade of the system, installing the newest
available versions of all packages, and resolving all possible dependency
changes between packages in different releases. If necessary, it will install some
new packages (usually new library versions, or renamed packages), and
remove any conflicting obsoleted packages.
Another possible workaround for this problem is to temporarily add both buster
and bullseye sources to your APT source-list files and run apt update.
# apt -f install
# dpkg --configure --pending
In extreme cases you might have to force re-installation with a command like
You can try to solve a file conflict by forcibly removing the package mentioned
on the last line of the error message:
After fixing things up, you should be able to resume the upgrade by repeating
the previously described apt commands.
If you're not sure what to do, write down the name of the package or file and sort
things out at a later time. You can search in the typescript file to review the
information that was on the screen during the upgrade.
To recover the console where the upgrade was running you will have to use
Ctrl+Alt+F1 (if in the graphical startup screen) or Alt+F1 (if in the local text-
mode console) to switch back to the virtual terminal 1. Replace F1 with the
function key with the same number as the virtual terminal the upgrade was
running in. You can also use Alt+Left Arrow or Alt+Right Arrow to switch
between the different text-mode terminals.
Note that a lot of information in this section is based on the assumption that you
will be using one of the modular Debian kernels, together with initramfs-
tools and udev. If you choose to use a custom kernel that does not require an
initrd or if you use a different initrd generator, some of the information may not
be relevant for you.
If you do not see any output, then you will either need to install a new linux-
image package by hand or install a linux-image metapackage. To see a list of
available linux-image metapackages, run:
# apt-cache search linux-image- | grep -i meta | grep -v
transition
If you are unsure about which package to select, run uname -r and look for a
package with a similar name. For example, if you see “4.9.0-8-amd64”, it is
recommended that you install linux-image-amd64. You may also use apt to
see a long description of each package in order to help choose the best one
available. For example:
You should then use apt install to install it. Once this new kernel is installed
you should reboot at the next available opportunity to get the benefits provided
by the new kernel version. However, please have a look at Section 5.1.24,
“Things to do post upgrade before rebooting” before performing the first reboot
after the upgrade.
For the more adventurous there is an easy way to compile your own custom
kernel on Debian. Install the kernel sources, provided in the linux-source
package. You can make use of the deb-pkg target available in the sources'
makefile for building a binary package. More information can be found in the
Debian Linux Kernel Handbook, which can also be found as the debian-
kernel-handbook package.
Caution
Purging a package will generally also purge its log files, so you might
want to back them up first.
The following command displays a list of all removed packages that may have
configuration files left on the system (if any):
The packages can be removed by using apt purge. Assuming you want to
purge all of them in one go, you can use the following command:
If you use aptitude, you can also use the following alternative to the
commands above:
There are many reasons why packages might have been removed from the
distribution: they are no longer maintained upstream; there is no longer a
Debian Developer interested in maintaining the packages; the functionality they
provide has been superseded by different software (or a new version); or they
are no longer considered suitable for bullseye due to bugs in them. In the latter
case, packages might still be present in the “unstable” distribution.
For a list of obsolete packages for Bullseye, please refer to Section 5.3.1,
“Noteworthy obsolete packages”.
The package descriptions for transitional dummy packages usually indicate their
purpose. However, they are not uniform; in particular, some “dummy” packages
are designed to be kept installed, in order to pull in a full software suite, or track
the current latest version of some program. You might also find deborphan with
the --guess-* options (e.g. --guess-dummy) useful to detect transitional
dummy packages on your system.
[1] If
the debconf priority is set to a very high level you might prevent
configuration prompts, but services that rely on default answers that are not
applicable to your system will fail to start.
[3] This
feature can be disabled by adding the parameter panic=0 to your boot
parameters.
[4] Debian's package management system normally does not allow a package to
remove or replace a file owned by another package unless it has been defined
to replace that package.
[5] Orfor as long as there is not another release in that time frame. Typically only
two stable releases are supported at any given time.
Chapter 3. Installation System Chapter 5. Issues to be aware of
for bullseye