29.2. Preparing an Upgrade to Debian 13
Preparation turns a host into a known starting point. The release notes define what the new release changes; routine updates bring the old release to its latest point release; holds, pins, and third-party sources are reviewed; free space and backups are verified; and the application and restore procedure are tested before the production root filesystem is touched.
29.2.1. Reading Release Notes and Architecture-Specific Changes
The Debian release notes are the primary source for an upgrade. Read the sections on preparing for the upgrade, upgrading the system, possible issues during the upgrade, things to do before rebooting, obsolete packages, and the architecture-specific chapter. The notes name packages that need special handling, configuration files that change format, services that must be stopped, and known problems that have no general fix. They also state the supported upgrade path; skipping a release is not supported.
For Debian 13, the architecture-specific chapters matter even on amd64. ARM
systems have bootloader and firmware differences, 32-bit architectures carry
the 64-bit time_t transition, and non-x86 systems may use a different
initramfs or console path. A procedure copied from an amd64 virtual machine does
not prove that an ARM board will boot. Check the installed architecture with
dpkg --print-architecture before choosing bootloader or firmware steps; the
lab hosts in this chapter are amd64, as their kernel names show.
Read the notes on the machine that will be upgraded, or download them to the
workspace and read them there. Do not rely on a summary from a blog post for a
package transition or a bootloader requirement; the release notes are versioned
with the release and name the exact packages. The Debian wiki and the
debian-user mailing list are useful for experience reports, but a report about
a different architecture, bootloader, or third-party repository is not evidence
about this host.
The release notes also define the supported upgrade commands. For Debian 13 the sequence is a first upgrade that avoids installing new packages, followed by a full upgrade that permits new packages and removals. The two-stage sequence exists because a single full upgrade can remove packages that the old running system still needs, including the package manager's own dependencies. The exact commands appear in Section 29.3.3.
29.2.2. Bringing Debian 12 to a Supported Upgrade Starting Point
The old release must be fully updated before the sources change. An upgrade
from a half-updated Debian 12 to Debian 13 combines two kinds of change and
makes failures harder to attribute. The procedure is the same whatever the
release; only the suite names differ, so this section demonstrates it on the
lab's life1 host, which the inventory found one point release behind. On a
Debian 12 host the same commands print bookworm, bookworm-updates, and
bookworm-security where these captures print the trixie names.
On life1, as john, refresh the indexes:
$ sudo apt-get update
Hit:1 https://security.debian.org/debian-security trixie-security InRelease
Hit:2 https://deb.debian.org/debian trixie InRelease
Hit:3 https://deb.debian.org/debian trixie-updates InRelease
Hit:4 https://deb.debian.org/debian trixie-backports InRelease
Reading package lists...
Every entry is a Hit, meaning the index is unchanged since the last refresh;
after a suite change the same command prints Get lines for the new archive.
List what is pending, bounding the listing for readability:
$ apt list --upgradable | head -8
Listing...
base-files/stable 13.8+deb13u8 amd64 [upgradable from: 13.8+deb13u5]
bash/stable 5.2.37-2+b10 amd64 [upgradable from: 5.2.37-2+b9]
bind9-dnsutils/stable,stable-security 1:9.20.30-1~deb13u1 amd64 [upgradable from: 1:9.20.21-1~deb13u1]
bind9-host/stable,stable-security 1:9.20.30-1~deb13u1 amd64 [upgradable from: 1:9.20.21-1~deb13u1]
bind9-libs/stable,stable-security 1:9.20.30-1~deb13u1 amd64 [upgradable from: 1:9.20.21-1~deb13u1]
bsdextrautils/stable,stable-security 2.41.5-0+deb13u1 amd64 [upgradable from: 2.41-5]
bsdutils/stable,stable-security 1:2.41.5-0+deb13u1 amd64 [upgradable from: 1:2.41-5]
Selected output; the full list is longer. apt list also prints its
"does not have a stable CLI interface" warning on standard error, which
Chapter 6 explains - it is a notice, not an error.
The versions show the point release at work: base-files moves from
13.8+deb13u5 to 13.8+deb13u8, and the bind9 updates arrive from the
security archive.
Review the plan, then apply it with a full upgrade. A plain apt-get upgrade
would keep the new kernel back, because installing it requires a new package:
$ sudo apt-get dist-upgrade
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following NEW packages will be installed:
linux-image-6.12.118+deb13-amd64
The following packages will be upgraded:
base-files bash bind9-dnsutils bind9-host bind9-libs bsdextrautils bsdutils
chrony dhcpcd-base e2fsprogs fdisk grub-common grub-pc grub-pc-bin
grub2-common krb5-locales libaudit-common libaudit1 libblkid1 libbrotli1
libcap2 libcap2-bin libcom-err2 libefiboot1t64 libefivar1t64 libexpat1
libext2fs2t64 libfdisk1 libfreetype6 libglib2.0-0t64 libgnutls30t64
libgssapi-krb5-2 libk5crypto3 libkrb5-3 libkrb5support0 liblastlog2-2
libmount1 libnghttp2-14 libpcre2-8-0 libperl5.40 libpng16-16t64
libpython3.13-minimal libpython3.13-stdlib libsmartcols1 libsqlite3-0 libss2
libtasn1-6 libuuid1 libxml2 linux-image-amd64 login logsave mount perl
perl-base perl-modules-5.40 python3-idna python3-urllib3 python3.13
python3.13-minimal qemu-utils rsyslog sudo tzdata util-linux
util-linux-extra vim-common vim-tiny zlib1g
69 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 149 MB of archives.
After this operation, 112 MB of additional disk space will be used.
Selected output; apt then prints the download and unpack progress. Read the
package list before confirming: this upgrade touches the boot loader, login,
sudo, and the C library's supporting packages, and it installs a new kernel
alongside the running one. The kernel setup and boot loader refresh happen at
the end of the same command; this excerpt shows those final stages:
Setting up linux-image-6.12.118+deb13-amd64 (6.12.118-1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.12.118+deb13-amd64
W: No zstd in /usr/bin:/sbin:/bin, using gzip
/etc/kernel/postinst.d/zz-update-grub:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.12.118+deb13-amd64
Found initrd image: /boot/initrd.img-6.12.118+deb13-amd64
Found linux image: /boot/vmlinuz-6.12.86+deb13-amd64
Found initrd image: /boot/initrd.img-6.12.86+deb13-amd64
The kernel package generates a new initramfs and refreshes the GRUB configuration; both the new 6.12.118 kernel and the previous 6.12.86 kernel appear in the boot menu, so a fallback remains selectable if the new kernel fails. Chapter 7 covers kernel metapackages and fallback entries.
Before rebooting, confirm that the package database is consistent with
dpkg --audit: the command prints nothing when no package is half-configured,
and Section 29.5.1 shows what a nonempty report looks like and how to repair
it. Then reboot, because the running kernel is still the old one:
$ sudo systemctl reboot
The command disconnects the session without further output. Reconnect through the management network, not through a service address that may still be coming up, and check which kernel is now running:
$ uname -r
6.12.118+deb13-amd64
The kernel changed from 6.12.86 to 6.12.118, which is the evidence that the reboot completed the point release. Confirm that the services that must return did so:
$ systemctl is-active nginx ssh
active
active
Two active lines confirm that the web server and the SSH daemon are running.
They do not confirm that the web server serves the right content or that SSH
accepts the intended users; Section 29.4 tests those separately. A Debian 12
host that has gone through this sequence is at its final point release - the
starting point the release notes assume - and is ready for the source change in
Section 29.3.2.
29.2.3. Removing Obsolete Packages and Reviewing Holds and Pinning
Holds and APT pins are deliberate constraints. They are useful for a database that must stay on a tested version, but they can defeat a release upgrade when they keep an old library in place. The chapter's hold and pin exercises use a practice package from a small local repository, so the effects are visible without risking a real service package. Build that repository once, in john's workspace.
The practice package is deliberately trivial. Its control file names the
package, a small script prints the version, and a post-installation script
records application state the first time the package is configured. The 2.0
tree's DEBIAN/control:
Package: handbook-agent
Version: 2.0
Section: admin
Priority: optional
Architecture: all
Maintainer: Handbook Lab <lab@example.test>
Description: Practice package for lifecycle repository exercises
This package is used only in the Debian handbook lifecycle lab.
#!/bin/sh
set -eu
install -d -m 0755 /var/lib/handbook-agent
if [ ! -e /var/lib/handbook-agent/state ]; then
printf 'schema=2\ninstalled_release=2.0\n' >/var/lib/handbook-agent/state
fi
The DEBIAN/postinst script above runs when the package is configured and
writes the state file only when none exists. Both versions use the same tree
layout - DEBIAN/control, DEBIAN/postinst, and usr/bin/handbook-agent,
assembled under packages/handbook-agent-1.0/ and
packages/handbook-agent-2.0/ - with the version substituted in each file:
the 1.0 tree prints handbook-agent 1.0 and records installed_release=1.0,
and the 2.0 tree uses 2.0 in the same places. Keep this state file in mind:
Section 29.5.3 uses it to show why a package downgrade is not a system
rollback. Then create a signing key for the repository:
$ gpg --batch --passphrase '' --quick-generate-key 'Handbook Repository <repo@example.test>' rsa2048 sign 1y
gpg: directory '/home/john/.gnupg' created
gpg: keybox '/home/john/.gnupg/pubring.kbx' created
gpg: /home/john/.gnupg/trustdb.gpg: trustdb created
gpg: directory '/home/john/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/home/john/.gnupg/openpgp-revocs.d/67B29A09490D7D4F42C7729EF5413BACD660A126.rev'
The key is throwaway lab material with a one-year lifetime; a production repository key has a custody plan instead. Build the package archives:
$ dpkg-deb --build --root-owner-group packages/handbook-agent-1.0 repo/handbook-agent_1.0.deb
dpkg-deb: building package 'handbook-agent' in 'repo/handbook-agent_1.0.deb'.
The same command builds the remaining practice packages - the 2.0 archive, and
the three deliberately broken ones used in Section 29.5 - each printing a
single dpkg-deb: building package ... line. Generate the package index. The
redirection writes the index to a file rather than the terminal:
$ cd repo && dpkg-scanpackages --multiversion . /dev/null > Packages
dpkg-scanpackages: warning: Packages in archive but missing from override file:
dpkg-scanpackages: warning: handbook-agent handbook-broken handbook-conflict handbook-missing-dep
dpkg-scanpackages: info: Wrote 5 entries to output Packages file.
The warnings say that no override file classifies the packages; an override is
optional for a repository this small. --multiversion keeps both versions of
handbook-agent in the index, which is what makes the version choice below
visible. The remaining publishing steps are silent, and each writes a file:
gzip -kf Packages compresses the index, apt-ftparchive release . > Release
describes the archive, gpg --batch --yes --clearsign -o InRelease Release
signs the description in place, gpg --batch --yes --armor --detach-sign -o
Release.gpg Release adds the detached signature, and gpg --batch --yes
--export > handbook-repo.gpg exports the public key as the client keyring.
Chapter 6 covers repository signing and the
signed-by mechanism in depth.
Publish the tree under /srv/handbook-repo with root ownership and
world-readable files, install the keyring as /etc/apt/keyrings/handbook-repo.gpg,
and add the source entry in /etc/apt/sources.list.d/handbook.list on life1:
deb [signed-by=/etc/apt/keyrings/handbook-repo.gpg] file:/srv/handbook-repo ./
The signed-by field scopes this key to this one source; the key is not
trusted for any other repository. Refresh the indexes and watch the repository
appear:
$ sudo apt-get update
Get:1 file:/srv/handbook-repo ./ InRelease [1741 B]
Get:1 file:/srv/handbook-repo ./ InRelease [1741 B]
Hit:2 https://deb.debian.org/debian trixie InRelease
Get:3 file:/srv/handbook-repo ./ Packages [932 B]
Hit:4 https://deb.debian.org/debian trixie-updates InRelease
Hit:5 https://deb.debian.org/debian trixie-backports InRelease
Hit:6 https://security.debian.org/debian-security trixie-security InRelease
Reading package lists...
The file: transport fetches the signed InRelease and the package index
alongside the Debian archives. Ask APT what the repository offers:
$ apt-cache policy handbook-agent
handbook-agent:
Installed: (none)
Candidate: 2.0
Version table:
2.0 500
500 file:/srv/handbook-repo ./ Packages
1.0 500
500 file:/srv/handbook-repo ./ Packages
Both versions are visible and 2.0 is the candidate. Install the older version explicitly, because the candidate selection would otherwise choose 2.0:
$ sudo apt-get install handbook-agent=1.0
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
handbook-agent
0 upgraded, 1 newly installed, 0 to remove and 69 not upgraded.
Selecting previously unselected package handbook-agent.
Unpacking handbook-agent (1.0) ...
Setting up handbook-agent (1.0) ...
Selected output; the archive is local so nothing is downloaded, and the
database-progress lines are omitted. The trailing =1.0 is the version
selection. The package's own command confirms what is installed:
$ handbook-agent
handbook-agent 1.0
Now the hold exercise. A hold prevents APT from upgrading or removing the package:
$ sudo apt-mark hold handbook-agent
handbook-agent set on hold.
The hold is visible in the inventory:
$ apt-mark showhold
handbook-agent
And it is canceled when the constraint is no longer needed:
$ sudo apt-mark unhold handbook-agent
Canceled hold on handbook-agent.
apt-mark changes the package selection state; it does not remove the package
or change its version. The options used here are:
| Option | Description |
|---|---|
hold |
Prevent apt from automatically upgrading or removing the package. |
unhold |
Remove the hold and allow normal candidate selection again. |
showhold |
Print the names of held packages, one per line. |
showauto |
Print packages marked as automatically installed. |
manual |
Mark a package as manually installed so autoremove keeps it. |
An APT preference is a stronger and more specific mechanism. It assigns a priority to a package or a version and influences which candidate apt selects. A local preference file for the practice package looks like this:
Package: handbook-agent
Pin: version 1.0
Pin-Priority: 1001
The file is installed as /etc/apt/preferences.d/handbook.pref and read by APT
on the next policy calculation. With the file in place, the installed 1.0
remains the candidate even though the repository also offers 2.0:
$ apt-cache policy handbook-agent
handbook-agent:
Installed: 1.0
Candidate: 1.0
Version table:
2.0 500
500 file:/srv/handbook-repo ./ Packages
*** 1.0 1001
500 file:/srv/handbook-repo ./ Packages
100 /var/lib/dpkg/status
The *** marks the selected candidate and 1001 is the pin priority. A
priority above 1000 allows a downgrade to the pinned version; a normal archive
has priority 500, and the installed package has priority 100. Remove the pin
file when the review is finished - before a release upgrade, no pin should
remain unless it is part of a documented compatibility requirement. A pin that
keeps an old library while the rest of the system moves to a new C library or a
new package name is a dependency conflict waiting to happen.
Obsolete packages are the third part of the review. They fall into three
groups: packages that are no longer in the new release, locally built packages
that depend on old libraries, and packages that were installed as dependencies
and are no longer needed. The first group is identified by the release notes and
by apt-get --purge autoremove after the upgrade; the second must be rebuilt or
replaced before the old library is removed. The third is safe to remove only
after checking that no local service depends on it. A package that is
"automatically installed" may still be required by an application that was
started outside the package system; Chapter 6
explains how to mark it manual with apt-mark manual before autoremove takes
it.
29.2.4. Checking Free Space, Backups, and Recovery Access
A release upgrade downloads new package archives, unpacks them beside the old files, and keeps configuration backups. The root filesystem needs room for the new package set and for the package cache until the operation completes. The point-release upgrade in Section 29.2.2 needed 149 MB of archives and 112 MB of installed files; a release upgrade needs more. Check both block space and inode space again at this point:
$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 98G 2.0G 91G 3% /
Inode capacity is a separate limit:
$ df -i /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/vda1 6553600 86018 6467582 2% /
The inode count has grown slightly since the inventory in Section 29.1.2
because the practice packages and repository files were created in between. On
a small cloud instance, a release upgrade can need several hundred megabytes to
a few gigabytes, depending on the installed package set and whether the old
kernels are retained. A filesystem with 95 percent of its blocks used may still
have free inodes, and a filesystem with plenty of blocks may run out of inodes
because of many small files. Both checks belong in the preparation record. Also
check the separate /boot partition if the system has one; kernel and initramfs
packages are installed there, and a full /boot can leave the new kernel
unpacked but not bootable.
The backup must be independent of the host being upgraded. A copy on the same root filesystem does not survive a failed upgrade or a filesystem repair. The practice service uses a small archive script that captures the nginx site, the service data, and the TLS directory when one exists, writes a SHA256 manifest, and leaves both files in john's workspace:
#!/bin/sh
set -eu
stamp=$(date -u +%Y%m%dT%H%M%SZ)
dest=/home/john/debian-handbook/lifecycle/backups
metrics=/var/lib/prometheus/node-exporter/lifecycle_backup.prom
archive="$dest/lifecycle-$stamp.tar.gz"
manifest="$dest/lifecycle-$stamp.sha256"
install -d -m 0750 -o john -g john "$dest"
set -- etc/nginx/sites-available/lifecycle.conf srv/lifecycle
if [ -d /etc/ssl/lifecycle ]; then
set -- "$@" etc/ssl/lifecycle
fi
tar -C / -czf "$archive" "$@"
(cd "$dest" && sha256sum "$(basename "$archive")" >"$(basename "$manifest")")
chown john:john "$archive" "$manifest"
ln -sfn "$archive" "$dest/latest.tar.gz"
ln -sfn "$manifest" "$dest/latest.sha256"
size=$(stat -c %s "$archive")
if [ -d "$(dirname "$metrics")" ]; then
cat >"$metrics" <<METRICS
# HELP lifecycle_backup_last_success_timestamp_seconds Unix time of the last completed backup.
# TYPE lifecycle_backup_last_success_timestamp_seconds gauge
lifecycle_backup_last_success_timestamp_seconds $(date +%s)
# HELP lifecycle_backup_size_bytes Size of the last completed backup archive.
# TYPE lifecycle_backup_size_bytes gauge
lifecycle_backup_size_bytes $size
METRICS
fi
The set -- lines rebuild the positional parameters so that the TLS directory
joins the archive only when it exists - life1's legacy service has none, while
the managed host in Section 29.7 does. The tar -C / with relative paths
records the data under its real system paths, so a restore recreates
etc/nginx/... and srv/lifecycle/... below any staging directory. The
subshell writes the manifest with the archive's bare name, so the pair can be
verified with sha256sum -c in any directory that holds both files. The
metric block at the end is written only when the node exporter's directory
exists; a host without the exporter simply skips it. The unit that runs the
script is a oneshot with an alert hook:
[Unit]
Description=Back up the lifecycle service configuration and data
OnFailure=lifecycle-alert.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/lifecycle-backup
PrivateTmp=yes
ProtectSystem=strict
ProtectHome=read-only
ReadWritePaths=/home/john/debian-handbook/lifecycle/backups
ReadWritePaths=-/var/lib/prometheus/node-exporter
ProtectSystem=strict makes the filesystem read-only for the service except
the two ReadWritePaths; the - prefix on the second entry makes it optional.
The daily timer that schedules the backup, and the alert unit named by
OnFailure, are:
[Unit]
Description=Run the lifecycle backup every day
[Timer]
OnCalendar=*-*-* 02:30:00
Persistent=true
[Install]
WantedBy=timers.target
[Unit]
Description=Record a lifecycle alert in the journal
[Service]
Type=oneshot
ExecStart=/usr/bin/logger -t lifecycle-alert-lifecycle-check "lifecycle check unit failed"
Chapter 8 covers unit sandboxing and OnFailure
chains. Install the script as /usr/local/bin/lifecycle-backup and the units
into /etc/systemd/system on life1, run sudo systemctl daemon-reload, and
prepare the destination directory:
$ sudo install -d -m 0750 -o john -g john /home/john/debian-handbook/lifecycle/backups
The command prints nothing on success. Run one backup before the upgrade:
$ sudo systemctl start lifecycle-backup.service
The service is a oneshot unit, so a successful start returns after the script finishes and the unit becomes inactive. Check the result:
$ sudo systemctl status lifecycle-backup.service --no-pager | head -6
○ lifecycle-backup.service - Back up the lifecycle service configuration and data
Loaded: loaded (/etc/systemd/system/lifecycle-backup.service; static)
Active: inactive (dead)
Nov 24 08:49:38 trixie systemd[1]: Starting lifecycle-backup.service - Back up the lifecycle service configuration and data...
Nov 24 08:49:39 trixie systemd[1]: lifecycle-backup.service: Deactivated successfully.
The journal prefix is the system hostname - the first lab guest kept its
image's default name, trixie, while the second is called life2; the host
names in the chapter's table are the network identities. The Deactivated
successfully line is the useful part: a oneshot unit that ends inactive
(dead) after a clean start has completed its work. The archive and its
manifest are in john's workspace:
$ ls -l ~/debian-handbook/lifecycle/backups
total 16
lrwxrwxrwx 1 root root 78 Nov 24 08:49 latest.sha256 -> /home/john/debian-handbook/lifecycle/backups/lifecycle-20261124T084938Z.sha256
lrwxrwxrwx 1 root root 78 Nov 24 08:49 latest.tar.gz -> /home/john/debian-handbook/lifecycle/backups/lifecycle-20261124T084938Z.tar.gz
-rw-r--r-- 1 john john 100 Nov 24 08:49 lifecycle-20261124T084938Z.sha256
-rw-r--r-- 1 john john 558 Nov 24 08:49 lifecycle-20261124T084938Z.tar.gz
The symlinks are owned by root because the service ran as root; the archives themselves are chowned to john by the script. The manifest names the archive and records its checksum:
$ cat ~/debian-handbook/lifecycle/backups/latest.sha256
11244c8b83cca8767670acd585615c38fcc9e76a3a71eaf84302ebbe2914cf17 lifecycle-20261124T084938Z.tar.gz
The archive is small because the practice service on life1 has only a site
configuration, an index page, and one data file; the managed host's backup in
Section 29.7 also contains its TLS directory. A production backup is larger
and must be copied to another host or object store; the transfer in
Section 29.2.5 does that. The important properties are the same: a timestamped
archive, a checksum that names the archive, a retention policy, and a restore
procedure that has been run. The latest.tar.gz and latest.sha256 symlinks
are conveniences for the check script; they are not a substitute for keeping
dated archives.
Recovery access is the third prerequisite. Keep an SSH session open on the management network, and arrange a console, a virtual machine console, or an out-of-band management path before rebooting. A remote upgrade that depends on the same network interface and the same SSH daemon it is upgrading has no recovery path if either fails. The management interface on these examples is separate from the lab link, so an error in the service configuration does not remove administrative access.
29.2.5. Testing Application Compatibility and Restore Procedures
An upgrade plan is a hypothesis until the application and the restore path have been tested. The test does not need a full copy of production data; it needs the same package versions, the same configuration format, and a representative sample of the data. On life1, the legacy service is replaced by a versioned deployment on life2. Before the release upgrade, the backup is transferred to the replacement host and verified there.
The transfer uses SSH with host-key verification, following Chapter 20. Obtain the server's fingerprint from a trusted server-side session - on life2, in a root shell:
# ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
256 SHA256:arNuNEbnLeV75SQx/SegQu3eZZyFn5MSBJkQdwNZ3qw root@trixie (ED25519)
The root@trixie suffix is only the comment recorded when the key was
generated; the fingerprint itself is what matters. On life1, as john, the first
connection to life2 presents this fingerprint and asks for confirmation; after
you confirm, the entry is stored in ~/.ssh/known_hosts. Verify that the
stored entry matches the trusted value:
$ ssh-keygen -F 192.168.229.20 -l
# Host 192.168.229.20 found: line 1
192.168.229.20 ED25519 SHA256:arNuNEbnLeV75SQx/SegQu3eZZyFn5MSBJkQdwNZ3qw root@trixie
The two strings match, so the host identity is established. Then log in normally:
$ ssh john@192.168.229.20 'id; hostname'
uid=1001(john) gid=1001(john) groups=1001(john)
life2
The remote command prints the numeric identity and the target's host name, and
the SSH session ends when it returns; an interactive login would be left with
exit. The host key authenticates the server, not the user; john's access
still depends on the authorized key or password configured for that account.
If a key ever changes, do not delete the warning or disable host checking.
Obtain the new fingerprint through the console or another trusted channel,
compare it, and only then remove the old entry with ssh-keygen -R
192.168.229.20 and reconnect.
Copy the backup and its manifest to the replacement host:
$ scp ~/debian-handbook/lifecycle/backups/lifecycle-20261124T084938Z.tar.gz ~/debian-handbook/lifecycle/backups/lifecycle-20261124T084938Z.sha256 john@192.168.229.20:~/debian-handbook/lifecycle/
The transfer prints progress only when it has a terminal; a scripted noninteractive copy prints nothing on success. On life2, in a root shell, verify the archive before extracting it:
# cd /home/john/debian-handbook/lifecycle && sha256sum -c lifecycle-20261124T084938Z.sha256
lifecycle-20261124T084938Z.tar.gz: OK
Then extract into a staging directory, not over the live service:
# install -d /srv/restore-check && tar -C /srv/restore-check -xzf /home/john/debian-handbook/lifecycle/lifecycle-20261124T084938Z.tar.gz
The extraction is silent. Test the restored file independently:
# sha256sum /srv/restore-check/srv/lifecycle/data/records.csv
8dbcedf0d39a9a4303768a1f0843e975d28b8451263cb5f2355dfb4a48a8f2d0 /srv/restore-check/srv/lifecycle/data/records.csv
The checksum matches the source file on life1:
$ sha256sum app/records.csv
8dbcedf0d39a9a4303768a1f0843e975d28b8451263cb5f2355dfb4a48a8f2d0 app/records.csv
That comparison proves that the archive contains the expected data and that the restore produced the same bytes. It does not prove that the application can use the restored data; start the application against the staging copy or run its validation command. The same rule applies to a database: a checksum of the dump is not a restore test. Restore the dump into a disposable instance, run the application's consistency check, and record the result. Section 29.7.4 completes this drill by installing the restored data into the replacement's live path.
Application compatibility testing should cover the language runtime, database
driver, web server modules, and any local package that links against a library
that the new release renames. Debian 13's time-based library transitions are
visible in the package names: libdb5.3 becomes libdb5.3t64,
libext2fs2 becomes libext2fs2t64, and similar t64 packages replace their
predecessors. The suffix marks the 64-bit time_t transition: on 32-bit
architectures it changes the ABI, and on already-64-bit architectures such as
amd64 the renames keep dependency naming coherent across architectures. An
application installed from a .deb built for Debian 12 may still run, but it
must be tested, and a locally built one must be rebuilt for the new library
names. The package manager cannot infer that a local binary is compatible with
a renamed library.
An Ansible --check run is a useful compatibility and configuration test
because it reads the target's package manager and service state without changing
it. On life1, as john, enter the playbook directory and run the check:
$ cd ~/debian-handbook/lifecycle/ansible
The working directory is now the Ansible tree. Run the check:
$ ansible-playbook --check --diff site.yml
PLAY [Deploy the lifecycle practice service] ***********************************
TASK [Gathering Facts] *********************************************************
ok: [life2]
TASK [lifecycle_service : Install the web server, metrics exporter, and tools] ***
ok: [life2]
TASK [lifecycle_service : Create the service directories] **********************
--- before
+++ after
@@ -1,4 +1,4 @@
{
"path": "/srv/lifecycle",
- "state": "absent"
+ "state": "directory"
}
changed: [life2] => (item=/srv/lifecycle)
[...]
PLAY RECAP *********************************************************************
life2 : ok=15 changed=8 unreachable=0 failed=0 skipped=4 rescued=0 ignored=0
Selected output; the [...] marks the omitted middle, and the recap is the
authoritative summary. The important result is that the playbook can reach the
host, gather facts, and evaluate the role against the current package state. A
check run that fails at fact gathering or at a package task is a compatibility
problem to resolve before the maintenance window, not a cosmetic warning. The
cd and the playbook invocation are separate commands because the second
depends on the first having succeeded.
The preparation phase ends with a written decision: upgrade in place, replace, or rebuild. The record names the release, the tested package set, the backup location and checksum, the restore result, the application test result, the maintenance window, the RTO and RPO, and the person who can authorize rollback. If any of those facts is missing, the upgrade is not prepared; it is merely scheduled.