Btibert3 Btibert3 - 5 months ago 26
Linux Question

Installing R from CRAN Ubuntu repository: No Public Key Error

Let me start by saying I am completely new to Linux (Ubuntu) and working with R. Currently, I am on R version 2.13 and would like to update to a newer version in order to use some packages that depend on R>= 2.14.

I have the line to my sources.list file as found described here. I then navigate to the terminal and type:

sudo apt-get update

and get the following error when trying to update R on the CRAN mirror closest to me:

Reading package lists... Done
W: GPG error: oneiric/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9

Since I am new to R under Ubuntu, I am unsure as how to debug this error.

Any help will be much appreciated.


Like @Ben Bolker commented (sorry I hijacked your commented, but the correct answer was not yet posted), in the description of the debian package repo there is a section secure apt which says:


The Debian backports archives on CRAN are signed with the key of "Johannes Ranke (CRAN Debian archive) " with key ID 381BA480. You can fetch this with

gpg --keyserver --recv-key 381BA480 or alternatively, using another key server,

gpg --keyserver --recv-key 381BA480 If this doesn't work, it might be due to a firewall blocking port 11371. Alternatively, you can search for 0x381BA480 at or and copy the key block into a plain text file, named, for instance, jranke_cran.asc.

If receiving the key with gpg did work, you need to export it to a text file

gpg -a --export 381BA480 > jranke_cran.asc In both cases you need to make the key known to the apt system by running

apt-key add jranke_cran.asc as root.

If you have not already done this, this will probably fix your issue.