Search code examples
rubuntuapt

Unable to add signing key for R 4.0 (cran40's repo) on Ubuntu 20.04


Following the instructions in How To Install R on Ubuntu 20.04, I ran

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

However, I got

Executing: /tmp/apt-key-gpghome.1GsKgnB078/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg: keyserver receive failed: Connection timed out

I have also followed the installation guide given by the R Linux offical websites, trying the command

wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc

But I waited for a long time and still got no response. As I only have very preliminary knowledge of Linux, I currently have no clue about how to find out the problem.


Solution

  • What matters is the key id not the server as the servers are mirrored so if it times out, try another. For what it is worth for me (under Docker for ease of setup / cleanup)

    (root):/# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
    Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
    Executing: /tmp/apt-key-gpghome.mSkX9qZonO/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
    gpg: key 51716619E084DAB9: "Michael Rutter <marutter@gmail.com>" 1 new signature
    gpg: Total number processed: 1
    gpg:         new signatures: 1
    (root):/# 
    

    So maybe try again? I also offer it in this script to set up r2u which uses these binaries along with over 20,000 CRAN packages as binaries you can install. So the step runs pretty often.

    So in conclusion, it may be a temporary network issue for you, or maybe something more sinister that a port is blocked. The service itself is fine.