Search code examples
rubuntuubuntu-14.04upgradepackage-management

Upgrade R on Kubuntu 14.4 LTS


How can I upgrade my R installation on Kubuntu 14.4 LTS from 3.0.2 to the current 3.2.4?

Something like

sudo su
echo "deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
apt-get update
apt-get upgrade

or a variation of this won't work - R will stay at 3.0.2. I tried replacing trusty/ with wily/, but that did not change anything either.


Solution

  • Normally https://www.digitalocean.com/community/tutorials/how-to-set-up-r-on-ubuntu-14-04 should work, but...

    One should check if the policies are set correctly. A repository with a higher Pin-Priority takes precedence over a repository with a lower Pin-Priority. If the Pin-Priority of two repositories is the same, the package with the newer version is installed.

    If the original Ubuntu repositories have a higher Pin-Priority than the new (e.g. deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu trusty/), then the new repository is not considered.

    Check the policies with

    sudo apt-cache policy r-base
    

    and remove ominous repositories. Then check the Pin-Priority. For example there might be a line like

     3.0.2-1ubuntu1 0
        500 http://de.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
    

    Here the repository is from de.archive.ubuntu.com and the Pin-Priority is 500. Installed packages have a Pin-Priority of 500. Giving a package a priority over 1000 (e.g. 1001) causes it to be preferred even if it's an older version that a package with a lower priority.

    apt checks in the folder /etc/apt/preferences.d/ and checks the files inside - regardless of their name! - for preferences. Such a file might look like

    Package: *
    Pin: release o=Ubuntu
    Pin-Priority: 1001
    

    Make sure that there is no such file or that it's lines are turned into comments with #.


    See https://unix.stackexchange.com/a/218955/122989 for reference.