0

I'm running CrunchBang with the following output from uname -a

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

My 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

So whenever I add any new repository through apt-add-repository and run apt-get update, I get errors along the following format:

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

I figure it's because I'm asking for the jessie/main version, which does not exist in most packages(?) but I'm not sure how to change the sources.list to keep this from happening and avoid breaking my system anymore than it apparently is.

Does anyone know how I can keep it from fetching from jessie/main? Or explain to me exactly what's going on so I can get these repositories working?

  • The question is, how are you adding these repositories? add-apt-repository? These new repositories are likely saved in new files in /etc/apt/sources.list.d. Edit them to use an appropriate Ubuntu version (trusty, perhaps). – muru Jan 23 '15 at 20:45
  • Yes that's how I'm adding them. So I need to edit each entry every time I add a new repository? Isn't there a way to fix this automatically when using add-apt-repository? – Brian Rodriguez Jan 23 '15 at 20:48
1

add-apt-repository detects your distribution codename automatically and doesn't provide options to do so. It cannot, of course, magically match up a version of Debian to Ubuntu, and to make it to do so, you'll have to edit /etc/lsb-release, which may break other things. This is because add-apt-repository calls SoftwareProperties.add_source_from_shortcut, which in turn uses aptsources.distro.get_distro() to determine the codename:

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

(No, that's not my spelling.)

So, if you're feeling up to it, edit /etc/lsb-release and change DISTRIB_CODENAME to an appropriate version of Ubuntu (since that's the target of most Launchpad PPAs), such as trusty.


Or, you could construct the actual line. ppa:username/ppa-name translates to:

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

Of course, you'll replace $(lsb_release -sc) with trusty, etc. You'll also need to fetch the GPG key manually and add it. This also has the drawback that instead of creating a nice new file in /etc/apt/sources.list.d, the entry is added to /etc/apt/sources.list.


Looks like you have to change both DISTRIB_ID and DISTRIB_CODENAME, so that their values match:

$ 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

Naturally, any repositories you added before this change would still need to be manually corrected.

  • It seems CrunchBang has it's own lsb-release that isn't hit(?) by it because it's called lsb-release-crunchbang instead. So you're saying I should make an lsb-release file to make apt-get believe I'm running on an ubuntu release instead of a CrunchBang one? Also, when aliasing the lsb-release-crunchbang as lsb-release, I get this error: aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for CrunchBang/waldorf – Brian Rodriguez Jan 24 '15 at 1:20
  • Update: I've added a new lsb-release with following contents: DISTRIB_ID=Ubuntu DISTRIB_RELEASE=12.10 DISTRIB_CODENAME=quantal DISTRIB_DESCRIPTION="Ubuntu quantal" but I still get the same repository errors: 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 – Brian Rodriguez Jan 24 '15 at 2:14
  • @BrianRodriguez so any new repositories you added don't use the new lsb-release? Can you test using the lsb_release command whether that file is read? – muru Jan 24 '15 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.