Friday 12 December 2014

Install Repository Keys - Apt-get update - gpg --recv-keys

When running apt-get update, you get this error:
(0) root@debiansvr /var/tmp
# apt-get update
Get:1 http://packages.yourdomain wheezy Release.gpg [490 B]
Get:2 http://packages.yourdomain wheezy Release [3,489 B]
Get:3 http://ftp.uk.debian.org wheezy Release.gpg [1,655 B]
Ign http://packages.yourdomain wheezy Release
Get:4 http://ftp.uk.debian.org wheezy Release [168 kB]
Get:5 http://security.debian.org wheezy/updates Release.gpg [836 B]
Get:6 http://security.debian.org wheezy/updates Release [102 kB]
Get:7 http://ftp.uk.debian.org wheezy/main Sources [5,955 kB]
Get:8 http://security.debian.org wheezy/updates/main Sources [142 kB]
Get:9 http://packages.yourdomain wheezy/main Sources [6,892 B]
Get:10 http://packages.yourdomain wheezy/main i386 Packages [6,883 B]
Ign http://packages.yourdomain wheezy/main Translation-en_GB
Ign http://packages.yourdomain wheezy/main Translation-en
Get:11 http://security.debian.org wheezy/updates/contrib Sources [14 B]
Get:12 http://security.debian.org wheezy/updates/non-free Sources [14 B]
Get:13 http://security.debian.org wheezy/updates/main i386 Packages [228 kB]
Get:14 http://security.debian.org wheezy/updates/contrib i386 Packages [14 B]
Get:15 http://security.debian.org wheezy/updates/non-free i386 Packages [14 B]
Get:16 http://security.debian.org wheezy/updates/contrib Translation-en [14 B]
Get:17 http://security.debian.org wheezy/updates/main Translation-en [128 kB]
Get:18 http://security.debian.org wheezy/updates/non-free Translation-en [14 B]
Get:19 http://ftp.uk.debian.org wheezy/contrib Sources [47.8 kB]
Get:20 http://ftp.uk.debian.org wheezy/non-free Sources [93.4 kB]
Get:21 http://ftp.uk.debian.org wheezy/main i386 Packages [5,858 kB]
Get:22 http://ftp.uk.debian.org wheezy/contrib i386 Packages [42.3 kB]
Get:23 http://ftp.uk.debian.org wheezy/non-free i386 Packages [77.5 kB]
Get:24 http://ftp.uk.debian.org wheezy/contrib Translation-en [34.8 kB]
Get:25 http://ftp.uk.debian.org wheezy/main Translation-en [3,846 kB]
Get:26 http://ftp.uk.debian.org wheezy/non-free Translation-en [66.1 kB]
Fetched 16.8 MB in 15s (1,064 kB/s)
Reading package lists... Done
W: GPG error: http://packages.yourdomain wheezy Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1639B68C40E3D96F
Check out which of your keys is missing:
(127) root@debiansvr /var/tmp
# apt-key list
/etc/apt/trusted.gpg
--------------------
pub   1024D/F42584E6 2008-04-06 [expired: 2012-05-15]
uid                  Lenny Stable Release Key 

pub   4096R/55BE302B 2009-01-27 [expired: 2012-12-31]
uid                  Debian Archive Automatic Signing Key (5.0/lenny) 

pub   2048R/6D849617 2009-01-24 [expired: 2013-01-23]
uid                  Debian-Volatile Archive Automatic Signing Key (5.0/lenny)

pub   1024D/DB782D34 2007-10-11
uid                  Matt Baker (Package Maintainer) 
sub   2048g/A5734914 2007-10-11

pub   1024D/7F1D2347 2006-08-23 [expired: 2011-10-20]
uid                  Index Data (Package Key) 

pub   1024D/773F7ECF 2009-03-10 [expires: 2015-03-27]
uid                  Nightly Build (ILRT autonomous builder) 
sub   2048g/DC9C4CFD 2009-03-10 [expires: 2015-03-27]

pub   1024D/DC2698A1 2006-02-23
uid                  steve.org.uk APT key (This key is only used to sign the APT repository at http://www.steve.org.uk/apt/) 
sub   2048g/0CB6CBA8 2006-02-23

pub   4096R/B98321F9 2010-08-07 [expires: 2017-08-05]
uid                  Squeeze Stable Release Key 

pub   4096R/473041FA 2010-08-27 [expires: 2018-03-05]
uid                  Debian Archive Automatic Signing Key (6.0/squeeze) 

pub   4096R/8D77295D 2009-07-12
uid                  Eric Evans 
uid                  Eric Evans 
uid                  Eric Evans 
uid                  Eric Evans 
sub   4096R/C47D63C0 2009-07-12

pub   2048R/2B5C1B00 2011-04-13
uid                  Sylvain Lebresne (pcmanus) 
sub   2048R/9CB2AA80 2011-04-13

pub   1024D/16BA136C 2005-08-21
uid                  Backports.org Archive Key 
sub   2048g/5B82CECE 2005-08-21

pub   4096R/46925553 2012-04-27 [expires: 2020-04-25]
uid                  Debian Archive Automatic Signing Key (7.0/wheezy) 

pub   4096R/65FFB764 2012-05-08 [expires: 2019-05-07]
uid                  Wheezy Stable Release Key 

pub   2048R/40E3D96F 2014-08-06
uid                  UOB package repo admin (Central software repo admin) 
sub   2048R/C92A16D8 2014-08-06

/etc/apt/trusted.gpg.d//debian-archive-jessie-stable.gpg
--------------------------------------------------------
pub   4096R/518E17E1 2013-08-17 [expires: 2021-08-15]
uid                  Jessie Stable Release Key 

/etc/apt/trusted.gpg.d//debian-archive-squeeze-automatic.gpg
------------------------------------------------------------
pub   4096R/473041FA 2010-08-27 [expires: 2018-03-05]
uid                  Debian Archive Automatic Signing Key (6.0/squeeze) 

/etc/apt/trusted.gpg.d//debian-archive-squeeze-stable.gpg
---------------------------------------------------------
pub   4096R/B98321F9 2010-08-07 [expires: 2017-08-05]
uid                  Squeeze Stable Release Key 

/etc/apt/trusted.gpg.d//debian-archive-wheezy-automatic.gpg
-----------------------------------------------------------
pub   4096R/46925553 2012-04-27 [expires: 2020-04-25]
uid                  Debian Archive Automatic Signing Key (7.0/wheezy) 

/etc/apt/trusted.gpg.d//debian-archive-wheezy-stable.gpg
--------------------------------------------------------
pub   4096R/65FFB764 2012-05-08 [expires: 2019-05-07]
uid                  Wheezy Stable Release Key 

(0) root@debiansvr /var/tmp
Download the Release and Release.pgp files of the repos. Get the keys and install them:
$ wget http://packages.yourdomain/debian/dists/wheezy/Release.gpg
$ wget http://packages.yourdomain/debian/dists/wheezy/Release
$ gpg Release.gpg
$ gpg --recv-keys 65FFB764
$ gpg --recv-keys 46925553
or just copy the /etc/apt/trusted.gpg file from a system that works over and run apt-get update ;)