无法在centos中启动rstudio获取错误“无法连接到服务”

时间:2021-07-17 20:28:21

I have Rstudio server installed on CentOS 6, but I cannot login to Rstudio from the browser at http://localhost:8787 in browser. A popup titled "RStudio Initialization Error" appears with message "Unable to connect to service".

我在CentOS 6上安装了Rstudio服务器,但是我不能在浏览器中以http://localhost:8787的浏览器登录到Rstudio。一个名为“RStudio初始化错误”的弹出框出现了“无法连接到服务”的消息。

I have tried the following to remedy the error, but I have been without success:

我试过以下方法来弥补这个错误,但我一直没有成功。

$ sudo rstudio-server verify-installation
rstudio-server stop/waiting
rserver[19273]: ERROR system error 13 (Permission denied) [username=rstudio-server]; OCCURRED AT: core::Error server::launchSession(const std::string&, const core::system::Options&, PidType*) /root/rstudio/src/cpp/server/ServerSessionManager.cpp:223; LOGGED FROM: int main(int, char* const*) /root/rstudio/src/cpp/server/ServerMain.cpp:428
rstudio-server start/running, process 19287

$ id -u supstat1
502 (user name is more than 500)

$ sudo usermod -g rstudio_users supstat1

$ sudo vi /etc/sysconfig/iptables as root
and added the following line(s)
Add -A INPUT -m state --state NEW -m tcp -p tcp --dport 8787 -j ACCEPT
Add -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

$ sudo lsof | grep rstudio
rserver   9597 rstudio-server  cwd       DIR                8,1      4096          2 /
rserver   9597 rstudio-server  rtd       DIR                8,1      4096          2 /
rserver   9597 rstudio-server  txt       REG                8,1   7990044     553699 /usr/lib/rstudio-server/bin/rserver
rserver   9597 rstudio-server  mem       REG                8,1    156928     391944 /lib64/ld-2.12.so
rserver   9597 rstudio-server  mem       REG                8,1   1926800     391948 /lib64/libc-2.12.so
rserver   9597 rstudio-server  mem       REG                8,1    599384     396110 /lib64/libm-2.12.so
rserver   9597 rstudio-server  mem       REG                8,1     22536     391993 /lib64/libdl-2.12.so
rserver   9597 rstudio-server  mem       REG                8,1    145896     391952 /lib64/libpthread-2.12.so
rserver   9597 rstudio-server  mem       REG                8,1     91096     391950 /lib64/libz.so.1.2.3
rserver   9597 rstudio-server  mem       REG                8,1   1410824     564111 /usr/lib64/libcrypto.so.0.9.8e
rserver   9597 rstudio-server  mem       REG                8,1    327488     567429 /usr/lib64/libssl.so.0.9.8e
rserver   9597 rstudio-server  mem       REG                8,1    124624     396127 /lib64/libselinux.so.1
rserver   9597 rstudio-server  mem       REG                8,1    113952     406171 /lib64/libresolv-2.12.so
rserver   9597 rstudio-server  mem       REG                8,1     18936     396128 /lib64/libuuid.so.1.3.0
rserver   9597 rstudio-server  mem       REG                8,1     93320     396113 /lib64/libgcc_s-4.4.7-20120601.so.1
rserver   9597 rstudio-server  mem       REG                8,1     17256     392157 /lib64/libcom_err.so.2.1
rserver   9597 rstudio-server  mem       REG                8,1    177520     392161 /lib64/libk5crypto.so.3.1
rserver   9597 rstudio-server  mem       REG                8,1     12592     406310 /lib64/libkeyutils.so.1.3
rserver   9597 rstudio-server  mem       REG                8,1    280520     392159 /lib64/libgssapi_krb5.so.2.2
rserver   9597 rstudio-server  mem       REG                8,1    944712     391997 /lib64/libkrb5.so.3.3
rserver   9597 rstudio-server  mem       REG                8,1    989840     536152 /usr/lib64/libstdc++.so.6.0.13
rserver   9597 rstudio-server  mem       REG                8,1     46368     406311 /lib64/libkrb5support.so.0.1
rserver   9597 rstudio-server  mem       REG                8,1     17520     406322 /lib64/libutil-2.12.so
rserver   9597 rstudio-server  mem       REG                8,1     65928     391959 /lib64/libnss_files-2.12.so
rserver   9597 rstudio-server    0u      CHR                1,3       0t0       3643 /dev/null
rserver   9597 rstudio-server    1u      CHR                1,3       0t0       3643 /dev/null
rserver   9597 rstudio-server    2u      CHR                1,3       0t0       3643 /dev/null
rserver   9597 rstudio-server    3r     FIFO                0,8       0t0      37905 pipe
rserver   9597 rstudio-server    4w     FIFO                0,8       0t0      37905 pipe
rserver   9597 rstudio-server    5u      REG                0,9         0       3641 anon_inode
rserver   9597 rstudio-server    6u     IPv4              37907       0t0        TCP *:msgsrvr (LISTEN)

3 个解决方案

#1


18  

When you login the rserver process handles your authentication, and then fires up an rsession process, which is the session you will use. The problem occurs when the rsession process terminates due to an error.

当您登录rserver进程时,将处理您的身份验证,然后启动一个rsession进程,这是您将使用的会话。当rsession进程由于错误而终止时,问题就出现了。

If you have administrator privileges, you can debug the error by tracing the rserver process and looking at the problem that caused rsession to exit. Here is how to do it.

如果您有管理员特权,您可以通过跟踪rserver进程并查看导致rsession退出的问题来调试错误。下面是如何做到这一点。

First find the rserver process-id.

首先找到rserver进程id。

ps auxw | grep studio
rstudio-server       7035  0.0  0.0 362488  4480 ?        Ssl  16:37   0:01 /usr/local/lib/rstudio-server/bin/rserver

Note the second number that appears on the output of a row containing the string rstudio-server/bin/rserver. In the case above the process-id is 7035.

注意在包含字符串rstudio-server/bin/rserver的行输出上出现的第二个数字。在上面的例子中,进程id是7035。

Then trace rserver sending the output to a file. The number after -p should be the rserver process-id. The funky -e option is used to cut-down noise from Java's thread management.

然后跟踪rserver将输出发送到文件。在-p之后的数字应该是rserver进程id。funky -e选项用于减少Java线程管理中的噪声。

sudo strace -f -e 'trace=!clock_gettime,gettimeofday,futex,timerfd_settime,epoll_wait,epoll_ctl' -p 7035 -o trace.txt

Login and wait for the error message to appear.

登录并等待出现错误消息。

Stop the tracing by pressing ctrl-c.

按ctrl-c停止跟踪。

Open the file with your favourite editor, and search for the string exit_group.

使用您喜欢的编辑器打开文件,并搜索字符串exit_group。

The lines above it are likely to indicate the error in rsession. In my case it was a symbolic link from .rstudio to a missing directory.

上面的行可能表示rsession中的错误。在我的例子中,它是一个从.rstudio到一个缺失目录的符号链接。

7529  mkdir("/home/dds/.rstudio", 0777) = -1 EEXIST (File exists)
7529  stat("/home/dds/.rstudio", 0x7ffff37419b0) = -1 ENOENT (No such file or directory)
7529  write(2, "07 Feb 2015 16:46:53 [rsession-d"..., 395) = 395
7529  sendto(3, "<11>Feb  7 16:46:53 rsession-dds"..., 398, MSG_NOSIGNAL, NULL, 0) = 398
7529  exit_group(1) 

#2


2  

I encountered a similar issue while installing Rstudio server on Ubuntu. After following the instructions, I found that I needed to create a home directory folder for each user logging into the Rstudio browser session.

我在Ubuntu上安装Rstudio服务器时遇到了类似的问题。在遵循指示之后,我发现我需要为每个登录到Rstudio浏览器会话的用户创建一个主目录文件夹。

12414 mkdir("/home/chamal", 0777)       = -1 EACCES (Permission denied)
12414 sendto(3, "<11>Jun 24 08:43:48 rsession-cha"..., 375, MSG_NOSIGNAL, NULL, 0) = 375
12414 exit_group(1)    

#3


0  

A popup titled "RStudio Initialization Error" appears with message "Unable to connect to service". To fix it, I tried appending the following to /etc/profile so that Revolution R is picked up by RStudio Server Pro sessions for every user: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/RRO/RRO-8.0.3/R-3.1.3/lib64/R/lib:/usr/local/lib64.

一个名为“RStudio初始化错误”的弹出框出现了“无法连接到服务”的消息。为了解决这个问题,我尝试将以下内容添加到/etc/profile中,这样,RStudio Server Pro会话为每个用户都获取了RStudio Server Pro会话:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/RRO/RRO /R-3.1.3/lib64/R/lib:/usr/local/lib64。

#1


18  

When you login the rserver process handles your authentication, and then fires up an rsession process, which is the session you will use. The problem occurs when the rsession process terminates due to an error.

当您登录rserver进程时,将处理您的身份验证,然后启动一个rsession进程,这是您将使用的会话。当rsession进程由于错误而终止时,问题就出现了。

If you have administrator privileges, you can debug the error by tracing the rserver process and looking at the problem that caused rsession to exit. Here is how to do it.

如果您有管理员特权,您可以通过跟踪rserver进程并查看导致rsession退出的问题来调试错误。下面是如何做到这一点。

First find the rserver process-id.

首先找到rserver进程id。

ps auxw | grep studio
rstudio-server       7035  0.0  0.0 362488  4480 ?        Ssl  16:37   0:01 /usr/local/lib/rstudio-server/bin/rserver

Note the second number that appears on the output of a row containing the string rstudio-server/bin/rserver. In the case above the process-id is 7035.

注意在包含字符串rstudio-server/bin/rserver的行输出上出现的第二个数字。在上面的例子中,进程id是7035。

Then trace rserver sending the output to a file. The number after -p should be the rserver process-id. The funky -e option is used to cut-down noise from Java's thread management.

然后跟踪rserver将输出发送到文件。在-p之后的数字应该是rserver进程id。funky -e选项用于减少Java线程管理中的噪声。

sudo strace -f -e 'trace=!clock_gettime,gettimeofday,futex,timerfd_settime,epoll_wait,epoll_ctl' -p 7035 -o trace.txt

Login and wait for the error message to appear.

登录并等待出现错误消息。

Stop the tracing by pressing ctrl-c.

按ctrl-c停止跟踪。

Open the file with your favourite editor, and search for the string exit_group.

使用您喜欢的编辑器打开文件,并搜索字符串exit_group。

The lines above it are likely to indicate the error in rsession. In my case it was a symbolic link from .rstudio to a missing directory.

上面的行可能表示rsession中的错误。在我的例子中,它是一个从.rstudio到一个缺失目录的符号链接。

7529  mkdir("/home/dds/.rstudio", 0777) = -1 EEXIST (File exists)
7529  stat("/home/dds/.rstudio", 0x7ffff37419b0) = -1 ENOENT (No such file or directory)
7529  write(2, "07 Feb 2015 16:46:53 [rsession-d"..., 395) = 395
7529  sendto(3, "<11>Feb  7 16:46:53 rsession-dds"..., 398, MSG_NOSIGNAL, NULL, 0) = 398
7529  exit_group(1) 

#2


2  

I encountered a similar issue while installing Rstudio server on Ubuntu. After following the instructions, I found that I needed to create a home directory folder for each user logging into the Rstudio browser session.

我在Ubuntu上安装Rstudio服务器时遇到了类似的问题。在遵循指示之后,我发现我需要为每个登录到Rstudio浏览器会话的用户创建一个主目录文件夹。

12414 mkdir("/home/chamal", 0777)       = -1 EACCES (Permission denied)
12414 sendto(3, "<11>Jun 24 08:43:48 rsession-cha"..., 375, MSG_NOSIGNAL, NULL, 0) = 375
12414 exit_group(1)    

#3


0  

A popup titled "RStudio Initialization Error" appears with message "Unable to connect to service". To fix it, I tried appending the following to /etc/profile so that Revolution R is picked up by RStudio Server Pro sessions for every user: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/RRO/RRO-8.0.3/R-3.1.3/lib64/R/lib:/usr/local/lib64.

一个名为“RStudio初始化错误”的弹出框出现了“无法连接到服务”的消息。为了解决这个问题,我尝试将以下内容添加到/etc/profile中,这样,RStudio Server Pro会话为每个用户都获取了RStudio Server Pro会话:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/RRO/RRO /R-3.1.3/lib64/R/lib:/usr/local/lib64。