Debian 13 Tutorial / Configure deb822 Repositories and Signed-By Keyrings

Debian 13 stores Advanced Package Tool (APT) repository definitions in /etc/apt/sources.list and files under /etc/apt/sources.list.d. A deb822 .sources file groups each repository definition into named fields. When converting an existing setup, preserve its addresses, release suites, components and signing trust, disable the old duplicate entries, then refresh lists and compare package candidates.

Inspect the Current Repository Format

Use the Debian 13 VM from the APT package installation and removal lab. Repository definitions control both package sources and trust. Do not paste in Ubuntu repositories or another Debian release’s configuration.

cat /etc/os-release
ls -l /etc/apt/sources.list
find /etc/apt/sources.list.d -maxdepth 1 -type f -print
cat /etc/apt/sources.list
apt-cache policy bash

If a .sources file already exists, read the file to verify valid repositories. In environments where private repository addresses include authentication information, do not share the whole file externally. It is possible to have a configuration without /etc/apt/sources.list, so do not assume there are no repositories merely because the file is missing.

The actual verification environment is Debian 13.7, APT 3.0.3. The installer created single-line deb and deb-src entries in sources.list, and sources.list.d was empty. The conversion procedure described here targets that state. If a proper deb822 configuration already exists, do not create a new duplicate file and instead review the fields of the current file.

Read deb822 Fields and Archive Components

deb822 is a format that writes a repository as a set of field names and values. One set is separated by a blank line. Since it is neither YAML nor a shell script, you do not run a .sources file with bash. sources.list Manual explains both the single-line format of .list and the deb822 format of .sources.

Fields Roles Example Selection
Types Types of Binary and Source Package Lists deb requests binary package indexes; deb-src requests source package indexes.
URIs Base Address of the Repository Distinguishes between general archives and security repositories.
Suites Release/Update Branch Uses trixie, trixie-updates, trixie-security.
Components Archive area to query Keeps the existing main and non-free-firmware.
Signed-By Keyring to use for verifying this repository Absolute path of the installed Debian archive keyring.

Separate multiple field values with whitespace, not commas. For example, the two Suites values share one space-separated field. Adding Enabled: no disables the entire stanza in a .sources file, including every suite it defines. Remove that field or change it to yes to re-enable the stanza. Review all active definitions so that the security repository is not accidentally left disabled.

To maintain Debian 13, a configuration that specifies the codename trixie makes the intention clear rather than using a moving name like stable. Even after a new Debian becomes stable, trixie still refers to the same release. trixie-updates is the update branch of the stable release, and trixie-security is the security update branch. Changing the codename is linked to the distribution upgrade plan, so do not change it arbitrarily to avoid repository errors.

Area Classification Criteria Confirm when selected
main The area of this distribution that complies with Debian Free Software Guidelines The core of the default package configuration.
contrib An area where the software itself complies with the free guidelines but may depend on components outside main Check necessary programs and dependencies.
non-free Software that does not comply with free software guidelines Check the license and organizational policies.
non-free-firmware Separately isolated non-free firmware area Check the firmware required for the device and the distribution conditions.

The basis for distinguishing the area can be found in Debian policy archive area description. Just because firmware is needed does not mean all non-free areas must be automatically added. This example retains the installer’s existing selection as is.

Back Up Definitions and Record a Package Candidate

The backup directory must not already exist. If it does, choose a fresh name and adjust every recovery path consistently. Run the first line separately and continue only if it succeeds; also stop if the copy or any target-file check fails. Do not proceed to editing without a usable backup.

sudo test ! -e /var/backups/lf-debian13-10 && sudo install -d -m 700 /var/backups/lf-debian13-10
sudo cp -a /etc/apt/sources.list /etc/apt/sources.list.d /var/backups/lf-debian13-10/
apt-cache policy bash | sudo tee /var/backups/lf-debian13-10/bash-policy-before.txt
sudo test ! -e /etc/apt/sources.list.d/debian.sources
ls -l /usr/share/keyrings/debian-archive-keyring.gpg
sudo -u _apt test -r /usr/share/keyrings/debian-archive-keyring.gpg && printf 'APT account can read the keyring\n'

If debian.sources already exists, do not overwrite it. The keyring is provided by the debian-archive-keyring package, and in this VM the .gpg path was a link pointing to a .pgp file. The important thing is whether the specified public keyring can actually be read by the _apt account. If the key file is missing or corrupted, do not bypass by receiving an unverified key; instead, check the proper packages and recovery materials.

The bash candidate lookup is comparison data to verify whether package selection has inadvertently changed due to conversion. Even if one package is the same, it does not prove that all package policies are identical, so also compare the repository’s address, branch, and components.

Write the Complete deb822 File and Disable Old Entries

Open a new file with the following command. Proceed only if the prior existence check and backup have been completed.

sudo nano /etc/apt/sources.list.d/debian.sources

Enter all the contents below, save with Ctrl+O and Enter, then exit with Ctrl+X. Group regular and updated entries under the same address, and place security repositories in a separate group. Keep an empty line between the two groups.

Types: deb deb-src
URIs: http://deb.debian.org/debian
Suites: trixie trixie-updates
Components: main non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb deb-src
URIs: http://security.debian.org/debian-security
Suites: trixie-security
Components: main non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

The reason for including deb-src in Types is to preserve the existing source list functionality. Servers that do not download and build sources may use only deb as needed, but that choice is separate from format conversion. Put repository addresses in URIs and the appropriate keyring path in Signed-By; do not substitute a keyring from another distribution.

sudo chmod 644 /etc/apt/sources.list.d/debian.sources
sudo nano /etc/apt/sources.list

Comment out the Debian deb and deb-src lines moved from the existing sources.list to the new file to deactivate them. Do not delete entries for other purposes without separate review. For example, change the existing deb http://deb.debian.org/debian trixie main non-free-firmware to a comment. If the existing cdrom entry is already commented out, leave it as is.

If the same repository is activated simultaneously in both .list and .sources files, duplicate warnings or Signed-By value conflicts may occur. If you save the file name as .sources.txt, APT will not read it as the format it expects, so also check the extension.

Refresh Lists and Compare Package Selection

The next operation does not upgrade the installed packages. First, it checks whether repository definitions and signature verification are processed correctly.

sudo apt update
apt-cache policy bash | sudo tee /var/backups/lf-debian13-10/bash-policy-after.txt
sudo diff -u /var/backups/lf-debian13-10/bash-policy-before.txt /var/backups/lf-debian13-10/bash-policy-after.txt
sudo apt-get -s install tree

On the verification VM, the processing of InRelease for trixie, trixie-updates, and trixie-security all passed. The candidate and priority comparison for bash passed without differences, and a simulated installation of tree also created a plan normally. If the repository is updated at runtime, differences may occur due to new versions, so the changed sources and versions are read to make a judgment.

An update can partially fail while later commands continue to use older package lists. Do not just look at the last line; check for signature errors, download failures, and duplicate warnings. If a failed repository is a security repository, the operation is not marked as complete just because existing packages can be found.

Understand Signed-By and Repository Trust

Signed-By limits the range of public keys used to verify the metadata of the repository. The fact that a key file exists and that the repository's signature is verified correctly are different. The apt-secure manual explains the verification system using signed Release information and package hashes. Repository trust is also distinct from a guarantee that all package operations are harmless.

This example keeps the installer's official HTTP address and uses signature verification. HTTPS provides separate protection for the transmission segment but does not replace signature verification. Organizations using HTTPS should consistently apply it by checking certificate trust and proxy policies.

When adding external provider repositories, check whether Debian 13 is supported, the official distribution URL, the key fingerprint, and the distribution path. Keys stored by the administrator can be separated as /etc/apt/keyrings, and keys managed by packages can be in /usr/share/keyrings. Do not arbitrarily add external keys for global trust or use the Trusted: yes / disable signature verification options to bypass issues. There is also no need to copy the old apt-key add procedure to obtain the default repository keys for Debian 13.

For signature key errors, check the Signed-By path, read permissions, the exact key, and repository; for Release validity period errors, check the server clock and repository status. The method for checking time can follow the criteria explained in Distinguishing time zones and actual synchronization. Do not disable date or validity checks without determining the cause.

Restore the Original Repository Definitions

In cases like this article, where only the original sources.list was used and the new debian.sources was added, restore using the following method. Before restoring, compare with a backup to check that there have been no other normal changes. If a .sources file that was already in operation was modified, you need to individually restore the backup of that file.

sudo cp -a /var/backups/lf-debian13-10/sources.list /etc/apt/sources.list
sudo rm -- /etc/apt/sources.list.d/debian.sources
sudo apt update
apt-cache policy bash

Remove only the new debian.sources file; keep the rest of sources.list.d. In the lab, the restored sources.list matched its original byte for byte and the subsequent list refresh succeeded. Converting repository format does not roll installed packages back to earlier versions. Any package upgrades performed afterward require their own recovery plan.