Rstudio-server unable to connect to service - r

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?

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

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.

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.

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

Related

OpenVPN server not starting after generating config file for client

I am new to OpenVPN and to set up a server I followed this guide. I am using Ubuntu 18.04.4 LTS.
Here is what I get on starting OpenVPN
omayr#x556uqk:~$ sudo systemctl start openvpn#server
Job for openvpn#server.service failed because the control process exited with error code.
See "systemctl status openvpn#server.service" and "journalctl -xe" for details.
Status:
omayr#x556uqk:~$ sudo systemctl status openvpn#server
● openvpn#server.service - OpenVPN connection to server
Loaded: loaded (/etc/systemd/system/openvpn#.service; indirect; vendor preset
Active: activating (auto-restart) (Result: exit-code) since Sat 2020-02-22 23
Docs: man:openvpn(8)
https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
https://community.openvpn.net/openvpn/wiki/HOWTO
Process: 3740 ExecStart=/usr/sbin/openvpn --daemon ovpn-server --status /run/o
Main PID: 3740 (code=exited, status=1/FAILURE)

What is the command to invoke RStudio from Command Line in linux environment?

I am looking for the command to invoke RStudio from Linux. I VNC into the linux system and don't see any other option to launch RStudio from the gnome-terminal. I know R files can be directly read in the terminal, but I searched and couldn't find any command to invoke RStudio.
Are you referring to the RStudio desktop version, or the server instance? The former is started by just calling rstudio:
edd#rob:~$ type -p rstudio
/usr/bin/rstudio
edd#rob:~$
The latter is always running and started as system process:
edd#rob:~$ systemctl status rstudio-server
● rstudio-server.service - RStudio Server
Loaded: loaded (/etc/systemd/system/rstudio-server.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-07-15 20:12:01 CDT; 1 weeks 1 days ago
Main PID: 1665 (rserver)
Tasks: 3 (limit: 4915)
CGroup: /system.slice/rstudio-server.service
└─1665 /usr/lib/rstudio-server/bin/rserver
Jul 15 20:12:00 rob systemd[1]: Starting RStudio Server...
Jul 15 20:12:01 rob systemd[1]: Started RStudio Server.
edd#rob:~$
If you want to access the latter you do not need VNC. Just point your browser at port 8787 on that machine.
Have you tried to launch it from here ?
/usr/bin/rstudio
PS : You need R to be installed on the system too.
On Arch the command is
rstudio-bin

mount encrypted loopback in suse/systemd: unknown filesystem type 'crypt'

This might be specific to openSUSE / systemd.
I'm having trouble mounting an encrypted loopback file using the procedure described on the SDB:Encrypted filesystems knowledge base. I get this behaviour:
[mjl#tesla:~]
[11:12] $ sudo systemctl start /home/mjl/key
Job for home-mjl-key.mount failed. See "systemctl status home-mjl-key.mount" and "journalctl -xe" for details.
[mjl#tesla:~]
[11:12] 1 $ sudo systemctl status home-mjl-key.mount
● home-mjl-key.mount - /home/mjl/key
Loaded: loaded (/etc/fstab; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2018-03-11 11:12:41 AEDT; 3s ago
Where: /home/mjl/key
What: /home/mjl/.tomb
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Process: 12949 ExecMount=/usr/bin/mount /home/mjl/.tomb /home/mjl/key -t crypt -o loop,user,acl,user_xattr (code=exited, status=32)
Mar 11 11:12:41 tesla systemd[1]: Mounting /home/mjl/key...
Mar 11 11:12:41 tesla mount[12949]: mount: unknown filesystem type 'crypt'
Mar 11 11:12:41 tesla systemd[1]: home-mjl-key.mount: Mount process exited, code=exited status=32
Mar 11 11:12:41 tesla systemd[1]: Failed to mount /home/mjl/key.
Mar 11 11:12:41 tesla systemd[1]: home-mjl-key.mount: Unit entered failed state.
[mjl#tesla:~]
[11:12] 3 $
The /home/mjl/.tomb loopback file was created using YaST Partitioner; I specified that I did not want it mounted at system start time, but that users should be allowed to mount it.
So it created the file, added an entry to /etc/cryptab and also this entry to /etc/fstab:
[mjl#tesla:~]
[11:12] 3 $ tail -n1 /etc/fstab
/home/mjl/.tomb /home/mjl/key crypt loop,user,noauto,acl,user_xattr,nofail 0 0
[mjl#tesla:~]
[11:15]$
There is the 'crypt' filesystem type.
My question is: how should I be mounting this as a user? Is systemd failing because of the filesystem type, or because I haven't told it the encryption key?
I've also tried mounting directly:
[mjl#tesla:~]
[11:16]$ sudo mount /home/mjl/key
mount: unknown filesystem type 'crypt'
[mjl#tesla:~]
The same error. So I guess I'm not mounting it correctly. Do I need to do something with cryptsetup

Asterisk unable to find master config file

I have strange problem after I've installed Asterisk on my CentOS server. So, I have used tutorial step-by-step and didn't get any error or warnings. Whole installation went successfully.
When I try to log into Asterisk CLI with asterisk -r I've got this error
[root#asterisk-14.6.1]# asterisk -r
Unable to open specified master config file '/usr/local/etc/asterisk/asterisk.conf', using built-in defaults
Unable to connect to remote asterisk (does /usr/local/var/run/asterisk/asterisk.ctl exist?)
[root#asterisk-14.6.1]#
What does this means? I can't find anything about master config file. My asterisk.conf file is in /etc/asterisk
-rw-r--r-- 1 asterisk asterisk 5332 18 sep 12,15 asterisk.conf
not in '/usr/local/etc/asterisk/asterisk.conf'
Asterisk is 100% running
[root#asterisk-14.6.1]# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
Loaded: loaded (/etc/rc.d/init.d/asterisk; bad; vendor preset: disabled)
Active: active (running) since mon 2017-09-18 12:36:16 EEST; 3s ago
Docs: man:systemd-sysv-generator(8)
Process: 33977 ExecStop=/etc/rc.d/init.d/asterisk stop (code=exited, status=0/SUCCESS)
Process: 34000 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)
Main PID: 34025 (asterisk)
CGroup: /system.slice/asterisk.service
├─34023 /bin/sh /usr/sbin/safe_asterisk
└─34025 /usr/sbin/asterisk -f -vvvg -c
sep 18 12:36:16 systemd[1]: Starting LSB: Asterisk PBX...
sep 18 12:36:16 asterisk[34000]: Starting asterisk:
sep 18 12:36:16 systemd[1]: PID file /var/run/asterisk/asterisk.pid not readable (yet?) after start.
sep 18 12:36:16 systemd[1]: asterisk.service: Supervising process 34025 which is not our child. We'll most likely not notice when it exits.
sep 18 12:36:16 systemd[1]: Started LSB: Asterisk PBX.
I have changed also this permissions to asterisk user
[root#asterisk-14.6.1]# ls -l /var/run/asterisk/asterisk.ctl
srwxr-xr-x 1 asterisk asterisk 0 18 sep 12,36
/var/run/asterisk/asterisk.ctl
I was able to log into CLI with asterisk -vvvvc and I can see few errors
Unable to open specified master config file '/usr/local/etc/asterisk/asterisk.conf', using built-in defaults
[Sep 18 12:40:24] ERROR[34584]: logger.c:1823 init_logger: Errors detected in logger.conf. Default console logging is being used.
[Sep 18 12:40:24] WARNING[34584]: loader.c:1293 load_modules: No 'modules.conf' found, no modules will be loaded.
[Sep 18 12:40:24] WARNING[34584]: loader.c:1293 load_modules: No 'modules.conf' found, no modules will be loaded.
You did install with /usr/local/ prefix.
Now you have 2 choices
reinstall, do configure with --prefix=/
or do symlink
mkdir -p /usr/local/etc/
ln -s /etc/asterisk /usr/local/etc/
Running
make samples inside /usr/src/asterisk-<your version> resolved the issue for me

Can only run uwsgi with root

I'm preparing to use nginx/uwsgi with flask for a website i'm developing, but i'm running into problems. NB the website itself runs great using flask's debug :5000 port, but i want to go into production now. To explain what i did.
It's a linode ubuntu 12.04LTS server, I installed it like this:
# install nginx
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get upgrade --show-upgraded
sudo apt-get install nginx-full
# installing uwsgi
sudo apt-get install build-essential python-dev libxml2-dev
sudo apt-get install libc6 libexpat1 libgd2-xpm libgeoip1 libpam0g libpcre3 libssl1.0.0 libxml2 libxslt1.1 zlib1g
sudo pip install uwsgi
# python basics
sudo apt-get install python-pip build-essential python-dev
sudo pip install virtualenv
sudo pip install virtualenvwrapper
sudo mkdir -p /srv/www/li/
cd /srv/www/li/
virtualenv venv
source /srv/www/li/venv/bin/activate
pip install flask
Then i set out to configure everything, but I already run into trouble with uwsgi (never mind NGINX, which will be the next step.
sudo nano /etc/uwsgi/apps-available/li.xml
<uwsgi>
<plugin>python</plugin>
<socket>/run/uwsgi/app/li.socket</socket>
<chmod-socket>666</chmod-socket>
<chdir>/srv/www/li</chdir>
<pythonpath>/srv/www/li</pythonpath>
<virtualenv>/srv/www/li/venv</virtualenv>
<module>li</module>
<wsgi-file>/srv/www/li/li.py</wsgi-file>
<callable>app</callable>
<master/>
<processes>4</processes>
<harakiri>60</harakiri>
<reload-mercy>8</reload-mercy>
<cpu-affinity>1</cpu-affinity>
<stats>/tmp/stats.socket</stats>
<max-requests>2000</max-requests>
<limit-as>512</limit-as>
<reload-on-as>256</reload-on-as>
<reload-on-rss>192</reload-on-rss>
<no-orphans/>
<vacuum/>
</uwsgi>
sudo ln -s /etc/uwsgi/apps-available/li.xml /etc/uwsgi/apps-enabled/li.xml
However if i run it, i get:
uwsgi --xml /etc/uwsgi/apps-enabled/li.xml
[uWSGI] parsing config file /etc/uwsgi/apps-enabled/li.xml
open("./python_plugin.so"): No such file or directory [core/utils.c line 4755]
!!! UNABLE to load uWSGI plugin: ./python_plugin.so: cannot open shared object file: No such file or directory !!!
*** Starting uWSGI 1.4.6 (64bit) on [Thu Feb 28 16:30:53 2013] ***
compiled with version: 4.6.3 on 28 February 2013 12:38:22
os: Linux-3.7.10-x86_64-linode30 #1 SMP Wed Feb 27 14:29:31 EST 2013
nodename: demo
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /run/uwsgi/app
detected binary path: /usr/local/bin/uwsgi
your processes number limit is 63594
limiting address space of processes...
your process address space limit is 536870912 bytes (512 MB)
your memory page size is 4096 bytes
*** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to UNIX address /run/uwsgi/app/li.socket fd 3
Python version: 2.7.3 (default, Aug 1 2012, 05:25:23) [GCC 4.6.3]
Set PythonHome to /srv/www/li/venv
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0xa86e20
your server socket listen backlog is limited to 100 connections
mapped 362120 bytes (353 KB) for 4 cores
*** Operational MODE: preforking ***
added /srv/www/li/ to pythonpath.
/srv/www/li/venv/local/lib/python2.7/site-packages/mongoengine/fields.py:744: FutureWarning: ReferenceFields will default to using ObjectId strings in 0.8, set DBRef=True if this isn't desired
warnings.warn(msg, FutureWarning)
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0xa86e20 pid: 14934 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14934)
spawned uWSGI worker 1 (pid: 14940, cores: 1)
mapping worker 1 to CPUs: 0
spawned uWSGI worker 2 (pid: 14941, cores: 1)
mapping worker 2 to CPUs: 1
spawned uWSGI worker 3 (pid: 14942, cores: 1)
mapping worker 3 to CPUs: 2
spawned uWSGI worker 4 (pid: 14943, cores: 1)
unlink(): Operation not permitted [core/socket.c line 109]
bind(): Address already in use [core/socket.c line 141]
...brutally killing workers...
mapping worker 4 to CPUs: 3
VACUUM: unix socket /run/uwsgi/app/li.socket removed.
So i get the unlink operation not permitted and the bind address already in use errors (next to the python_plugin error of which i also have no clue how to solve that!). If i run as sudo, it seems to work fine ->
sudo uwsgi --xml /etc/uwsgi/apps-enabled/li.xml
[uWSGI] parsing config file /etc/uwsgi/apps-enabled/li.xml
open("./python_plugin.so"): No such file or directory [core/utils.c line 4755]
!!! UNABLE to load uWSGI plugin: ./python_plugin.so: cannot open shared object file: No such file or directory !!!
*** Starting uWSGI 1.4.6 (64bit) on [Thu Feb 28 15:47:41 2013] ***
compiled with version: 4.6.3 on 28 February 2013 12:38:22
os: Linux-3.7.10-x86_64-linode30 #1 SMP Wed Feb 27 14:29:31 EST 2013
nodename: demo
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /run/uwsgi
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your processes number limit is 63594
limiting address space of processes...
your process address space limit is 536870912 bytes (512 MB)
your memory page size is 4096 bytes
*** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to UNIX address /run/uwsgi/app/li.socket fd 3
Python version: 2.7.3 (default, Aug 1 2012, 05:25:23) [GCC 4.6.3]
Set PythonHome to /srv/www/li/venv
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x1fc9d00
your server socket listen backlog is limited to 100 connections
mapped 362120 bytes (353 KB) for 4 cores
*** Operational MODE: preforking ***
added /srv/www/li/ to pythonpath.
/srv/www/li/venv/local/lib/python2.7/site-packages/mongoengine/fields.py:744: FutureWarning: ReferenceFields will default to using ObjectId strings in 0.8, set DBRef=True if this isn't desired
warnings.warn(msg, FutureWarning)
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x1fc9d00 pid: 14755 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14755)
spawned uWSGI worker 1 (pid: 14761, cores: 1)
mapping worker 1 to CPUs: 0
spawned uWSGI worker 2 (pid: 14762, cores: 1)
mapping worker 2 to CPUs: 1
spawned uWSGI worker 3 (pid: 14763, cores: 1)
mapping worker 3 to CPUs: 2
spawned uWSGI worker 4 (pid: 14764, cores: 1)
*** Stats server enabled on /tmp/stats.socket fd: 16 ***
mapping worker 4 to CPUs: 3
Can anyone please help me? As www-data is in the www-data group and he runs it, I tried some stuff:
sudo usermod -a -G www-data $USER
sudo chown -R $USER:www-data /srv/www/li
sudo chmod -R g+r+w+x /srv/www/li
sudo chown -R $USER:www-data /etc/uwsgi/apps-enabled
sudo chmod -R g+r+w+x /etc/uwsgi/apps-enabled
sudo chown -R $USER:www-data /run/uwsgi/app
sudo chmod -R g+r+w+x /run/uwsgi/app
But that really didn't help either. I also tried a tcp port instead of the unix /run/uwsgi/app/ port that didn't make any difference either...
This is driving me crazy :( I hope someone has a clue on what's happening here.
Kind regards,
Carst
edit: after a server restart it still gives an erro but a different one:
geoadmin#demo:~$ uwsgi --xml /etc/uwsgi/apps-enabled/li.xml
[uWSGI] parsing config file /etc/uwsgi/apps-enabled/li.xml
*** Starting uWSGI 1.4.6 (64bit) on [Thu Feb 28 18:47:36 2013] ***
compiled with version: 4.6.3 on 28 February 2013 12:38:22
os: Linux-3.7.10-x86_64-linode30 #1 SMP Wed Feb 27 14:29:31 EST 2013
nodename: demo
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /home/geoadmin
detected binary path: /usr/local/bin/uwsgi
your processes number limit is 63594
limiting address space of processes...
your process address space limit is 536870912 bytes (512 MB)
your memory page size is 4096 bytes
*** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
bind(): No such file or directory [core/socket.c line 141]
This was consistently my #1 result on google, and this page was relatively unhelpful to me, so I'm going to add my answer, even though it's fairly obvious in retrospect.
My problem was a permissions problem with my stats socket. If you change your uWSGI config's uid or gid parameters, make sure you either chmod or rm all of your old sockets/ pids, and their parent folders.
In my case I was trying to place the .sock file in the /vagrant directory, which is a machine mounted folder of virtual box and is not good for much more than reads and writes.
Place the .sock file outside of a virtualbox mount-point preferably in /tmp The FHS says: /var/run
Ref:
https://stackoverflow.com/a/7580524/1695680
Ok, after the later edit i checked the directories and the socket directory didnt exist (anymore); i think it had to do with the original apt-get install versus my later pip install... still have the issue with the python plugin but will check if it's necessary for nginx or if it will work without it... 8 hours of work over a reset, d'oh ;)
#bearrito:
In the end I put the socket in the tmp directory to avoid rights issues:
<uwsgi>
<uid>www-data</uid>
<gid>www-data</gid>
<plugin>python</plugin>
<socket>/tmp/li.socket</socket>
<chmod-socket>666</chmod-socket>
<chdir>/srv/www/li</chdir>
<pythonpath>/srv/www/li</pythonpath>
<virtualenv>/srv/www/li/venv</virtualenv>
<module>li</module>
<wsgi-file>/srv/www/li/li.py</wsgi-file>
<callable>app</callable>
<master/>
<processes>2</processes>
<pidfile>/tmp/li.pid</pidfile>
<harakiri>120</harakiri>
<reload-mercy>8</reload-mercy>
<cpu-affinity>1</cpu-affinity>
<stats>/tmp/stats.socket</stats>
<max-requests>2000</max-requests>
<limit-as>2048</limit-as>
<reload-on-as>2048</reload-on-as>
<reload-on-rss>1024</reload-on-rss>
<no-orphans/>
<vacuum/>
</uwsgi>
I hope this helps!
For me the solution was to remove /var/run/uwsgi/.sock and
chmod 775 /var/run/uwsgi
chmod 777 /var/log/uwsgi
or wherever your uwsgi files are.

Resources