Comment 0 for bug 1671566

Scott Moser (smoser) wrote :

When verifying bug 1532855 I realized that when add-apt-repository fails
(at least due to a gpg key-add failure) it will leave the sources entry
that it added still in place. It does not clean up as it should.

The issue is that after the failure, 'apt-get update' will fail as it
wont have the key it needs but apt will grab the ppa sources.

$ find /etc/apt/sources.list.d/
/etc/apt/sources.list.d/

$ sudo add-apt-repository -y ppa:smoser -k hkp://127.0.0.1/
gpg: keybox '/tmp/tmp03u3ibc9/pubring.gpg' created
gpg: keyserver receive failed: No keyserver available
Failed to add key.
$ echo $?
1
$ find /etc/apt/sources.list.d/
/etc/apt/sources.list.d/
/etc/apt/sources.list.d/smoser-ubuntu-ppa-yakkety.list
$ apt-get update -q
Hit:1 http://us.archive.ubuntu.com/ubuntu yakkety InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu yakkety-updates InRelease
Get:3 http://ppa.launchpad.net/smoser/ppa/ubuntu yakkety InRelease [17.5 kB]
Err:3 http://ppa.launchpad.net/smoser/ppa/ubuntu yakkety InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0620BBCF03683F77
Reading package lists...
W: GPG error: http://ppa.launchpad.net/smoser/ppa/ubuntu yakkety InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0620BBCF03683F77
E: The repository 'http://ppa.launchpad.net/smoser/ppa/ubuntu yakkety InRelease' is not signed.

$ echo $?
100

ProblemType: Bug
DistroRelease: Ubuntu 16.10
Package: software-properties-common 0.96.24.7.1
ProcVersionSignature: Ubuntu 4.9.0-15.16-generic 4.9.5
Uname: Linux 4.9.0-15-generic x86_64
ApportVersion: 2.20.3-0ubuntu8.2
Architecture: amd64
Date: Thu Mar 9 16:54:42 2017
PackageArchitecture: all
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=C.UTF-8
SourcePackage: software-properties
UpgradeStatus: No upgrade log present (probably fresh install)