Unable to run apt update: At least one invalid signature was encountered

aptlinuxlinux-mintUbuntu

My Linux Mint 20 installation suddenly stopped updating. Update Manger says "Your APT configuration is corrupt". Running apt update produces the following messages:

Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]      
Get:2 http://ppa.launchpad.net/kdenlive/kdenlive-stable/ubuntu focal InRelease [18,1 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]                
Err:2 http://ppa.launchpad.net/kdenlive/kdenlive-stable/ubuntu focal InRelease 
  At least one invalid signature was encountered.
Err:1 http://security.ubuntu.com/ubuntu focal-security InRelease
  At least one invalid signature was encountered.
Err:3 http://archive.ubuntu.com/ubuntu focal InRelease
  At least one invalid signature was encountered.
Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Err:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  At least one invalid signature was encountered.
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Err:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  At least one invalid signature was encountered.
Ign:6 http://packages.linuxmint.com ulyana InRelease                           
Get:7 http://packages.linuxmint.com ulyana Release [24,1 kB]                   
Get:8 http://packages.linuxmint.com ulyana Release.gpg [833 B]                 
Ign:8 http://packages.linuxmint.com ulyana Release.gpg   
Get:9 http://archive.canonical.com/ubuntu focal InRelease [12,1 kB]            
Err:9 http://archive.canonical.com/ubuntu focal InRelease                      
  At least one invalid signature was encountered.
Reading package lists... Done
W: GPG error: http://ppa.launchpad.net/kdenlive/kdenlive-stable/ubuntu focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://ppa.launchpad.net/kdenlive/kdenlive-stable/ubuntu focal InRelease' 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.
W: GPG error: http://security.ubuntu.com/ubuntu focal-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://security.ubuntu.com/ubuntu focal-security InRelease' 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.
W: GPG error: http://archive.ubuntu.com/ubuntu focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu focal InRelease' 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.
W: GPG error: http://archive.ubuntu.com/ubuntu focal-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu focal-updates InRelease' 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.
W: GPG error: http://archive.ubuntu.com/ubuntu focal-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu focal-backports InRelease' 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.
W: GPG error: http://packages.linuxmint.com ulyana Release: At least one invalid signature was encountered.
E: The repository 'http://packages.linuxmint.com ulyana 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.
W: GPG error: http://archive.canonical.com/ubuntu focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.canonical.com/ubuntu focal InRelease' 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.

I tried running apt clean, but this did not resolve the issue.
Also, apt-key list gives the following strange message:

base64: invalid input

Please help.

Best Answer

Found solution for my case!

apt-get update wrote that in many repos "At least one invalid signature was encountered." There were no messages about missed GPG keys. Exactly like your output, but other repos.

I run apt-key list and somewhere in between i noticed base64: invalid input message.

This was somewhere in the middle of my output

/etc/apt/trusted.gpg.d/nordvpn-keyring.gpg
------------------------------------------
pub   rsa4096 2018-08-02 [SC]
      BC54 80EF EC5C 081C E5BC  FBE2 6B21 9E53 5C96 4CA1
uid           [ unknown] NordVPN <[email protected]>
sub   rsa4096 2018-08-02 [S]

base64: invalid input      <--- THIS IS THE PROBLEM 🚩
/etc/apt/trusted.gpg.d/steam.gpg
--------------------------------
pub   rsa2048 2012-12-07 [SC]
      BA18 16EF 8E75 005F CF5E  27A1 F24A EA9F B054 98B7
uid           [ unknown] Valve Corporation <[email protected]>
sub   rsa2048 2012-12-07 [E]

I found that it means that there is bad key file in a folder /apt/trusted.gpg.d/ between nordvpn-keyring.gpg and steam.gpg (alphabetical order of files). In my case there were two strange files with not .gpg extension. These files were newer than others. This was another clue about their involvement.

I deleted them and suddenly everything started to work!

It seems that all key files that was listed after those two was not worked.

// Linux Mint 19

Related Question