4

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?

1
  • 1
    Please re-read the guidance for the tags you've used. This is clearly a question about system configuration, not about programming, so is off-topic for Stack Overflow. It might be suitable for Server Fault or Unix & Linux: consult the Help Centre for the site before you post. Commented Jul 27, 2023 at 16:13

2 Answers 2

6

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.

Workaround 1

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 

Workaround 2

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:

Sign up to request clarification or add additional context in comments.

Comments

3

I've experienced this recently, I am unsure as to why this happens. I have a feeling this a bug. Either way I got around this by manually adding and setting the non-free source list repository.

Add the new repository and update your apt cache database.

sudo echo "deb http://ftp.us.debian.org/debian bookworm main non-free" > /etc/apt/sources.list.d/non-free.list sudo apt update 

Make sure to set the mirror list closest to you for best performance.

https://www.debian.org/mirror/list

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.