inaabi / Guides / APT sources on Debian 12 and 13
APT sources on Debian 12 and 13
Write the Debian 12 or 13 apt source file, including security updates and non-free firmware, then put the old file back.
Tested on Debian 12.15 and Debian 13.8, 2026-12-04.
A copied sources.list from an old example often has no security suite, and it often skips non-free-firmware. Debian 12 and 13 read /etc/apt/sources.list.d/debian.sources. The images tested on 2026-12-04 already had that file and no /etc/apt/sources.list.
The file below is the one in the trixie release notes, chapter 4, with bookworm suite names on Debian 12. The SourcesList wiki page describes the same format. apt-get update exited 0 after this file was written on both releases.
The test ran as root in a throwaway container. On a machine where you are not root, run the same commands with sudo.
Install certificates before https
https:// needs the ca-certificates package. A slim image does not have it. Install it from the source file that is already working, then switch.
apt-get update
apt-get install -y --no-install-recommends ca-certificates
On Debian 12.15 that install exited 0 and pulled openssl and libssl3 from bookworm-security. On Debian 13.8 it exited 0 and upgraded libssl3t64 and openssl from trixie-security. The signature check is the Signed-By line, not the https://. An http:// URI to deb.debian.org is still Debian. The images shipped http:// and that update also exited 0.
Write the Debian 12 file
Bookworm's archive label on this date is oldstable, not stable. Copy the current file aside first.
cp -a /etc/apt/sources.list.d/debian.sources /etc/apt/sources.list.d/debian.sources.off
cat > /etc/apt/sources.list.d/debian.sources << 'EOF'
Types: deb
URIs: https://deb.debian.org/debian
Suites: bookworm bookworm-updates
Components: main non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
URIs: https://security.debian.org/debian-security
Suites: bookworm-security
Components: main non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOF
apt-get update
apt-get update exited 0. apt-cache policy listed bookworm and bookworm non-free-firmware at priority 500, archive oldstable, version 12.15; bookworm-updates as oldstable-updates; bookworm-security as oldstable-security, origin security.debian.org.
Leave contrib and non-free off unless you already need a package from them. They were not enabled in this test. non-free-firmware is the component many network cards need. The container did not install a firmware package. Adding the component only made the index download succeed.
Debian 12's apt is 2.6.2. apt modernize-sources is not a command there. The run printed E: Invalid operation modernize-sources and left the files unchanged.
Write the Debian 13 file
The 13.8 image's own file used http://deb.debian.org/debian-security and Signed-By: /usr/share/keyrings/debian-archive-keyring.pgp. apt-get update against that file exited 0.
The replacement below uses the release-notes URLs and .gpg. apt-get update exited 0 on that file too. apt-cache policy then showed trixie and trixie non-free-firmware at priority 500, archive stable, version 13.8; trixie-updates as stable-updates; trixie-security as stable-security, origin security.debian.org.
cp -a /etc/apt/sources.list.d/debian.sources /etc/apt/sources.list.d/debian.sources.off
cat > /etc/apt/sources.list.d/debian.sources << 'EOF'
Types: deb
URIs: https://deb.debian.org/debian
Suites: trixie trixie-updates
Components: main non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
URIs: https://security.debian.org/debian-security
Suites: trixie-security
Components: main non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOF
apt-get update
Apt 3.0.4 can rewrite a one-line file. This converted example-oneline.list to example-oneline.sources, kept example-oneline.list.bak, and set Signed-By to the .gpg keyring. The exit code was 0.
apt modernize-sources --assume-yes
Do not run that command on Debian 12. Apt 2.6.2 rejects it.
Check the suites
apt-cache policy
Debian 12 should show n=bookworm, n=bookworm-updates, and n=bookworm-security, each at 500. Debian 13 should show n=trixie, n=trixie-updates, and n=trixie-security, each at 500. A suite that is missing is not being read.
A signature error names the Signed-By file. A 404 on a suite means that suite is not on that URI. bookworm-security and trixie-security are on security.debian.org (the images also updated deb.debian.org/debian-security). They are not suites of https://deb.debian.org/debian.
Put the old file back
Tested on Debian 12.15 and Debian 13.8. After the new file was removed and the saved file was restored, apt-get update exited 0.
rm -f /etc/apt/sources.list.d/debian.sources
mv /etc/apt/sources.list.d/debian.sources.off /etc/apt/sources.list.d/debian.sources
apt-get update
Questions
Does a pin on "stable" match Debian 12?
No. On 2026-12-04, apt-cache policy labeled bookworm oldstable and trixie stable. A pin of release a=stable matches Debian 13, not Debian 12. See Pin a package on Debian.
Where do backports go?
In a second file, not in this one. See Install one package from Debian backports.