Ubuntu – W: GPG error and WARNING: The following packages cannot be authenticated!

aptgnupgpackage-managementupdatesupgrade

I am getting following output of sudo apt-get update and sudo apt-get upgrade command.

user@user-VPCCB45FN:~$ sudo apt-get update
......
......
Ign http://in.archive.ubuntu.com trusty-backports/main Translation-en_US
Ign http://in.archive.ubuntu.com trusty-backports/multiverse Translation-en_US 
Ign http://in.archive.ubuntu.com trusty-backports/restricted Translation-en_US 
Ign http://in.archive.ubuntu.com trusty-backports/universe Translation-en_US   
Fetched 3,581 kB in 59s (59.9 kB/s)                                            
Reading package lists... Done
W: GPG error: http://download.virtualbox.org trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 54422A4B98AB5139
W: GPG error: http://dl.google.com stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A040830F7FAC5991
W: GPG error: http://dl.google.com stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A040830F7FAC5991
W: GPG error: http://extras.ubuntu.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192
W: GPG error: http://archive.canonical.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http://in.archive.ubuntu.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: https://download.01.org trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A902DDA375E52366
W: GPG error: http://security.ubuntu.com trusty-security Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http://in.archive.ubuntu.com trusty-updates Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http://in.archive.ubuntu.com trusty-backports Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http://ppa.launchpad.net trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY CC079478E5B13347
user@user-VPCCB45FN:~$ sudo apt-get upgrade 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  hostapd
The following packages will be upgraded:
  apport apport-gtk python3-apport python3-problem-report
4 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 275 kB of archives.
After this operation, 5,120 B of additional disk space will be used.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
  python3-problem-report python3-apport apport apport-gtk
Install these packages without verification? [y/N] 

I tried following existing solution with NO luck:

  1. GPG ERROR NO_PUBKEY : WARNING: The following packages cannot be authenticated! [closed]
  2. How do I fix the GPG error “NO_PUBKEY”?

How can I solve this problem?

Best Answer

Finally, solved this problem by following steps:

sudo mv /etc/apt/trusted.gpg.d/ /etc/apt/trusted.gpg.d.backup
sudo mkdir /etc/apt/trusted.gpg.d
sudo chmod 755 /etc/apt/trusted.gpg.d

Then, for each key you need:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 54422A4B98AB5139

As mentioned in Cannot solve GPG error link.