我添加的新存储库从未被发现?

我添加的新存储库从未被发现?

我正在运行 CrunchBang,输出如下uname -a

Linux sigh 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt2-1 (2014-12-08) x86_64 GNU/Linux

我的sources.list

# Crunchbang
deb http://packages.crunchbang.org/waldorf waldorf main
deb-src http://packages.crunchbang.org/waldorf waldorf main

# Debian Wheezy
deb http://http.debian.net/debian wheezy main contrib non-free
deb-src http://http.debian.net/debian wheezy main contrib non-free

# Debian Jessie
deb http://ftp.de.debian.org/debian jessie main
deb http://http.debian.net/debian jessie main contrib non-free
deb-src http://http.debian.net/debian jessie main contrib non-free

# Debian Security
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free

# Debian Backports
deb http://http.debian.net/debian wheezy-backports main contrib non-free

# Debian Multimedia
deb http://www.deb-multimedia.org wheezy main non-free

# Oracle Java
deb http://www.duinsoft.nl/pkg debs all

apt-add-repository因此,每当我通过并运行添加任何新存储库时apt-get update,都会收到以下格式的错误:

W: Failed to fetch http://ppa.launchpad.net/conky-companions/ppa/ubuntu/dists/jessie/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/conky-companions/ppa/ubuntu/dists/jessie/main/binary-i386/Packages  404  Not Found

我认为这是因为我要求的版本jessie/main在大多数软件包中都不存在(?),但我不确定如何更改sources.list以防止这种情况发生并避免破坏我的系统。

有谁知道我怎样才能阻止它从 获取jessie/main?或者向我解释到底发生了什么,以便我可以让这些存储库正常工作?

答案1

add-apt-repository自动检测您的发行版代号,并且不提供执行此操作的选项。当然,它不能神奇地将 Debian 版本与 Ubuntu 匹配,并且要实现这一点,您必须编辑/etc/lsb-release,这可能会破坏其他东西。这是因为add-apt-repository调用SoftwareProperties.add_source_from_shortcut,这又使用aptsources.distro.get_distro()确定代号:

aptsources.distro.get_distro(id=None, codename=None, description=None, release=None)
Check the currently used distribution and return the corresponding distriubtion class that supports distro specific features.
If no paramter are given the distro will be auto detected via a call to lsb-release

(不,这不是我的拼写。)

因此,如果您愿意,请编辑/etc/lsb-release并更改DISTRIB_CODENAME为适当的 Ubuntu 版本(因为这是大多数 Launchpad PPA 的目标),例如trusty.


或者,您可以构建实际的线路。ppa:username/ppa-name翻译为:

add-apt-repository https://ppa.launchpad.net/username/ppa-name/ubuntu $(lsb_release -sc)

当然,您将替换$(lsb_release -sc)trusty等。您还需要手动获取 GPG 密钥并添加它。这也有一个缺点,即不是在 中创建一个漂亮的新文件/etc/apt/sources.list.d,而是将该条目添加到/etc/apt/sources.list.


看起来您必须更改DISTRIB_IDDISTRIB_CODENAME,以便它们的值匹配:

$ lsb_release -sc
trusty
$ sudo sed 's/trusty/wheezy/' -i /etc/lsb-release
$ lsb_release -sc                                
wheezy
$ sudo add-apt-repository ppa:conky-companions/ppa
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 91, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__
    self.reload_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist
    self.distro.get_sources(self.sourceslist)    
  File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources
    (self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Ubuntu/wheezy
$ sudo sed 's/trusty/wheezy/;s/Ubuntu/Debian/' -i /etc/lsb-release
$ sudo add-apt-repository ppa:conky-companions/ppa                

 More info: https://launchpad.net/~conky-companions/+archive/ubuntu/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmp19qsp29e/secring.gpg' created
#...
gpg:               imported: 1  (RSA: 1)
OK
$ cat /etc/apt/sources.list.d/conky-companions-ppa-wheezy.list 
deb http://ppa.launchpad.net/conky-companions/ppa/ubuntu wheezy main
# deb-src http://ppa.launchpad.net/conky-companions/ppa/ubuntu wheezy main
$ sudo rm /etc/apt/sources.list.d/conky-companions-ppa-wheezy.list 
$ sudo sed 's/wheezy/trusty/' -i /etc/lsb-release
$ sudo add-apt-repository ppa:conky-companions/ppa                
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 91, in <module>
    sp = SoftwareProperties(options=options)
#...
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Debian/trusty
$ sudo sed 's/wheezy/trusty/;s/Debian/Ubuntu/' -i /etc/lsb-release
$ sudo add-apt-repository ppa:conky-companions/ppa                

 More info: https://launchpad.net/~conky-companions/+archive/ubuntu/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmpnz_771l_/secring.gpg' created
#...
OK

当然,您添加的任何存储库此更改仍需要手动更正。

相关内容