Ask Your Question
17

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

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

gvdhoorn gravatar image

updated 2019-07-16 14:19:51 -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 imagegvdhoorn ( 2019-06-08 02:26:45 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
51

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

gvdhoorn gravatar image

updated 2019-07-13 08:11:41 -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

Final step

At this point make sure to run a 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 imageAlexR ( 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 imageZacryon ( 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 imagegvdhoorn ( 2019-06-11 03:31:44 -0500 )edit

This worked for me as well, thanks a lot.

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

Its work for Melodic as well

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

Thanks! works :D (Ubuntu 18.04, melodic)

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

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

2

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 imagegvdhoorn ( 2019-06-19 06:47:44 -0500 )edit

Thanks, this answer is work for me.

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

Thanks. it worked

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 10,311 times

Last updated: yesterday