A common error in Linux
A very common error in Linux; well, most Debian based Linux distributions such as Debian itself, Ubuntu, Kali, Linux Mint has this error when trying to install a package/application “Package packagename 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 ‘packagename’ has no installation candidate”
Package somePackage 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 somePackage has no installation candidate
Extremely annoying and useless error that doesn’t tell you much on how to fix it.
Fixing “Package packagename 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 ‘packagename‘ has no installation candidate” error
However, this is rather eacy to fix. Just use the following command in any Debian based Linux Operation system such as Debian itself, Ubuntu, Kali Linux, Linux Mint etc.
sudo apt-get update && && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get install packagename (or) apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get install packagename (where packagename refers to the package that failed to install in the first place)
Once you’ve updated, upgraded, you should be able to install any packages without errors.
Download GPG Authentication Key
Assuming you already have GPG (GnuPG) installed (most Linux distro these days have GPG pre-installed), you can download a copy of your Linux distributions official key.
Kali Linux
Use the following commands: (Source: Downloading Kali Linux. Also thanks to user emra for pointing it out, Cheers)
wget -q -O - https://www.kali.org/archive-key.asc | gpg --import
or the command
gpg --keyserver hkp://keys.gnupg.net --recv-key 7D8D0BF6
Your output should look like this:
gpg: key 7D8D0BF6: public key "Kali Linux Repository <devel@kali.org>" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1)
Verify that the key is properly installed with the command:
gpg --list-keys --with-fingerprint 7D8D0BF6
The output will look like this:
pub 4096R/7D8D0BF6 2012-03-05 [expires: 2015-03-05] Key fingerprint = 44C6 513A 8E4F B3D3 0875 F758 ED44 4FF0 7D8D 0BF6 uid [ unknown] Kali Linux Repository <devel@kali.org> sub 4096R/FC0D0DCB 2012-03-05 [expires: 2015-03-05]
You’re now set up to validate your Kali Linux download.
Ubuntu Linux
I have since tried this in an Ubuntu installation I had (I forgot to update it for a very long time). Worked fine.
Error Samples:
W: GPG error: http://ppa.launchpad.net jaunty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6D975C4791E7EE5E
W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used.GPG error: http://ppa.launchpad.net jaunty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5A9BF3BB4E5E17B5
W: GPG error: http://ppa.launchpad.net jaunty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7FB8BEE0A1F196A8
W: Failed to fetch http://ppa.launchpad.net/chromium-da...jaunty/Release
W: Some index files failed to download, they have been ignored, or old ones used instead.
The fix for this is to re-download the keys using the hexidecimal numbers given in the error . Note that your hexadecimal numbers may be different then mine, so make sure to use the hexadecimals numbers in your error, not mine.
Type this command into the terminal:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys
And then add the hexadecimal numbers to the command (again, these are my keys from my error. Make sure to use your own):
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6D975C4791E7EE5E 5A9BF3BB4E5E17B5 7FB8BEE0A1F196A8"
The output should look like this:
gpg: requesting key 437D05B5 from hkp server keyserver.ubuntu.com"
Once GPG keys are imported, I advise to do an update, upgrade, dist upgrade and then install the package you want. Following command will do just that:
sudo apt-get update && && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get install packagename (or) apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get install packagename
After this, life should be normal again!
sir, how about solving this issue
……………………………………………………………………………..
dpkg: unrecoverable fatal error, aborting:
reading files list for package ‘ratproxy’: Input/output error
E: Sub-process /usr/bin/dpkg returned an error code (2)
obuntu : take a look at this to resolve ur problem
Backup the dpkg status
file: cp /var/lib/dpkg/status{,.backup}
Edit the /var/lib/dpkg/status file and remove the sections for the packages that apt-get printed warnings about. Make sure that you remove the whole section about these packages,
Run sudo dpkg –configure -a to configure un-configured packages
(Re)install the packages with sudo apt-get -f install. The packages are missing because we removed them from the status file.
good luck!
after follows your procedure…
# apt-get install gnome-web-photo
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package gnome-web-photo 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 ‘gnome-web-photo’ has no installation candidate
gnome-web-photo exist just on sid repo, u can download it manualy but u should satisfied the dependencies
https://packages.debian.org/sid/gnome-web-photo
btw blackMORE Ops u r doing a great job
best wishes
Look i still have the error
http://prntscr.com/60lrtq
http://prntscr.com/60ls2q
Please help :) Thank you !
W: GPG error: http://downloads.sourceforge.net all Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY CCC158AFC1289A29
W: GPG error: http://security.kali.org kali/updates Release: The following signatures were invalid: KEYEXPIRED 1425567400 KEYEXPIRED 1425567400 KEYEXPIRED 1425567400
W: Failed to fetch http://deb.playonlinux.com/dists/lenny/main/binary-i386/Packages 404 Not Found [IP: 37.187.89.171 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
im getting like this after i typed the above commands . What should i do now inorder to get rid of this????
tried the following solution and it worked:
# apt-key adv –keyserver hkp://keys.gnupg.net –recv-keys 7D8D0BF6
Correct, both of these would work
$ wget -q -O - https://www.kali.org/archive-key.asc | gpg --import
or the command
$ gpg --keyserver hkp://keys.gnupg.net --recv-key 7D8D0BF6
Your output should look like this:
gpg: key 7D8D0BF6: public key "Kali Linux Repository" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
Verify that the key is properly installed with the command:
gpg --list-keys --with-fingerprint 7D8D0BF6
The output will look like this:
pub 4096R/7D8D0BF6 2012-03-05 [expires: 2015-03-05]
Key fingerprint = 44C6 513A 8E4F B3D3 0875 F758 ED44 4FF0 7D8D 0BF6
uid [ unknown] Kali Linux Repository
sub 4096R/FC0D0DCB 2012-03-05 [expires: 2015-03-05]
root@kali:~# apt-get install alacarte
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package alacarte 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 ‘alacarte’ has no installation candidate
root@kali:~#
these commands are not solving my problem
I also have same problem.can anyone please solve it
I still got the error :
E: Package ‘aptitude’ has no installation candidate
any one can help ?
xyz@blah:~$ sudo apt-get install mailutils
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package mailutils 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 ‘mailutils’ has no installation candidate
sudo apt-get install tor
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package tor 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 ‘tor’ has no installation candidate
i am still getting the same error in my ubuntu 18.04 even after following your procedure
Hello, from 2020! It really help. Thanks so much!
Omg this was super helpful even in 2022, thank you!
wow, I didn’t even knew people are reading my blog. I started it off as a personal wiki. Glad to see it helped.