4

I was following this instruction for installing R 4.0 in Ubuntu 18.04

$ sudo apt remove r-base
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
$ sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'
$ sudo apt update
$ sudo apt install r-base

However I get this error message:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package r-base is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  r-base-core r-doc-info r-doc-html r-base-html r-base-core:i386

E: Package 'r-base' has no installation candidate

I'm using this version of Ubuntu:

$ uname -a
Linux ip-172-31-28-209 5.4.0-1059-aws #62~18.04.1-Ubuntu SMP Fri Oct 22 21:51:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -cs bionic

How can I resolve the issue?


Update

$ sudo apt-cache policy r-base
r-base:
  Installed: (none)
  Candidate: (none)
  Version table:
     4.1.2-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.1.1-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.1.0-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.5-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.4-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.3-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.2-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.1-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.0-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     3.4.4-1ubuntu1 -1
         -1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages

Update 2

$ sudo apt install r-base=4.1.2-1.1804.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies: r-base : Depends: r-base-core (>= 4.1.2-1.1804.0) but it is not installable Depends: r-recommended (= 4.1.2-1.1804.0) but it is not installable Recommends: r-base-html but it is not installable Recommends: r-doc-html but it is not installable E: Unable to correct problems, you have held broken packages.

littleworth
  • 172
  • 2
  • 11

3 Answers3

2

Following suggestion by @user.dz, I ended up manually editing /etc/apt/preferences and replacing pin priority from -1 to 500

Package: *
Pin: release a=bionic*
Pin-Priority: 500
littleworth
  • 172
  • 2
  • 11
1

The Problem is :

$ sudo 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.D7jTjWc4gW/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     

When you run apt-key the keyserver is deprecated on /tmp/ like my case. The Ubuntu archives on CRAN are signed with the key of Michael Rutter marutter@gmail.com with key ID 0x51716619e084dab9. To add the key to your system with one command use

Recommended method :

$ wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
$ sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
$ sudo apt update
$ sudo apt install --no-install-recommends r-base     

Hope this helps.

Related

  • While pinning works for OP, this could be the root cause of the issue. I may check it later in a vm. – user.dz Dec 06 '21 at 13:26
  • 1
    @user.dz when OP try to install r-base aptitude try to install r-base v4.1 has no candidate as 'apt-cache' said. which holding the package if it use apt-key, i recommended to use secure apt in trusted.gpg, and the candidate should be appears. edit the preference is shortcut way and that's great idea. – abu-ahmed al-khatiri Dec 06 '21 at 13:51
  • I just tested in 18.04 same instructions OP used, however I get r-base with priority of 500, no warning when adding the key. So i couldn't reproduce the test case. – user.dz Dec 06 '21 at 20:57
-1

Given you get the message:

However the following packages replace it:
  r-base-core r-doc-info r-doc-html r-base-html r-base-core:i386

I am going to say perhaps r-base-core.

ThunderBird
  • 1,955
David
  • 1