How To

Debian sources.list: Official Repos for Debian 13 / 12 / 11

The Debian sources list tells apt which repositories to use. The classic one-line /etc/apt/sources.list works on Debian 13, 12 and 11, and the trixie release notes recommend replacing it with /etc/apt/sources.list.d/debian.sources in the deb822 format, which cloud and container images already ship. A complete setup needs three suites (the release, its -updates suite and -security) and the components your hardware needs. Copy the file for your release from the sections below and run sudo apt update.

Original content from computingforgeeks.com - post 20217

The guide gives complete files for trixie, bookworm and bullseye in both formats. It also covers the DVD-only install, deb-src, apt modernize-sources, backports and the bullseye-backports 404 that broke Debian 11 boxes after it moved to the archive. Every command below was run on Debian 13.8 and Debian 12.15 VMs and a Debian 11 container in November 2026.

Pick the file for your Debian release

Check which release you are on before you copy anything, because the codename in the file has to match the system. A trixie file on a bookworm box offers it the next release’s packages, and apt will happily start a half upgrade. You can read the point release with cat /etc/debian_version. The table maps it to the codename and the state of its repositories when we tested them.

ReleaseCodenameSupport statusFormat we useFirmware component
Debian 13trixieStable, full support until August 2028deb822 debian.sourcesnon-free-firmware
Debian 12bookwormOldstable, LTS until June 30, 2028deb822 or one-linenon-free-firmware
Debian 11bullseyeLTS ended August 31, 2026One-line sources.listnon-free (no non-free-firmware)

Debian 13 and 12 take the same file with the codename swapped. Debian 11 is different in two ways: it has no non-free-firmware component, and its backports suite is gone from the main mirror. The dates come from the release pages on debian.org, and the bullseye release page also lists the paid third-party support that runs until June 30, 2031.

Write debian.sources on Debian 13

Debian 13 reads repositories from .sources files in /etc/apt/sources.list.d/, though an installer-built system may still start with a one-line sources.list. Each repository is a block of named fields, so you can see the mirror, suites, components and signing key at a glance. We write every file with printf piped to tee, because a DVD or minimal install may not have an editor you like until the repositories work. If sudo is not installed, run su - first and drop sudo from each command.

Move any old one-line file out of the way first, so apt does not read the same repositories twice. The copy in /root lets you put it back if you need it.

sudo mv /etc/apt/sources.list /root/sources.list.old

The file uses HTTPS mirrors, which need the ca-certificates package. Our trixie and bookworm VMs both had it, and you can confirm yours in one line.

dpkg -l ca-certificates | tail -1

A line starting with ii means it’s installed. If you see un, or dpkg-query: no packages found matching ca-certificates, write http:// in the URIs lines, install ca-certificates, then run sudo sed -i 's#http://#https://#' /etc/apt/sources.list.d/debian.sources to switch back. That is safe because apt checks every index against the keyring in Signed-By, whatever the transport. Now write the file:

printf "%s\n" "Types: deb" "URIs: https://deb.debian.org/debian" "Suites: trixie trixie-updates" "Components: main contrib non-free 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 contrib non-free non-free-firmware" "Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg" | sudo tee /etc/apt/sources.list.d/debian.sources

The first block covers the main archive and trixie-updates, and the second covers security updates, which come from a separate host. The keyring ships with every install in the debian-archive-keyring package, so there is nothing for you to download. Refresh the index and confirm each suite answers.

sudo apt update

On our trixie VM, apt fetched an InRelease file from all three suites and pulled about 17 MB of package lists:

debian.sources deb822 file on Debian 13 trixie with apt update fetching from deb.debian.org and security.debian.org

Each suite gets its own line, so a typo in one codename fails only that block while the others succeed. If every line times out, the box probably sits behind a proxy, and apt needs the settings from the system-wide proxy guide for Debian before any of this works. Once the update is clean, upgrade the waiting packages and carry on with the post-install tasks for Debian 13.

If your VM came from a cloud image, look at its file before you replace it, because cloud images ship their own version. Our Google Cloud trixie VM came with these settings in debian.sources:

  • Types: deb deb-src
  • Components: main only
  • trixie-backports already in Suites
  • URIs: mirror+file:///etc/apt/mirrors/debian.list

The mirror file points at deb.debian.org, so the shipped setup works as it is. You only need to replace it when you want contrib, non-free or firmware packages on that VM.

Use the one-line sources.list format

The classic /etc/apt/sources.list still works on Debian 13 and 12, and it’s what most old guides and in-place upgrades leave behind. Each line holds the type, mirror, suite and components. Use one format or the other, never both, because two files describing the same suite produce the duplicate warnings covered further down. If you already have a debian.sources, move it aside with sudo mv /etc/apt/sources.list.d/debian.sources /root/ first, as we did on our 13 VM before writing the trixie version:

printf "%s\n" "deb https://deb.debian.org/debian trixie main contrib non-free non-free-firmware" "deb https://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware" "deb https://security.debian.org/debian-security trixie-security main contrib non-free non-free-firmware" | sudo tee /etc/apt/sources.list

For bookworm, only the codename changes. We ran this one on the Debian 12 VM after moving its debian.sources aside the same way.

printf "%s\n" "deb https://deb.debian.org/debian bookworm main contrib non-free non-free-firmware" "deb https://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware" "deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware" | sudo tee /etc/apt/sources.list

Run sudo apt-get update after either one. On the bookworm box all three suites came back as Hit lines, because the indexes were already cached from the deb822 file:

Hit:1 https://security.debian.org/debian-security bookworm-security InRelease
Hit:2 https://deb.debian.org/debian bookworm InRelease
Hit:3 https://deb.debian.org/debian bookworm-updates InRelease

apt-cache policy firmware-misc-nonfree still resolved from bookworm/non-free-firmware, so the one-line file gives exactly the same package set as the deb822 file. The one-line format is fine for a quick fix from a console. Any options such as a signing key go in square brackets on the line itself, which gets hard to read fast. On Debian 13 we’d convert it with apt modernize-sources, shown later.

Add the Debian 12 bookworm repositories

Bookworm reads the deb822 file too, and it’s what we’d use on any Debian 12 box you plan to upgrade later, since trixie’s apt is deprecating the one-line format. Move the existing files aside first, because an installer-built bookworm has a full one-line sources.list and keeping it next to the new file causes duplicate warnings. Ours also had a cloud debian.sources:

sudo mv /etc/apt/sources.list /root/sources.list.old
sudo mv /etc/apt/sources.list.d/debian.sources /root/debian.sources.cloud

Skip the second line if the file doesn’t exist on your box. Then write the bookworm file:

printf "%s\n" "Types: deb" "URIs: https://deb.debian.org/debian" "Suites: bookworm bookworm-updates" "Components: main contrib non-free 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 contrib non-free non-free-firmware" "Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg" | sudo tee /etc/apt/sources.list.d/debian.sources

After sudo apt update, the bookworm VM fetched all three suites over HTTPS with no certificate warnings, because its ca-certificates was already installed. The capture below was taken at the end of the test, so it also shows bookworm-backports (added in the backports section) and the converter error covered next:

Debian 12 bookworm debian.sources file and apt update output

Two things differ from trixie. Bookworm’s apt has no converter, so sudo apt modernize-sources answers E: Invalid operation modernize-sources and you write the file by hand as above. Bookworm is also in LTS now, which covers fewer architectures (i386, amd64, armhf, arm64 and ppc64el) until June 30, 2028. When you’re ready to move, the Debian 12 to 13 upgrade starts by swapping bookworm for trixie in this same file.

Fix the Debian 11 bullseye sources

Bullseye’s LTS period ended on August 31, 2026, and the free updates stopped with it. The paid Extended LTS from Freexian runs until June 2031, but it’s a commercial offering and not an official Debian project, so plan the upgrade rather than living on it. Until then, the box still needs a working file. Bullseye predates non-free-firmware, so firmware comes from non-free. We tested this in a debian:11 container as root, which is why the commands have no sudo:

printf "%s\n" "deb http://deb.debian.org/debian bullseye main contrib non-free" "deb http://deb.debian.org/debian bullseye-updates main contrib non-free" "deb http://security.debian.org/debian-security bullseye-security main contrib non-free" "deb http://archive.debian.org/debian bullseye-backports main contrib non-free" | tee /etc/apt/sources.list

Note the last line, and leave it out if you never used backports. Many bullseye files still point bullseye-backports at deb.debian.org, and that suite now returns 404 there. apt still refreshes the other suites, but it drops the broken one and exits with code 100, which breaks apt update && apt upgrade chains and update scripts, so automated boxes stop getting updates. We reproduced it with the old line and fixed it by pointing backports at the archive:

Debian 11 bullseye-backports 404 Not Found on deb.debian.org fixed by pointing it at archive.debian.org

The error to search for is the line apt prints before it stops:

E: The repository 'http://deb.debian.org/debian bullseye-backports Release' does not have a Release file.

In our November run, the main, updates and security suites still answered on the regular hosts, and only backports had moved. The archive already carries the other bullseye suites as well. If your main lines start returning 404 too, you can swap the host on each line the same way. After the fix, firmware-misc-nonfree resolved from bullseye/non-free and the backports kernel showed up next to the security kernel:

linux-image-amd64/bullseye-backports 6.1.90-1~bpo11+1 amd64
linux-image-amd64/oldoldstable-security 5.10.262-1 amd64
linux-image-amd64/oldoldstable 5.10.223-1 amd64

The archive copy of bullseye-backports is frozen, so treat it as a way to keep an existing backports kernel installable, not as a source of fixes. The real fix for a bullseye box is an upgrade to bookworm, and from there to trixie.

Enable the components you need

Components decide which licence classes apt can see. Leave one out and you get the same Unable to locate package error as a missing repository, which sends you hunting for a mirror problem that is not there. We enable all four on desktops and on servers with real hardware:

  • main: free software, the Debian archive proper
  • contrib: free packages that depend on non-free ones
  • non-free: non-free tools such as unrar
  • non-free-firmware: firmware and CPU microcode (Debian 12 and later)

To confirm a component is live, ask apt where it would install a package from it. Each package you query should show a candidate version and a 500 line naming its component.

apt-cache policy firmware-misc-nonfree unrar intel-microcode | grep -E "^[a-z]|Candidate|500 "

On trixie, firmware and microcode came from non-free-firmware and unrar from non-free. The microcode package also shows a security line, because microcode fixes ship through the security suite:

apt-cache policy showing firmware-misc-nonfree, unrar and intel-microcode from non-free-firmware and non-free on Debian 13

Candidate: (none) means the component carrying that package is missing from your file. A VM that never loads firmware can run on main alone, which is how the Google Cloud images ship. On bare metal, keep non-free-firmware in both blocks so Wi-Fi, GPU and microcode updates arrive with everything else.

Fix a DVD-only install

Install Debian from a DVD or a virtual CD drive without picking a network mirror and the installer leaves exactly one repository: the disc. Every update then stops on the cdrom line, and anything that is not on the DVD fails to install. A USB stick install behaves differently, because the trixie installer comments the cdrom line out, so you only see Unable to locate package. We rebuilt that state on the trixie VM with the installer’s own cdrom line, and your output should look the same.

apt update failing with cdrom Release file error on a DVD-installed Debian 13 system

apt suggests apt-cdrom, but don’t take that route. It only registers the disc, and a DVD never gets security updates, so you’d keep running unpatched packages. Move the file aside with the mv command from the Debian 13 section, write debian.sources, and the install that failed works on the next try. On our VM, ncdu failed in the DVD state above, and htop installed right after the first clean update.

Error: “The repository ‘cdrom://…’ does not have a Release file”

This is the full line apt printed on our trixie VM, and the one most people paste into a search box after a DVD install:

Error: The repository 'cdrom://[Debian GNU/Linux 13.4.0 _Trixie_ - Official amd64 DVD Binary-1 with firmware 20260314-11:37] trixie Release' does not have a Release file.

It comes with Error: Unable to locate package for any install you try. Both go away once the cdrom line is gone and the network repositories are in place. If you’re reinstalling anyway, choosing a network mirror in the Debian installer avoids this state, because the installer then writes the network repositories for you.

Enable deb-src for source packages

Source repositories are off in our files because most machines never build packages. You need them for apt source, apt-get build-dep or apt-cache showsrc. Without them, apt-cache showsrc hello stopped with this error on our trixie VM (the apt command prints the same text with an Error: prefix).

E: You must put some 'deb-src' URIs in your sources.list

In the deb822 format you don’t add new blocks. Add deb-src to each Types line, so every block serves both binary and source indexes, then refresh:

sudo sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/debian.sources
sudo apt-get update

The update now fetches Sources indexes for every component, about 10 MB for trixie main. apt-cache showsrc hello then answered on our VM:

Package: hello
Version: 2.10-5
Directory: pool/main/h/hello

In the one-line format, the same change means a second line per repository that starts with deb-src instead of deb. That doubling is one reason we prefer deb822 on anything we maintain for long.

Convert sources.list with apt modernize-sources

Debian 13’s apt converts a one-line file for you. It writes /etc/apt/sources.list.d/debian.sources, adds Signed-By where it can work out the key, and keeps the original as .list.bak. Because it writes to that exact filename, move any existing debian.sources aside first, as we did:

sudo mv /etc/apt/sources.list.d/debian.sources /root/debian.sources.mine
sudo apt modernize-sources

apt lists the files it will change and asks before writing anything, so you answer y at the prompt.

apt modernize-sources converting /etc/apt/sources.list to debian.sources on Debian 13

The result has one block per original line, three here, each tagged # Modernized from /etc/apt/sources.list. It works the same as the hand-written file, only longer, so keep whichever you like and delete the other. The trixie release notes also recommend switching Signed-By from debian-archive-keyring.gpg to .pgp, since the .gpg names are kept only for compatibility. Both names exist in /usr/share/keyrings on our trixie VM, and the converter still wrote .gpg, which is what our tested commands use.

Warning: “Target Packages … is configured multiple times”

apt prints this when two entries describe the same suite and component. The usual cause is a sources.list pasted from an old guide next to an existing debian.sources, and that’s how we triggered it. The warning names both files and line numbers, then the fix is to keep one:

apt Target Packages is configured multiple times warning from sources.list and debian.sources, cleared by removing the old file

Nothing breaks, but the noise hides real errors in every update you run. Pick the fix that matches what the warning names.

  • Both files present: sudo rm /etc/apt/sources.list
  • One file against itself: delete the repeated block
  • Cleanup: sources.list.bak is ignored by apt, delete it when done

After removing the stray file, our apt-get update printed zero W:, E: or N: lines. If the warning names a file you did not create, a tool or an installer script probably dropped it there, so read it before you delete it.

Enable backports only when you need them

Backports are newer versions of selected packages rebuilt for stable. You add them for one package, usually a kernel new enough for recent hardware like the Realtek RTL8127 10GbE cards, not to make the whole system newer. Append a third block to debian.sources. The leading empty string writes the blank line between blocks, and tee -a appends instead of overwriting:

printf "%s\n" "" "Types: deb" "URIs: https://deb.debian.org/debian" "Suites: trixie-backports" "Components: main contrib non-free non-free-firmware" "Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg" | sudo tee -a /etc/apt/sources.list.d/debian.sources

On bookworm, use bookworm-backports in the same command. The official backports instructions put the block in its own debian-backports.sources file instead, which is easier to switch off later. Either way, backports get priority 100 against 500 for the main archive, so adding the suite changes nothing on its own:

trixie-backports pinned at priority 100 with the backports kernel listed next to the stable kernel on Debian 13

The candidate stays on the stable kernel even though backports carries a newer major line. Only -t pulls from backports, which a dry run shows before anything is installed:

apt-get -s install -t trixie-backports linux-image-amd64 | grep -E "^Inst" | head -3

Without -t, the same simulation installed the stable kernel from Debian:13.8/stable. With it, apt planned the backports kernel and a newer linux-base:

Inst linux-base [4.12.1] (4.17~bpo13+1 Debian Backports:stable-backports [all])
Inst linux-base-7.3.4+deb13-amd64 (7.3.4-1~bpo13+1 Debian Backports:stable-backports [amd64])
Inst linux-binary-7.3.4+deb13-amd64 (7.3.4-1~bpo13+1 Debian Backports:stable-backports [amd64])

Bookworm behaved the same way. Its backports kernel listed as 6.12.95-1~bpo12+1 next to the 6.1 security kernel, and stayed out of the way until asked for. We’re comfortable leaving backports enabled on servers for that reason. The trade-off is support: backports are best effort, with security notices on their own debian-backports-announce list, so subscribe if you run a backports kernel.

Compare Debian 13, 12 and 11 sources

Most of what changes between releases is the codename, but a few details break a copied file. These are the differences we hit on each release, and the ones you should check first.

ItemDebian 13 (trixie)Debian 12 (bookworm)Debian 11 (bullseye)
Suitestrixie, trixie-updates, trixie-securitybookworm, bookworm-updates, bookworm-securitybullseye, bullseye-updates, bullseye-security
Backportstrixie-backports on deb.debian.orgbookworm-backports on deb.debian.orgbullseye-backports on archive.debian.org only
deb822 debian.sourcesRecommendedWorksNot used here
apt modernize-sourcesConverts .list to .sourcesInvalid operationNot available
Firmware componentnon-free-firmwarenon-free-firmwarenon-free
Free security updatesYesYes, LTSNo, ended August 31, 2026

Read the table as a checklist when you move a file between machines: match the codename, match the firmware component, and check that backports still live where your file points. For the full field list (Architectures, Enabled, options in brackets), the sources.list(5) man page is the reference. Kali uses different repository lines again, so follow the Kali sources.list guide for those boxes. On anything still running bullseye, the archive fix buys time, and the upgrade is the only thing that brings free security updates back.

Keep reading

Install Samba on Debian 13 / 12 and Create a File Share Debian Install Samba on Debian 13 / 12 and Create a File Share Backup and Restore Linux Systems with Timeshift Debian Backup and Restore Linux Systems with Timeshift Install KVM on Debian 13 / Debian 12: Complete Guide KVM Install KVM on Debian 13 / Debian 12: Complete Guide Moonfin for Jellyfin: Moonbase Plugin, Web App and Desktop Setup Debian Moonfin for Jellyfin: Moonbase Plugin, Web App and Desktop Setup Install Wiki.js 3 on Debian 13 and Ubuntu 26.04, Migrate from 2.x Containers Install Wiki.js 3 on Debian 13 and Ubuntu 26.04, Migrate from 2.x How To Install AnyDesk on Kali Linux Desktop How To Install AnyDesk on Kali Linux

Leave a Comment

Press ESC to close