如何修復 Ubuntu 上的“NO_PUBKEY”GPG 錯誤

當用戶將軟件存儲庫或 PPA 添加到 Ubuntu 而不添加 GPG 簽名密鑰時,會發生“NO_PUBKEY”GPG 錯誤。由於 Ubuntu 的軟件後端非常重視安全性,系統將不允許用戶在沒有此密鑰的情況下從存儲庫安裝任何內容,因此出現此錯誤。幸運的是,它很容易修復。

在 Ubuntu 上有依賴錯誤?以下是修復它們的方法

修復“NO_PUBKEY”GPG 錯誤——GUI

On Ubuntu Linux, it is possible to fix the “NO_PUBKEY” issue with the GUI. To start the process, press the Win key on the keyboard. Pressing this button will bring up the search box in Gnome on Ubuntu. From there, start typing “Software & Updates” in the search box. Then, click on the icon with that name. Or, if you can’t find it, select the icon with the brown box/globe.

Once the “Software & Updates” app window is open on the screen, look through the different tabs in the app, and click on “Authentication.” Clicking on the “Authentication” tab will take you to the “Trusted software providers” area.

Keep the “Software & Updates” area open, and open up a new browser tab. Then, head over to the page where you got the software PPA from. On this page, look for the GPG signing key and save it to your computer.

進入 Launchpad 頁面後,單擊“技術詳細信息”以顯示簽名密鑰,單擊密鑰鏈接轉到下一頁。

如何修復 Ubuntu 上的“NO_PUBKEY”GPG 錯誤

在下一頁上,單擊“pub”旁邊的鏈接,以在瀏覽器中顯示密鑰。

如何修復 Ubuntu 上的“NO_PUBKEY”GPG 錯誤

按  鍵盤上的Ctrl + S將文件保存為key

如何修復 Ubuntu 上的“NO_PUBKEY”GPG 錯誤

將密鑰保存到 Ubuntu Linux PC 後,返回“身份驗證”部分中的“軟件和更新”應用程序。然後,在“身份驗證”部分,查找“導入密鑰文件”按鈕。

如何修復 Ubuntu 上的“NO_PUBKEY”GPG 錯誤

用鼠標單擊“導入密鑰文件”按鈕,打開文件瀏覽器窗口。然後,通過文件瀏覽器窗口將密鑰文件添加到 Ubuntu。

將密鑰文件添加到 Ubuntu 後,您將能夠從該軟件存儲庫安裝軟件。但是,在您嘗試從該存儲庫安裝軟件之前,您需要刷新 Ubuntu 的軟件源。

要刷新 Ubuntu 的軟件源,請單擊“關閉”按鈕。執行此操作時,將顯示一條消息,提示“有關可用軟件的信息已過期”。單擊“重新加載”按鈕進行刷新。一旦刷新,錯誤“NO_PUBKEY”就會消失。

修復“NO_PUBKEY”GPG 錯誤——命令行

“NO_PUBKEY” GPG 錯誤可以在終端中修復,也可以在 GUI 中修復。有些人會爭辯說,通過終端在 Ubuntu 中修復這個錯誤會更快。

通過按鍵盤上的 Ctrl + Alt + TCtrl + Shift + T在Ubuntu Linux PC 上打開終端窗口。然後,一旦終端窗口打開,使用更新命令到 Ubuntu 的軟件源,因為我們需要重現錯誤。

運行更新命令後,您將看到一條消息,指出“無法驗證以下簽名,因為公鑰不可用:NO_PUBKEY。”

在“NO_PUBKEY”消息之後,您將看到一個數字。用鼠標突出顯示此數字並將其複製到剪貼板。這個數字很重要,因為它可以與恢復命令一起使用,以自動將丟失的 GPG 密鑰導入您的 Ubuntu Linux 系統。

With the number saved to your clipboard, type out the following command in the terminal window. Be sure to replace the “COPIED-NUMBER-HERE” portion of the command with the number copied to the clipboard on your Linux PC.

Note: To use the paste feature in the Linux terminal, press Ctrl + Shift + V on the keyboard.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys COPIED-NUMBER-HERE

Let the apt-key command run, and it’ll download the missing GPG key directly from the internet. When the command finishes, you’ll see a message that says “public key “REPO NAME Singing Key imported”.

如何修復 Ubuntu 上的“NO_PUBKEY”GPG 錯誤

After successfully importing the missing GPG key into Ubuntu, the “NO_PUBKEY” error is taken care of. However, the fix is not complete, as Ubuntu’s software sources must be refreshed to reflect the changes made by importing the key.

To update Ubuntu’s software sources, you must use the update command.

sudo apt update

When the update command finishes running, everything should be in working order!

Prevent “NO_PUBKEY” errors on Ubuntu

The “NO_PUBKEY” error is easy to avoid. To ensure that you do not run into this problem on your Ubuntu Linux PC again, do the following.

  • Do not install any third-party software repository that does not provide a public key file.
  • 僅通過終端將 PPA 添加到 Ubuntu。通過終端添加PPA,密鑰文件會自動添加到系統中,避免“NO_PUBKEY”問題。
  • 切勿編輯軟件源文件以將第三方軟件存儲庫添加到 Ubuntu。

Leave a Comment

Mp3 Diags:修復多達 50 個 Mp3 音訊檔案問題

Mp3 Diags:修復多達 50 個 Mp3 音訊檔案問題

MP3 Diags 是修復音樂音訊收藏問題的終極工具。它可以正確標記您的 MP3 文件,添加缺少的專輯封面,修復 VBR

Google Voice 桌面通知應用

Google Voice 桌面通知應用

就像 Google Wave 一樣,Google Voice 也在全球引起了不小的轟動。谷歌的目標是改變我們的溝通方式,而且由於它正在成為

使用 FlickrFaves 下載 Flickr 收藏夾

使用 FlickrFaves 下載 Flickr 收藏夾

有許多工具可以讓 Flickr 用戶下載高品質的照片,但有沒有辦法下載 Flickr 收藏夾呢?最近我們

OK Sampler 是一款免費音樂取樣器軟體

OK Sampler 是一款免費音樂取樣器軟體

什麼是採樣?根據維基百科,「採樣是指從一段錄音中取出一部分或樣本,並將其重新用作樂器或

Google Sites 備份:匯入/匯出

Google Sites 備份:匯入/匯出

Google Sites 是 Google 提供的一項服務,可讓使用者在 Google 伺服器上託管網站。但有一個問題,它沒有內建備份選項

Google Tasks 桌面應用程式

Google Tasks 桌面應用程式

Google Tasks 不像其他 Google 服務(例如日曆、Wave、Voice 等)那麼受歡迎,但它仍然被廣泛使用,並且是人們生活中不可或缺的一部分。

如何恢復遺失的分割區和硬碟資料[指南]

如何恢復遺失的分割區和硬碟資料[指南]

在我們先前關於透過 Ubuntu Live 和 DBAN 啟動 CD 安全性擦除硬碟和可移動媒體的指南中,我們討論了基於 Windows 的磁碟

如何在 Linux 上玩 VRChat

如何在 Linux 上玩 VRChat

VRChat 是一款适用于 PC 的社交互动视频游戏。在 Linux 系统上轻松安装和运行 VRChat,享受用户创建的世界与社交互动。

如何在 Linux 上玩《殺戮尖塔》

如何在 Linux 上玩《殺戮尖塔》

Slay The Spire 是一款由 MegaCrit 开发、Humble Bundle 发行的 Roguelike 牌组构建视频游戏。本文讲述如何在 Linux 系统上顺利安装和运行该游戏。

如何在 Ubuntu 22.04 LTS 中禁用 Firefox snap

如何在 Ubuntu 22.04 LTS 中禁用 Firefox snap

了解如何卸载 Ubuntu 22.04 LTS 中的 Firefox Snap,不再使用 Snap 包,而是选择更原生的 DEB 版本。