1

I cannot rebuilt the /etc/apt/trusted.gpg keyring properly :

$ sudo rm /etc/apt/trusted.gpg
rm: remove regular file ‘/etc/apt/trusted.gpg’? y
$ sudo apt-key update 2>&1 | egrep "gpg:.*(invalid|failed)"
gpg: [don't know]: invalid packet (ctb=01)
gpg: keydb_get_keyblock failed: eof
gpg: [don't know]: invalid packet (ctb=01)
gpg: keydb_get_keyblock failed: eof
gpg: [don't know]: invalid packet (ctb=01)
gpg: keydb_get_keyblock failed: eof
gpg: [don't know]: invalid packet (ctb=01)
gpg: keydb_get_keyblock failed: eof
$ apt-key list >/dev/null
gpg: [don't know]: invalid packet (ctb=01)
gpg: keydb_search_next failed: invalid packet

EDIT 1 : I found this pb. was related to the keyrings in /etc/apt/trusted.gpg.d/, so I recreated them with add-apt-repository :

$ sudo mv /etc/apt/trusted.gpg.d /etc/apt/trusted.gpg.d.BACKUP
$ sudo mkdir /etc/apt/trusted.gpg.d
$ time awk -F / '/^deb .*ppa.launchpad.net/{print "sudo add-apt-repository -y ppa:"$4"/"$5}' /etc/apt/sources.list.d/*.list | sh -x
+ sudo add-apt-repository -y ppa:aims/sagemath
gpg: keyring `/tmp/tmpv9cab2oz/secring.gpg' created
gpg: keyring `/tmp/tmpv9cab2oz/pubring.gpg' created
gpg: requesting key BE796FF2 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpv9cab2oz/trustdb.gpg: trustdb created
gpg: key BE796FF2: public key "Launchpad PPA for AIMS" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
+ sudo add-apt-repository -y ppa:apandada1/brightness-controller
gpg: keyring `/tmp/tmp74ndc3fv/secring.gpg' created
gpg: keyring `/tmp/tmp74ndc3fv/pubring.gpg' created
gpg: requesting key A7803E3B from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp74ndc3fv/trustdb.gpg: trustdb created
gpg: key A7803E3B: public key "Launchpad PPA for Archisman Panigrahi" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
...
gpg: /tmp/tmp49wcgvjj/trustdb.gpg: trustdb created
gpg: key EEAD66BD: public key "Launchpad PPA for Xu Zhen" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

real    6m20.794s
user    5m49.528s
sys 0m17.888s
$ apt-key list >/dev/null
gpg: keyblock resource `/etc/apt/trusted.gpg.d/notepadqq-team-notepadqq.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/nowrep-qupzilla.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/octave-stable.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/openlp-core-release.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/otto-kesselgulasch-gimp.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/pinta-maintainers-pinta-stable.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/pmjdebruijn-gnoduino-release.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/privoox-privoox.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/pypy-ppa.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/rvm-smplayer.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/sbates-ppa.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/skunk-pepper-flash.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/smathot-cogscinl.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/stebbins-handbrake-releases.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/stefanobalocco-multimedia.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/team-xbmc-ppa.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/timchen119-bluez5-trusty.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/ubuntu-mate-dev-ppa.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/ubuntu-mate-dev-trusty-mate.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/ubuntu-toolchain-r-test.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/ufleisch-kid3.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/unit193-inxi.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/webupd8team-tor-browser.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/webupd8team-y-ppa-manager.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/wseverin-ppa.gpg': resource limit
gpg: keyblock resource `/etc/apt/trusted.gpg.d/xuzhen666-gnome-mpv.gpg': resource limit

After some digging, I found that GnuPG v1 (which a dependency of the Ubuntu Trust APT packet) cannot handle more than 40 keyrings, that it so say, it cannot handle more than 39 keyrings in /etc/apt/trusted.gpg.d/ (according to this : https://askubuntu.com/a/508337/426176 and that : https://www.mail-archive.com/gnupg-users@gnupg.org/msg23302.html)

EDIT 2 : I have removed 10 duplicate keys in /etc/apt/trusted.gpg.d/ :

$ sudo fdupes -rnASd /etc/apt/trusted.gpg.d
[1] /etc/apt/trusted.gpg.d/guardianproject-fdroidserver.gpg  
[2] /etc/apt/trusted.gpg.d/guardianproject-ppa.gpg

Set 1 of 6, preserve files [1 - 2, all] (916 bytes each): 2

   [-] /etc/apt/trusted.gpg.d/guardianproject-fdroidserver.gpg
   [+] /etc/apt/trusted.gpg.d/guardianproject-ppa.gpg

[1] /etc/apt/trusted.gpg.d/jonathonf-ffmpeg-3.gpg
[2] /etc/apt/trusted.gpg.d/jonathonf-ffmpeg-4.gpg
[3] /etc/apt/trusted.gpg.d/jonathonf-texlive.gpg
[4] /etc/apt/trusted.gpg.d/jonathonf-vim.gpg
[5] /etc/apt/trusted.gpg.d/jonathonf-vlc.gpg

Set 2 of 6, preserve files [1 - 5, all] (1135 bytes each): 2

   [-] /etc/apt/trusted.gpg.d/jonathonf-ffmpeg-3.gpg
   [+] /etc/apt/trusted.gpg.d/jonathonf-ffmpeg-4.gpg
   [-] /etc/apt/trusted.gpg.d/jonathonf-texlive.gpg
   [-] /etc/apt/trusted.gpg.d/jonathonf-vim.gpg
   [-] /etc/apt/trusted.gpg.d/jonathonf-vlc.gpg

[1] /etc/apt/trusted.gpg.d/noobslab-apps.gpg
[2] /etc/apt/trusted.gpg.d/noobslab-mint.gpg
[3] /etc/apt/trusted.gpg.d/noobslab-themes.gpg

Set 3 of 6, preserve files [1 - 3, all] (943 bytes each): 2

   [-] /etc/apt/trusted.gpg.d/noobslab-apps.gpg
   [+] /etc/apt/trusted.gpg.d/noobslab-mint.gpg
   [-] /etc/apt/trusted.gpg.d/noobslab-themes.gpg

[1] /etc/apt/trusted.gpg.d/webupd8team-tor-browser.gpg
[2] /etc/apt/trusted.gpg.d/webupd8team-y-ppa-manager.gpg

Set 4 of 6, preserve files [1 - 2, all] (6570 bytes each): 1

   [+] /etc/apt/trusted.gpg.d/webupd8team-tor-browser.gpg
   [-] /etc/apt/trusted.gpg.d/webupd8team-y-ppa-manager.gpg

[1] /etc/apt/trusted.gpg.d/ubuntu-mate-dev-ppa.gpg
[2] /etc/apt/trusted.gpg.d/ubuntu-mate-dev-trusty-mate.gpg

Set 5 of 6, preserve files [1 - 2, all] (1313 bytes each): 2

   [-] /etc/apt/trusted.gpg.d/ubuntu-mate-dev-ppa.gpg
   [+] /etc/apt/trusted.gpg.d/ubuntu-mate-dev-trusty-mate.gpg

[1] /etc/apt/trusted.gpg.d/mc3man-mpv-tests.gpg
[2] /etc/apt/trusted.gpg.d/mc3man-trusty-media.gpg

Set 6 of 6, preserve files [1 - 2, all] (527 bytes each): 2

   [-] /etc/apt/trusted.gpg.d/mc3man-mpv-tests.gpg
   [+] /etc/apt/trusted.gpg.d/mc3man-trusty-media.gpg

Is adding all my gpg launchpad ppa keys in the same /etc/apt/trusted.gpg keyring the only solution, it seems a little less ordered ?

EDIT 3 : Now I have 16 extra (rejected) keys in /etc/apt/trusted.gpg.d/, so I'm gonna move them to the /etc/apt/trusted.gpg keyring :

$ apt-key list 2>&1 >/dev/null | awk -F"[\`']" '/resource limit/{print "sudo apt-key add "$2" 2>/dev/null ; sudo \\rm -vf "$2}' | sh -x
+ sudo apt-key add /etc/apt/trusted.gpg.d/pypy-ppa.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/pypy-ppa.gpg
removed ‘/etc/apt/trusted.gpg.d/pypy-ppa.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/rvm-smplayer.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/rvm-smplayer.gpg
removed ‘/etc/apt/trusted.gpg.d/rvm-smplayer.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/sbates-ppa.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/sbates-ppa.gpg
removed ‘/etc/apt/trusted.gpg.d/sbates-ppa.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/skunk-pepper-flash.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/skunk-pepper-flash.gpg
removed ‘/etc/apt/trusted.gpg.d/skunk-pepper-flash.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/smathot-cogscinl.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/smathot-cogscinl.gpg
removed ‘/etc/apt/trusted.gpg.d/smathot-cogscinl.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/stebbins-handbrake-releases.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/stebbins-handbrake-releases.gpg
removed ‘/etc/apt/trusted.gpg.d/stebbins-handbrake-releases.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/stefanobalocco-multimedia.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/stefanobalocco-multimedia.gpg
removed ‘/etc/apt/trusted.gpg.d/stefanobalocco-multimedia.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/team-xbmc-ppa.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/team-xbmc-ppa.gpg
removed ‘/etc/apt/trusted.gpg.d/team-xbmc-ppa.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/timchen119-bluez5-trusty.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/timchen119-bluez5-trusty.gpg
removed ‘/etc/apt/trusted.gpg.d/timchen119-bluez5-trusty.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/ubuntu-mate-dev-trusty-mate.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/ubuntu-mate-dev-trusty-mate.gpg
removed ‘/etc/apt/trusted.gpg.d/ubuntu-mate-dev-trusty-mate.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/ubuntu-toolchain-r-test.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/ubuntu-toolchain-r-test.gpg
removed ‘/etc/apt/trusted.gpg.d/ubuntu-toolchain-r-test.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/ufleisch-kid3.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/ufleisch-kid3.gpg
removed ‘/etc/apt/trusted.gpg.d/ufleisch-kid3.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/unit193-inxi.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/unit193-inxi.gpg
removed ‘/etc/apt/trusted.gpg.d/unit193-inxi.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/webupd8team-tor-browser.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/webupd8team-tor-browser.gpg
removed ‘/etc/apt/trusted.gpg.d/webupd8team-tor-browser.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/wseverin-ppa.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/wseverin-ppa.gpg
removed ‘/etc/apt/trusted.gpg.d/wseverin-ppa.gpg’
+ sudo apt-key add /etc/apt/trusted.gpg.d/xuzhen666-gnome-mpv.gpg
+ sudo rm -vf /etc/apt/trusted.gpg.d/xuzhen666-gnome-mpv.gpg
removed ‘/etc/apt/trusted.gpg.d/xuzhen666-gnome-mpv.gpg’
$ apt-key list >/dev/null
$

Problem fixed.

  • I only see 26 keys listed. Why are you worried about 40 keys? – mchid Mar 27 at 15:17
  • @mchid These are the 26 rejected keys, I have 65 gpg keyrings in my /etc/apt/trusted.gpg.d/ : 65-26 = 39 :-) – SebMa Mar 27 at 15:19
  • did you delete 26 keys? – mchid Mar 27 at 15:28
  • @mchid 65 keys - 26 rejected_keys = 39 accepted_keys. No, I didn't delete any key, I want to keep them all. – SebMa Mar 27 at 16:03
1

Not to be harsh but you have way too many ppas and you need to get rid of some to fix your problem. Sorry :(

A lot of people use ppa-purge but I'm not 100% sure that this will remove the keys so you will have to check after you purge the ppa to make sure the key is gone as well.

Try and see if some ppas are using the same key number. If so, then you can delete the duplicate keys to help you get your number under 40. The Ubuntu mate ppas probably use the same key so you could probably delete a duplicate if you find one.

Additionally, some ppas like the webupd8 ppas (which probably also use the same key) are no longer maintained and so you can remove these ppas. Unfortunately, the webupd8 ppas haven't been updated since 2017.

The skunk pepperflash ppa hasn't been updated since 2016 and besides, you don't even need a pepperflash installer ppa because all you have to do is enable the Canonical repository in Software & Updates and then run: sudo apt update; sudo apt install adobe-flashplugin. Also see here.

The privoox ppa also hasn't been updated since 2016.

These are only the ppas that I have used Google to check. You will need to use Google to check the rest of these yourself to see which ppas are still active and which ones are no longer maintained.

  • 1
    I have removed 10 duplicate keys in /etc/apt/trusted.gpg.d/ (See my EDIT2). I'll take care of rest tomorrow because it's almost 3A.M (here in France). Thanks a lot for your help, bro. See ya – SebMa Mar 28 at 1:48
  • 1
    @SebMa Awesome! Now try and get rid of some of those dead ppas and you might be able to get your number under 40. – mchid Mar 28 at 1:52
  • 1
    I didn't bother to find which repositories were outdated, I just moved the extra keys from /etc/apt/trusted.gpg.d/ directory to the /etc/apt/trusted.gpg keyring (See my EDIT #3) – SebMa Mar 29 at 16:17
  • @SebMa Is it fixed now? – mchid Mar 29 at 23:51
  • 1
    Yes it is. I should have mentioned it earlier. Thanks man :-) – SebMa Mar 30 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.