Troubleshooting Exercises:

Exercise 1: New version of R

In this exercise you’ll determine why a new version of R added to the server does not work with RStudio Server Pro.

Hint: Use sudo su or sudo -i to open an interactive root prompt instead of typing sudo with every command.

First, add the pre-compiled version of R to the server:

sudo cp /usr/share/class/pro_admin_training_assets/06_troubleshooting/3.0.0.tar.gz /opt/R/
cd /opt/R
sudo tar xf 3.0.0.tar.gz
ls -la

Now, restart RStudio Server for the new version of R to be detected:

sudo service rstudio-server stop
sudo service rstudio-server start

Any errors?

Are any errors observed? Review the output of:

sudo service rstudio-server status -l
sudo journalctl -u rstudio-server

Errors

ERROR R shared library (/opt/R/3.0.0/lib/R/lib/libR.so) not found. 
If this is a custom build of R, was it built with the --enable-R-shlib option?

Things to check

How do you investigate this further?

  • Do you have permissions to access libR.so if it exists?

    sudo namei -l /opt/R/3.0.0/lib/R/lib/libR.so
  • Does libR.so exist anywhere else?

    sudo updatedb
    sudo locate libR.so

    updatedb updates the database used by locate

  • What ./configure flags was this version of R compiled with? Was it built with the –enable-R-shlib option?

    grep configure /opt/R/3.0.0/lib/R/etc/Makeconf

Back to square one

Once finished, remove the version of R and start the service:

sudo service rstudio-server stop
sudo rm -rf /opt/R/3.0.0
sudo service rstudio-server start

Exercise 2: Troubleshooting an existing R version

In this exercise you’ll determine why an existing version of R on the server does not work for users anymore.

First, execute the existing_R_version script to begin the scenario:

cd /usr/share/class/pro_admin_training_assets/06_troubleshooting/
sudo chmod +x existing_R_version
sudo ./existing_R_version

Now, restart RStudio Server.

sudo service rstudio-server stop
sudo service rstudio-server start

Are any errors observed? Review the output of:

sudo service rstudio-server status -l
sudo journalctl -u rstudio-server
sudo service rstudio-server stop
sudo rstudio-server verify-installation
sudo service rstudio-server start

Errors

WARNING R version home directory not found: /opt/R/3.5.1/lib/R;

Things to check

How do you investigate this further?

  • Does the home directory exist for R 3.5.1 and are the permissions OK?

    sudo ls -la /opt/R/3.5.1/lib/R
  • Was it detected by RStudio Server Pro in this internal file?

    cat /var/lib/rstudio-server/r-versions

    This undocumented r-versions file contains information regarding the R versions detected by RStudio Server Pro

  • Can you launch that version of R from the command line?

    /opt/R/3.5.1/bin/R
  • What have you missed? Was there any command tried when troubleshooting the last R issue?

    Hint: namei -l /opt/R/3.5.1/bin/R

Once the issue has been identified, please correct and restart the service.

Solution

The permissions on /opt/R/3.5.1 were restricted to rwx by root only. This is a common oversight when installing additional versions of R. To resolve, reset permissions to allow r-x by all:

sudo chmod 755 /opt/R/3.5.1/

Troubleshooting an R session crash

In this exercise, your users have reported that after logging into Rstudio Server Pro, the session crashes with an Unable to connect to service error. Maintenance was performed recently by your IT group.

To begin the scenario, execute the r_Session_crash script:

cd /usr/share/class/pro_admin_training_assets/06_troubleshooting/
sudo chmod +x r_Session_crash
sudo ./r_Session_crash

Are you able to reproduce the issue with your admin-user by logging into RStudio Server Pro or by starting a new session?

Investigation

How do you investigate the error, Unable to connect to service, further?

  • Does the rstudio-server.log contain anything relevant?
tail -n 30 /var/lib/rstudio-server/monitor/log/rstudio-server.log
  • What would cause an inability to find libR.so?

  • Does disabling the execution of the shell profiles resolve the issue? To try, edit the rserver.conf file:

/etc/rstudio/rserver.conf

rsession-no-profile=1

Then restart the service:

service rstudio-server stop
service rstudio-server start
  • Are you still able to reproduce the issue with your admin-user by logging into RStudio Server Pro or by starting a new session?

This option, to disable startup scripts, is a good way to troubleshoot the inability for sessions to launch, as it could indicate a conflict is occuring due to environment variables being set in the shell profiles.

  • To track down the source of the issue, review these common startup files:
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile

Does anything appear inaccurate?

Solution

The /etc/profile script modified the LD_LIBRARY_PATH to an invalid value.

Remember to modify the /etc/profile script to remove the invalid line and comment out rsession-no-profile=1 in your /etc/rstudio/rserver.conf file.