4

I am unable to apt-get install any packages because E: Package '<package name>' has no installation candidate. Unlike the other similarly named questions, I am using debian and I have not been able to get any packages to work due to the same error. apt is still able to list repositories. I have updated, upgraded, rebooted, and repeated after my attempts at fixing sources.list, but nothing has worked.

For example,

$ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package nodejs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'nodejs' has no installation candidate

Running $ find /etc/apt/ -path *.list | xargs cat produces:

#------------------------------------------------------------------------------#
#                   OFFICIAL DEBIAN REPOS                    
#------------------------------------------------------------------------------#

###### Debian Main Repos
deb http://ftp.us.debian.org/debian/ jessie main contrib non-free 
deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free 

###### Debian Update Repos
deb http://security.debian.org/ jessie/updates main contrib non-free 
deb http://ftp.us.debian.org/debian/ jessie-proposed-updates main contrib non-free 
deb-src http://security.debian.org/ jessie/updates main contrib non-free 
deb-src http://ftp.us.debian.org/debian/ jessie-proposed-updates main contrib non-free 


deb http://archive.raspberrypi.org/debian/ jessie main ui
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://archive.raspberrypi.org/debian/ jessie main ui
deb https://dev2day.de/pms/ jessie main
deb http://dl.bintray.com/openhab/apt-repo stable main
4
  • 3
    # apt-get update ( If you haven't already done.) ... $ apt-cache search [package name] ... to decide if 'package' exist .... and to know the exact package name. Commented Jul 17, 2016 at 19:30
  • I have updated and validated all packages exist prior. I've added an example.
    – twinlakes
    Commented Jul 18, 2016 at 0:04
  • That is some strange behavior, the partition containing /var is filling up perhaps and new info can't be written to the /var/cache/apt directory?
    – ojs
    Commented Jul 19, 2016 at 0:04
  • 'apt-get update' resolved it for me on a shiny new docker jenkins container.
    – gaoithe
    Commented Jan 26, 2017 at 12:36

3 Answers 3

6

There are several probabilities:

  • Your list can be not updated, use apt-get update. You should also check if apt-cache policy list all the repositories.
  • Is probable that the package isn't available in the repository sources you have added or in another component. For Debian, use madison, other distros have equivalents. For that package for example you need:

    nodejs     | 0.10.29~dfsg-1~bpo70+1 | wheezy-backports | source, amd64, armel, armhf, i386, kfreebsd-amd64, kfreebsd-i386
    nodejs     | 0.10.29~dfsg-2         | stable           | source, amd64, armel, armhf, i386, mipsel
    nodejs     | 0.10.29~dfsg-2         | stable-kfreebsd  | source, kfreebsd-amd64, kfreebsd-i386
    nodejs     | 4.3.1~dfsg-3           | testing          | source, amd64, arm64, armel, armhf, i386, mips, mipsel, powerpc, ppc64el, s390x
    nodejs     | 4.4.7~dfsg-2           | unstable         | source, amd64, arm64, armhf, i386, kfreebsd-amd64, kfreebsd-i386, mips, mips64el, mipsel, powerpc, ppc64el, s390x
    nodejs     | 5.11.0~dfsg-1          | experimental     | source, mipsel
    nodejs     | 6.0.0~dfsg-1           | experimental     | source, amd64, arm64, armel, armhf, i386, kfreebsd-amd64, kfreebsd-i386, mips, mips64el, powerpc, ppc64el, s390x
    

    Either those repositories aren't enabled or are in a component that you haven't added (ie. main, contrib, non-free).

  • It's also possible that the package isn't available for your architecture. Use dpkg --print-architecture to know which architecture you are using and compare it with madison output.

If any of those fails, you will have that message. Check with apt-cache policy package to verify that the local package list has the package.

0

Check your distro's official site for package repositories and add those links to the file /etc/apt/source.list and then it will work.

0

if the problem relates to some certain repositories then try to check you apt configuration in: /etc/apt/preferences.d/

It can have pinning files which not allow to upgrade these specific packages.

it can take place in docker images when changes in package version may brake things...

I hope this can help.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .