Ubuntu: Adding and Remove Repositories (Repos)

The following is a blunder I’ve made while attempting to install Acrobat Reader on Ubuntu 19. Hence, let this be a learning experience in dealing with Ubuntu repos and software signatures.

Added the precise repo:

sudo add-apt-repository "deb http://archive.canonical.com/ precise partner"

Error:

W: GPG error: http://archive.canonical.com precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
E: The repository 'http://archive.canonical.com precise Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Manually imported the keys from Ubuntu keyserver

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 40976EAF437D05B5

Output

Executing: /tmp/apt-key-gpghome.ilULdPGG23/gpg.1.sh --recv-keys --keyserver keyserver.ubuntu.com 40976EAF437D05B5
gpg: key 40976EAF437D05B5: 59 signatures not checked due to missing keys
gpg: key 40976EAF437D05B5: public key "Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>" imported
gpg: Total number processed: 1
gpg: imported: 1

Attempted update

sudo apt-get -y update

Next error

W: GPG error: http://archive.canonical.com precise Release: The following signatures were invalid: 630239CC130E1A7FD81A27B140976EAF437D05B5
E: The repository 'http://archive.canonical.com precise Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Reverse changes: since this repo has been added as a URL, the roll-back is simply to run the same command with the –remove switch

sudo add-apt-repository --remove "deb http://archive.canonical.com/ precise partner"

To perform PPAs roll-backs, use one of these options: 

# Option 1: runt the same command with the --remove flag
sudo add-apt-repository --remove ppa:BAD-REPO/ppa

# Option 2: use ppa-purge to remove undesired repos while gracefully downgrade installed packages if necessary
sudo apt-get install ppa-purge
sudo ppa-purge ppa:BAD-REPO/ppa

# Option 3: manual removal of the REPO.list file
ls /etc/apt/sources.list.d
rm -rf /etc/apt/sources.list.d/BAD-REPO.list
sudo apt update

This has been an exercise to demonstrate Linux repository manipulations. To bring closure to the original task of installing Acrobat, that is completed in this post here.

Posted on Categories Linux

Leave a Reply

Your email address will not be published. Required fields are marked *