When I try to add non-free on debian 12 (bookworm) with apt-add-repository nothing happens. This used to work on bullseye. I guess the reason is that package source files changed format. Old format was:
deb http://deb.debian.org/debian/ bookworm main
New format
Types: deb
# http://snapshot.debian.org/archive/debian/20230703T000000Z
URIs: http://deb.debian.org/debian
Suites: bookworm bookworm-updates
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
When I run apt-add-repository the file doesn't change. No new components are added.
# apt-get update
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Reading package lists... Done
# apt-add-repository -y non-free
Adding component(s) 'non-free' to all repositories.
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Reading package lists... Done
# cat /etc/apt/sources.list.d/debian.sources
Types: deb
# http://snapshot.debian.org/archive/debian/20230703T000000Z
URIs: http://deb.debian.org/debian
Suites: bookworm bookworm-updates
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
# http://snapshot.debian.org/archive/debian-security/20230703T000000Z
URIs: http://deb.debian.org/debian-security
Suites: bookworm-security
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Is there any solution to that apart from manually editing the debian.sources file?
This is most likely caused due to the introduction of a new standard data format for APT, DEB822.
It's already being shipped in Debian 12 (Bookworm) Docker containers (see: /etc/apt/sources.list.d/debian.sources and sources.list). However, the old format is still being used by apt-add-repository which is most likely why $ apt-add-repository non-free
isn't able to parse and update the sources at all.
Here's a workaround (which as of writing this adds non-free
repositories in the old format for the current os-release
and specified mirror url):
add-apt-repository -U http://deb.debian.org/debian -c non-free-firmware -c non-free
Edit: there's another bug at play here, this command needs to be executed twice (using e.g. !!) to take effect as it's not flushing to disk on the first run (perhaps due to new Python version in Bookworm?). Consider this example for installing steamcmd
apt -y install software-properties-common
dpkg --add-architecture i386
add-apt-repository -y -n -U http://deb.debian.org/debian -c non-free -c non-free-firmware
!!
apt update
apt install steamcmd
Alternatively, append desired components manually to DEB822 sources to avoid software-properties-common python3
(apt-add-repository) dependencies all-together:
sed -i 's/^Components: main$/& contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources
apt update
Relevant:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With