brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: apt .sources files are deb822 now, and Enabled: no switches one off

Apt
~/tips/tip-apt-deb822-sources-enabled-no

Types: deb

Shows the newer repository format and how to disable a source cleanly.

Since Ubuntu 24.04 the main repositories live in /etc/apt/sources.list.d/ubuntu.sources, not in the old sources.list. The format is different, and so is the way you switch a repository off.

A deb822 file is a set of stanzas with fields, separated by empty lines:

Types: deb
URIs: http://archive.ubuntu.com/ubuntu/
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Multiple values are separated by spaces, so one stanza covers several suites and components that used to need several lines.

To disable a repository, add one line to its stanza instead of commenting out everything:

Enabled: no

Remove the line or set it to yes to bring it back. After any change, run sudo apt update. I find this cleaner than a file full of # characters, and it’s easy to see in a diff.

Third party repositories can use the same format in their own .sources file, and apt has supported it since version 1.1. Old one-line .list files still work next to it.

Mind the file extension: apt only reads .sources files as deb822 and .list files as one-line format. A deb822 stanza saved as .list gives parse errors on apt update. And don’t remove the empty lines between stanzas, since that’s how apt tells them apart.

Further reading: sources.list(5) manual page

More Apt tips sudo apt-mark minimize-manual apt list '~c' grep -E ' (install|upgrade|remove) ' /var/log/dpkg.log | tail -o Dpkg::Options::="–force-confold" upgrade sudo apt-get -d -y full-upgrade All Apt tips (42) All topics

Link