user977828
user977828

Reputation: 7679

Rstudio-server unable to connect to service

While login to Rstudio Server with my user name and password, I received the following

Rstudio Initilization Error 
unable to connect to service

I installed Rstudio Server in the following way:

apt-get install gdebi-core r-base r-base-dev 
wget -c https://download2.rstudio.org/rstudio-server-0.99.489-amd64.deb
sudo gdebi rstudio-server-0.99.489-amd64.deb

sudo usermod -a -G rstudio lorencm
sudo service rstudio-server start

id  lorencm
uid=1000(lorencm) gid=1000(lorencm) groups=1000(lorencm),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),111(sambashare),999(docker),1001(rstudio)

What did I do wrong?

Upvotes: 11

Views: 19451

Answers (4)

Ben Terry
Ben Terry

Reputation: 61

I am running a Fedora server with SELinux, I used cockpit to look at the SELinux logs and could see that the Rhistory file was being blocked for access. In adding in the policy SELinux advised, I was then able to login without any issues.

Upvotes: 1

Mahmoud Elshaer
Mahmoud Elshaer

Reputation: 1

i experienced the same problem on fedora 32 and then i removed R packages & rstudio-server and reinstall them again and worked fine.

Upvotes: 0

Santosh Garole
Santosh Garole

Reputation: 1966

I was facing same issue & resolved by following:

  • disabling SELinux and rebooting the server.
  • The user with which you are logging in should be part of "rstudio-server" group.
  • rstudio-server:x:986:rconnect_admin
  • to add that user to rstudio-server group use usermod -a -G rstudio-server <username>

Here is the test process. I refer to the web page here: disable SELINUX ,

I tested the hypothesis about SELinux.

[testuser@third-test ~]$ sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     actual (secure)
Max kernel policy version:      31

I changed the directive SELinux=enforcing to SELinux=disabled

[testuser@third-test ~]$ sudo vi /etc/sysconfig/selinux

Then I reboot my system.

[testuser@third-test ~]$ sudo shutdown -r now

Now the SELinux is disabled.

[testuser@third-test ~]$ sestatus
SELinux status:                 disabled

Then the rstudio-server status looks good.

[testuser@third-test ~]$ sudo rstudio-server status
● rstudio-server.service - RStudio Server
   Loaded: loaded (/etc/systemd/system/rstudio-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-12-12 21:42:54 UTC; 2min 0s ago
  Process: 1091 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS)
 Main PID: 1135 (rserver)
​    Tasks: 3 (limit: 22408)
   Memory: 58.7M
   CGroup: /system.slice/rstudio-server.service
​           └─1135 /usr/lib/rstudio-server/bin/rserver

Dec 12 21:42:54 third-test systemd[1]: Starting RStudio Server...
Dec 12 21:42:54 third-test systemd[1]: Started RStudio Server.
[testuser@third-test ~]$ sudo rstudio-server status
● rstudio-server.service - RStudio Server
   Loaded: loaded (/etc/systemd/system/rstudio-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-12-12 21:42:54 UTC; 3min 37s ago
  Process: 1091 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS)
 Main PID: 1135 (rserver)
​    Tasks: 8 (limit: 22408)
   Memory: 141.0M
   CGroup: /system.slice/rstudio-server.service
​           ├─1135 /usr/lib/rstudio-server/bin/rserver
​           └─1662 /usr/lib/rstudio-server/bin/rsession -u testuser2 --launcher-token A8F380C6

Dec 12 21:42:54 third-test systemd[1]: Starting RStudio Server...
Dec 12 21:42:54 third-test systemd[1]: Started RStudio Server.

Another suggestion: It's always prefer not to use local authentication for login & use LDAP, Googleauth etc for login to the server.

Upvotes: 0

Ayman Salama
Ayman Salama

Reputation: 449

In my experience this might happen because of permission to your home directory or you don't have any home directory. possibly created by defauly with no home directory. to solve this, just create a home directory for the username that you are tryin to use or use an exisiting username with valide home directory

usermod -md /home/username username 

or just create one

sudo mkdir /home/username
sudo chown -R username /home/username

Good luck

Upvotes: 16

Related Questions