Wednesday, 5 December 2012

Fix for "packages cannot be authenticated" warning on Ubuntu

Sometimes when installing packages on Ubuntu Linux, you'll get a warning like this:

sudo apt-get install foo bar
    ...
    WARNING: The following packages cannot be authenticated!

    foo bar
Install these packages without verification [y/N]?


The fix is trivial...
sudo apt-get autoremove
sudo apt-get clean
sudo apt-get update
sudo apt-get install foo bar

The key thing is to clean APT's cache of downloaded packages.  But while we're there, we also autoremove any orphaned dependency packages, and update the APT database, before attempting to install the packages you asked for.