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

如何修復 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。

使用 Pano 改進 Gnome Shell 剪貼板

使用 Pano 改進 Gnome Shell 剪貼板

讓我們面對現實吧,默認的 Gnome Shell 剪貼板並不是很好。安裝 Pano 來改善您的剪貼板體驗!

如何在Linux上安裝DaVinci Resolve 17

如何在Linux上安裝DaVinci Resolve 17

您的 Linux 機器需要一個出色的非線性視頻編輯器嗎?使用本指南使用 Davinci Resolve 17!

如何使用壁紙下載器將壁紙下載到 Linux 桌面

如何使用壁紙下載器將壁紙下載到 Linux 桌面

Wallpaper Downloader 是一個靈活的 Linux 壁紙下載和管理器。它支持大多數Linux桌面環境,並且非常易於使用。本指南

如何在計算機上安裝 Tuxedo 操作系統

如何在計算機上安裝 Tuxedo 操作系統

想要通過 Tuxedo 計算機測試 Tuxedo 操作系統嗎?了解如何讓最新版本的 Tuxedo OS 在您的 PC 上運行。

如何在 Linux 上安裝 DEB 文件

如何在 Linux 上安裝 DEB 文件

什麼是 .DEB 文件?你用它做什麼?了解在 Linux PC 上安裝 DEB 文件的多種方法。

如何在 Linux 上玩消逝的光芒

如何在 Linux 上玩消逝的光芒

《消逝的光芒》是一款由 Techland 開發、華納兄弟互動娛樂發行的 2015 年生存恐怖視頻遊戲。遊戲的中心是

如何在計算機上安裝 Neptune Linux

如何在計算機上安裝 Neptune Linux

Neptune 使用 KDE Plasma 5 桌面環境,旨在提供優雅的操作系統。以下是如何在計算機上安裝 Neptune Linux。

嘗試 Ubuntu 的新基於 snap 的桌面

嘗試 Ubuntu 的新基於 snap 的桌面

想嘗試 Ubuntu 的新的基於 snap 包的桌面操作系統嗎?通過本指南了解如何將其部署在虛擬機上。

如何在 Linux 上玩《傳說之下》

如何在 Linux 上玩《傳說之下》

Undertale 是一款 2015 年 2D 獨立角色扮演遊戲,由遊戲開發商 Toby Fox 開發和發行。本指南將介紹在您的電腦上下載和安裝 Undertale

如何在 Linux 上玩《全面戰爭:三個王國》

如何在 Linux 上玩《全面戰爭:三個王國》

《全面戰爭:三個王國》是一款由 Creative Assembly 開發的回合製策略 RTS 遊戲。下面是如何在 Linux 上玩遊戲。