I upgraded from Ubuntu 16.04 to Ubuntu 18.04 and cannot get R to run on it. I get the following error:

/usr/local/lib/R/bin/exec/R: error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory

This issue seems to have come up before in similar situations:

I tried purging the library and R and then reinstalling them, with no luck.

This is not a duplicate of how to install R on ubuntu 16.04. I could install R, but could not run it. I had also installed R on previous ubuntu versions without problems.

One thing that might help: I have no problem running R on another computer where I installed ubuntu 18.04; the problem occurs on the computer where I upgraded from 16.04 to 18.04, so something about the upgrading process might be the issue.

  • 3
    Possible duplicate of How to install R on Ubuntu 16.04 Xenial?
    – N0rbert
    Aug 27, 2019 at 8:15
  • I don't think so -- this is a guide to install R on Ubuntu. I follows these instructions, and R installed, but I cannot run it. I had R installed on previous Ubuntu versions before with no problem. Aug 28, 2019 at 16:52
  • Why do you have all this stuff in /usr/local? How exactly did you installed R? If you used deb-packages then they were installed in ordinary folders and not to /usr/local. If you have compiled R, then it was wrong method. Please add output of dpkg -l | grep "^ii\ \ r\-" and which R to the question.
    – N0rbert
    Aug 28, 2019 at 16:57
  • I followed these instructions: linuxize.com/post/how-to-install-r-on-ubuntu-18-04 Aug 28, 2019 at 17:12

5 Answers 5


I also came across this issue after upgrading to Ubuntu 18.04, and after spending some time looking into the issue I found that after upgrade libreadline package was missing, so I installed libreadline package using

sudo apt-get install libreadline-dev

But this also didn't solve my problem. Then I figured out that it installed the upgraded version of the libreadline package i.e libreadline.so.7.0. As a workaround I created its symlink so I can continue my work with libreadline.so.6.

$ cd /lib/x86_64-linux-gnu/
$ sudo ln -s libreadline.so.7.0 libreadline.so.6

And this worked wonders and my problem with libreadline package was solved.

  • 1
    I had to do sudo ln -s libreadline.so.8.0 libreadline.so.6 but it basically solved my problem. Thanks. Nov 7, 2021 at 22:12

This seems to have been an issue with the upgrade. I did not clean new install of Ubuntu 18.04 and then R, and the error disappeared.

  • What is the system for if you have to install it over and over. it is not toy story. It is Linx
    – kakaz
    Sep 15, 2020 at 11:13

You would use rm, i.e.

$ rm libreadline.so.6

Then you can simply recreate the symbolic link.


I had the same issue installing R in Anaconda. This is seemingly related to older versions of R. Symlinking to the newest version of libreadline created some error messages for me, so I'd thought I'd share the solution to install the "missing" version:

libreadline.so.6 is not provided by any official deb-packages in the Ubuntu repository, only Debian Jessie has package for it. If you want to save Anaconda - install this library manually by using commands below

cd ~/Downloads
wget -c wget
wget -c
sudo apt install ./libreadline6_6.3-8+b3_amd64.deb 
./multiarch-support_2.19-18+deb8u10_amd64.deb ```

This error is due to miss-match installation. Please check operating system version and install correct application version.

  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Aug 16, 2022 at 11:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .