ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
34

apt update fails / cannot install pkgs: key not working?

asked 2019-06-08 02:12:04 -0500

gvdhoorn gravatar image

updated 2019-09-05 06:09:58 -0500

When trying to install packages, I'm seeing errors similar to the following:

Err:1 http://packages.ros.org/ros/ubuntu <YOUR_UBUNTU_VERSION>/main amd64 <SOME_ROS_PKG> amd64 0.13.3-0xenial-20190320-132757-0800
  404  Not Found [IP: 64.50.236.52 80]

While running sudo apt update I see the following error:

W: GPG error: http://packages.ros.org <YOUR_UBUNTU_VERSION> InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5523BAEEB01FA116

and or:

W: Failed to fetch http://packages.ros.org/ros/ubuntu/dists/<YOUR_UBUNTU_VERSION>/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
W: Some index files failed to download. They have been ignored, or old ones used instead.

While running sudo apt install I see the following error:

WARNING: The following packages cannot be authenticated! <some_pkgs>

and also sometimes (just an example, could be any package or ROS version):

E: Failed to fetch http://packages.ros.org/ros/ubuntu/pool/main/r/ros-kinetic-realtime-tools/ros-kinetic-realtime-tools_1.11.1-0xenial-20190320-130942-0800_amd64.deb  404  Not Found [IP: 64.50.236.52 80]

This completely prevents me from installing ROS (and related) packages.

edit retag flag offensive close merge delete

Comments

Related: #q324350.

gvdhoorn gravatar image gvdhoorn  ( 2019-06-08 02:26:45 -0500 )edit

6 Answers

Sort by ยป oldest newest most voted
114

answered 2019-06-08 02:22:14 -0500

gvdhoorn gravatar image

updated 2022-05-17 12:26:02 -0500

Cause

The old key has been revoked as part of the measures to deal with a recent security incident with build.ros.org (Security issue on ROS build farm).

The key has been updated and the old one is no longer valid, causing the issues with apt update and apt install.

The keys have also changed for the ROS 2 repositories, see: Key rotation for ROS 2 apt repositories.

Compare:

  • old key: 421C365BD9FF1F717815A3895523BAEEB01FA116
  • new key: C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

Solution

Refer to New GPG keys deployed for packages.ros.org for the full write-up, but as a summary these are the commands for Ubuntu (and Debian):

Remove the old key

  • on Ubuntu 16.04 and newer (with ROS Kinetic, Melodic, etc):

    sudo apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116
    
  • on Ubuntu 15.10 and older (ie: 14.04, from here):

    sudo apt-key del B01FA116
    

Import the new key

This command should work on all versions of Ubuntu:

# add the new key
sudo -E apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

if this results in errors (similar to "gpg: keyserver receive failed: End of file" or others indicating the key server could not be reached), an alternative would be (make sure curl is installed):

curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

Final step

At this point make sure to run sudo apt clean && sudo apt update. You should receive no errors and subsequent sudo apt install commands should also now work.

Additional notes

Installation tutorials are in the process of being updated, so if you're following one and you are seeing key-related errors, check that the tutorial is using the correct key.

If it isn't, notify the author or maintainer of the tutorial or website so it can be updated.

edit flag offensive delete link more

Comments

this helped me. Thanks a lot.

AlexR gravatar image AlexR  ( 2019-06-10 04:58:47 -0500 )edit

Thank you! A little addition: Add the "-E" option to sudo in order to use environment variables in case you are trying to connect from beyond a firewall. (This requires to set the proxy variables for apt e.g. in "/etc/apt/conf.d".)

sudo -E  apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

See also: https://askubuntu.com/a/654973

Zacryon gravatar image Zacryon  ( 2019-06-11 03:28:17 -0500 )edit

@Zacryon: I feel it's rather specific to your setup, but I've updated the answer.

gvdhoorn gravatar image gvdhoorn  ( 2019-06-11 03:31:44 -0500 )edit

This worked for me as well, thanks a lot.

Radeshwar gravatar image Radeshwar  ( 2019-06-19 04:57:36 -0500 )edit

Its work for Melodic as well

cesarhcq gravatar image cesarhcq  ( 2019-06-20 18:25:18 -0500 )edit

Thanks! works :D (Ubuntu 18.04, melodic)

Oscar Lima gravatar image Oscar Lima  ( 2019-06-24 08:20:52 -0500 )edit

I tried this and it solved the issue with the key, but I still get:

Get:29 http://packages.ros.org/ros/ubuntu xenial/main amd64 Packages [3.150 kB] Err:29 http://packages.ros.org/ros/ubuntu xenial/main amd64 Packages Writing more data than expected (3151533 > 3149706) [IP: 64.50.236.52 80]

anyone else experiencing this?

matteolucchi gravatar image matteolucchi  ( 2019-07-24 10:46:25 -0500 )edit

Did you try to execute "sudo apt-get update" again? After modification of the key.

cesarhcq gravatar image cesarhcq  ( 2019-07-24 11:00:50 -0500 )edit
1

answered 2019-06-19 05:55:50 -0500

nickzherdev gravatar image

That didn't work for me.

This command did:

sudo launchpad-getkeys
edit flag offensive delete link more

Comments

6

Can you clarify what "didn't work for me" means exactly?

It didn't import the correct key? It couldn't reach the key server? Something else?

gvdhoorn gravatar image gvdhoorn  ( 2019-06-19 06:47:44 -0500 )edit

Thanks, this answer is work for me.

nunuwin gravatar image nunuwin  ( 2019-06-22 01:12:30 -0500 )edit

Thanks. it worked

rayane gravatar image rayane  ( 2019-07-10 03:21:38 -0500 )edit

Thank you, it was very helpful. Regards

mecb1407 gravatar image mecb1407  ( 2019-09-28 16:18:48 -0500 )edit

Hi, Thank you it helped for me.

suryak614 gravatar image suryak614  ( 2022-05-03 15:26:34 -0500 )edit

I'm getting launchpad-getkeys:command not found

pans gravatar image pans  ( 2022-12-07 11:49:39 -0500 )edit
0

answered 2020-07-06 01:51:31 -0500

parzival gravatar image

gvdhoorn has a fantastic answer. I'd just like to point to solution to a problem which can be caused on remote machines like a Raspberry Pi. I had renewed the keys and was surprised as I still received the error.

I checked the expiry date using the command sudo apt-key list | grep -A 1 expired and found that the key wasn't expired yet, still it showed as expired.

I later found the time of my system (Raspberry Pi) was wrong and showed year 2024.

A simple sync via internet (using a command like sudo ntpdate time.windows.com) fixed the date, and then the apt update and apt install commands ran perfectly!

edit flag offensive delete link more
0

answered 2021-12-25 18:46:47 -0500

rammi gravatar image

hi I am new to ros and trying to follow a ros2 installation tutorial form this YouTube video (https://www.youtube.com/watch?v=-AouI...) but i keep getting the same error constantly I have tried the solutions provided above but did not improve anything I am using ubuntu in a virtual machine on Mac.

parallels@ubuntu-linux-20-04-desktop:~$ sudo apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116 OK parallels@ubuntu-linux-20-04-desktop:~$ sudo -E apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 Executing: /tmp/apt-key-gpghome.6cydgLlBka/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 gpg: keyserver receive failed: No name parallels@ubuntu-linux-20-04-desktop:~$ sudo ntpdate time.windows.com sudo: ntpdate: command not found parallels@ubuntu-linux-20-04-desktop:~$ sudo -E apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 Executing: /tmp/apt-key-gpghome.Ug3PX2PVGh/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 gpg: keyserver receive failed: No name parallels@ubuntu-linux-20-04-desktop:~$ sudo apt clean && sudo apt update Get:1 http://packages.ros.org/ros/ubuntu focal InRelease [4,676 B]
Err:1 http://packages.ros.org/ros/ubuntu focal InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654 Hit:2 http://ports.ubuntu.com/ubuntu-ports focal InRelease Hit:3 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease Hit:4 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease Hit:5 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease Reading package lists... Done W: GPG error: http://packages.ros.org/ros/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654 E: The repository 'http://packages.ros.org/ros/ubuntu focal InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. parallels@ubuntu-linux-20-04-desktop:~$

edit flag offensive delete link more
0

answered 2022-12-07 03:00:02 -0500

pans gravatar image

After adding the new key, when I execute sudo apt clean && sudo apt update I'm still getting the same error.

edit flag offensive delete link more
0

answered 2023-06-27 04:44:46 -0500

The following solution worked for me on Ubuntu 16.04, trying to install the Clearpath Robotics ROS Kinetic Libraries.

Step 1 - Check the Sources List has Referenced to the ROS Packages Within your sources.list file, ensure you have deb http://packages.ros.org/ros/ubuntu xenial main.

You can view your sources.list file using the command below in the terminal:

sudo nano /etc/apt/sources.list

If it's not in there, create a new line with the ROS address as above, and then save and exit.

Step 2 - Do a sudo apt-get-update Bring in the new libraries by executing the following.

sudo apt-get update

At this point, my sudo apt-get update failed, this was because I was missing a ROS Package Key that needed to be added.

If you do get an error, it may look like this:

W: GPG error: http://packages.ros.org/ros/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654 W: The repository 'http://packages.ros.org/ros/ubuntu xenial InRelease' is not signed. N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. N: See apt-secure(8) manpage for repository creation and user configuration details.

If so, proceed to step 3.

Step 3 - Adding your ROS Key In your terminal run the following command: sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

Step 4 - Run another sudo apt-get update

As the title suggests, run sudo apt-get update.

Step 5 - Install ROS Kinetic for the Husky

sudo apt-get install ros-kinetic-husky-desktop sudo apt-get install ros-kinetic-husky-simulator

This worked for me. Hope it works!

edit flag offensive delete link more

Question Tools

6 followers

Stats

Asked: 2019-06-08 02:12:04 -0500

Seen: 114,225 times

Last updated: May 17 '22