Dealing with PPA and GPG problems in Ubuntu and derivatives

PPAs are extremely useful, making installing and maintaining apps in Ubuntu and derivatives (such as Linux Mint) extremely easy. However, upgrading the system or problems/changes in the maintainer of the PPA can turn things into a pain the neck. Y PPA Manager is a tool from Web UPD8 designed specifically to keep all this under control in a easy way.

Some of the functions are:

  • List the packages available in a PPA added on your system
  • Download packages from PPAs without adding them
  • PPAs backup / restore, along with all the PPA keys
  • Update single repositories using a command line tool (by the way, when you add a PPA using Y PPA Manager, it’s updated without updating all the software sources) called “update-ppa” – usage example: “sudo update-ppa ppa:webupd8team/java”
  • Some options that should help you re-enable the working PPAs when upgrading to a newer Ubuntu / Linux Mint version
  • Remove duplicate PPAs
  • Unity quicklists / optional AppIndicator

Installing Y PPA Manager is as easy as copy and pasting the next lines:

sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt update
sudo apt install y-ppa-manager

If you are having problems with expired GPG keys:

We know that feeling. The maintainer of a repository changes something and suddenly we start having problems with the GPG Keys. In my case, this happens -too frequently, under my point of view- with QGIS. Luckily we can fix invalid GPG keys with a single-line command:

sudo apt-key list | \
 grep "expired: " | \
 sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp' | \
 xargs -n1 sudo apt-key adv --keyserver hkp:// --recv-keys

Command explanation:

  • sudo apt-key list Lists all keys installed in the system.
  • grep “expired: “ Leaves only lines with expired keys.
  • sed -ne ‘s|pub .*/\([^ ]*\) .*|\1|gp’ Extracts keys.
  • xargs -n1 sudo apt-key adv –keyserver hkp:// –recv-keys Updates the expired keys with those found in the Ubuntu key server.