当我尝试使用 apt-add-repository 在 debian 12(书虫)上添加非自由时,没有任何反应。这曾经在靶心上起作用。我猜原因是包源文件改变了格式。旧格式是:
deb http://deb.debian.org/debian/ bookworm main
新格式
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
当我运行 apt-add-repository 时,文件不会更改。没有添加新组件。
# 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
除了手动编辑 debian.sources 文件之外,还有其他解决方案吗?
我最近经历过这种情况,我不确定为什么会发生这种情况。我有一种感觉这是一个错误。 不管怎样,我通过手动添加和设置非自由源列表存储库来解决这个问题。
添加新的存储库并更新您的 apt 缓存数据库。
sudo echo "deb http://ftp.us.debian.org/debian bookworm main non-free" > /etc/apt/sources.list.d/non-free.list
sudo apt update
确保设置离您最近的镜像列表以获得最佳性能。
这很可能是由于 APT 引入了新的标准数据格式,DEB822。
Debian 12 (Bookworm) 已经在其 Docker 容器中发货了(请参阅:/etc/apt/sources.list.d/debian.sources)。但是,apt-add-repository仍在使用旧格式,因此
$ apt-add-repository non-free
无法正确解析源。
这里有一个 解决方法 (在撰写本文时,为当前
non-free
和指定的镜像 URL 以旧格式添加了 os-release
存储库):
add-apt-repository -U http://deb.debian.org/debian -c non-free-firmware -c non-free