执行apt-get update

sudo apt-get update
Ign http://archive.canonical.com trusty InRelease
Ign http://extras.ubuntu.com trusty InRelease


Ign http://security.ubuntu.com trusty-security InRelease
Hit http://archive.canonical.com trusty Release.gpg
Get:1 http://extras.ubuntu.com trusty Release.gpg [72 B]
Hit http://security.ubuntu.com trusty-security Release.gpg
Hit http://archive.canonical.com trusty Release
Hit http://extras.ubuntu.com trusty Release
Ign http://extras.ubuntu.com trusty Release
Hit http://security.ubuntu.com trusty-security Release
Hit http://archive.canonical.com trusty/partner Sources
Ign http://extras.ubuntu.com trusty/main Sources/DiffIndex
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://archive.canonical.com trusty/partner amd64 Packages
Ign http://extras.ubuntu.com trusty/main amd64 Packages/DiffIndex
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://archive.canonical.com trusty/partner i386 Packages
Ign http://extras.ubuntu.com trusty/main i386 Packages/DiffIndex
Hit http://security.ubuntu.com trusty-security/multiverse Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Ign http://archive.canonical.com trusty/partner Translation-en
Hit http://extras.ubuntu.com trusty/main Sources
Hit http://security.ubuntu.com trusty-security/multiverse amd64 Packages
Hit http://extras.ubuntu.com trusty/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/main i386 Packages
Hit http://extras.ubuntu.com trusty/main i386 Packages
Hit http://security.ubuntu.com trusty-security/universe i386 Packages
Hit http://security.ubuntu.com trusty-security/multiverse i386 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/multiverse Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Ign http://extras.ubuntu.com trusty/main Translation-en_US
Ign http://extras.ubuntu.com trusty/main Translation-en
Fetched 72 B in 6s (10 B/s)
Reading package lists... Done

错误代码:

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 XXXXXXXXXXXXXXXXXX (#XXXX为PUBKEY

解决方案:

执行:apt-key adv --recv-keys --keyserver keyserver.ubuntu.com XXXXXX(#XXX为上面显示的PUBKEY

返回结果类似:

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.4nKa9OOenR --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com XXXXXXXXXXXXX
gpg: requesting key 3E5C1192 from hkp server keyserver.ubuntu.com
gpg: key XXXXXXXXX: public key "Ubuntu Extras Archive Automatic Signing Key <[email protected]>" imported
gpg: Total number processed: 1
gpg: imported: 1

 

PS:如果无法执行请在命令前加sudo