Software & AppsOperating SystemLinux

How To Fix “No Public Key Available” Error in Ubuntu’s APT Updates

Ubuntu 3

If you’re an Ubuntu user, you might have encountered the warning message “No Public Key Available” when running the sudo apt-get update command. This warning indicates that the public key for a specific repository is missing, making it impossible for the system to verify the authenticity of packages from that repository. In this article, we’ll guide you through the steps to fix this issue.

Quick Answer

To fix the "No Public Key Available" error in Ubuntu’s APT updates, you can either use the apt-key command to download the missing key from a keyserver or use the wget command to download the key from a different source. These methods will allow you to add the missing public key to the system’s keyring and resolve the issue.

Understanding the Issue

The warning message typically looks like this:

W: There is no public key available for the following key IDs: 1397BC53640DB551

The hexadecimal number 1397BC53640DB551 is the key ID for the missing public key. This key is used to authenticate the packages from the repository it belongs to.

How to Fix the Issue

There are a couple of ways to fix this issue. Both involve downloading the missing public key and adding it to the system’s keyring.

Method 1: Using the apt-key Command

The apt-key command is a program that manages the list of keys used by apt to authenticate packages. Packages which have been authenticated using these keys will be considered trusted.

To download the missing key, you can run the following command:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551

Here’s what each parameter does:

  • adv: This option allows you to perform advanced key management operations. It’s needed here because we’re communicating with a keyserver to download a key.
  • --keyserver keyserver.ubuntu.com: This tells apt-key to use the specified keyserver. In this case, we’re using keyserver.ubuntu.com.
  • --recv-keys 1397BC53640DB551: This tells apt-key to download the key with the specified ID.

After running this command, any packages from the repository associated with the downloaded key will be considered trusted.

Method 2: Using wget to Download the Key

If the first method doesn’t work, you can use the wget command to download the key from a different source:

wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -

Here’s what each parameter does:

  • -q: This option turns off wget’s output.
  • -O -: This tells wget to write the output to a file. The - indicates that the output should be written to standard output.
  • https://dl.google.com/linux/linux_signing_key.pub: This is the URL of the key.
  • | sudo apt-key add -: This pipes the output of the wget command (the downloaded key) to the apt-key add command, which adds the key to the system’s keyring.

Conclusion

In this article, we’ve shown you how to fix the “No Public Key Available” error in Ubuntu’s APT updates. We’ve explained how to use the apt-key command to download the missing key from a keyserver, and how to use wget to download the key from a different source. With these methods, you should be able to resolve the issue and continue with your system updates.

Why am I getting the “No Public Key Available” error in Ubuntu’s APT updates?

The "No Public Key Available" error occurs when the system is unable to verify the authenticity of packages from a specific repository due to a missing public key. This key is used to authenticate the packages from that repository.

How can I fix the “No Public Key Available” error?

There are two methods to fix this error. One method is using the apt-key command to download the missing key from a keyserver. The other method is using the wget command to download the key from a different source.

How do I use the `apt-key` command to fix the error?

To use the apt-key command, you can run the following command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys [KEY_ID]. Replace [KEY_ID] with the hexadecimal key ID provided in the error message. This command will download the missing key and add it to the system’s keyring.

What if the `apt-key` method doesn’t work?

If the apt-key method doesn’t work, you can try using the wget command. Use the command wget -q -O - [KEY_URL] | sudo apt-key add -, replacing [KEY_URL] with the URL of the key you want to download. This command will download the key from the specified source and add it to the system’s keyring.

Will fixing the “No Public Key Available” error make my system updates safe?

Fixing the "No Public Key Available" error ensures that the system can verify the authenticity of packages from the repository associated with the missing key. However, it is important to note that the overall security of your system depends on various factors, including the trustworthiness of the repository and the packages it provides. Always ensure that you are using trusted sources and regularly update your system to maintain security.

Leave a Comment

Your email address will not be published. Required fields are marked *