§2024-12-17
- cretae rstudio-server:rstudio-server
$ sudo groupadd rstudio-server
$ sudo useradd -m -g rstudio-server rstudio-server
$ id rstudio-server
uid=1027(rstudio-server) gid=1027(rstudio-server) groups=1027(rstudio-server)
alexlai@hc4Noble:/opt$ sudo chown rstudio-server:rstudio-server -R /opt/rstudio
alexlai@hc4Noble:/opt$ ls -l /opt/
total 0
drwxr-xr-x 9 rstudio rstudio 190 Dec 17 08:15 rstudio
drwxr-xr-x 3 root root 21 Dec 16 15:23 rstudio-tools
alexlai@hc4Noble:/opt$ ls -l /opt/rstudio
total 316
-rw-r--r-- 1 rstudio rstudio 35071 Dec 16 14:39 COPYING
-rw-r--r-- 1 rstudio rstudio 6013 Dec 16 14:39 INSTALL
-rw-r--r-- 1 rstudio rstudio 246817 Dec 16 14:39 NOTICE
drwxr-xr-x 3 rstudio rstudio 131 Dec 17 08:15 R
-rw-r--r-- 1 rstudio rstudio 2057 Dec 16 14:39 README.md
-rw-r--r-- 1 rstudio rstudio 508 Dec 17 08:15 SOURCE
-rw-r--r-- 1 rstudio rstudio 20 Dec 16 15:53 VERSION
drwxr-xr-x 5 rstudio rstudio 4096 Dec 17 08:15 bin
drwxr-xr-x 2 rstudio rstudio 4096 Dec 17 08:15 db
drwxr-xr-x 9 rstudio rstudio 100 Dec 17 08:15 extras
drwxr-xr-x 19 rstudio rstudio 4096 Dec 17 08:15 resources
drwxr-xr-x 8 rstudio rstudio 4096 Dec 17 08:15 www
drwxr-xr-x 2 rstudio rstudio 56 Dec 17 08:15 www-symbolmaps
- /etc/rstudio/rserver.conf
# /etc/rstudio/rserver.conf
# Enable authentication (allow any system user to access RStudio Server)
# auth-required=user
auth-required-user-group=*
# Set the default port (default is 8787)
www-port=8787
# Allow remote access (optional if you're using localhost only)
www-address=0.0.0.0
# Authentication: If you’re using system authentication (the default), the setting should be:
auth-none=0
# Working Directory: Define the initial working directory for users.
rsession-which-r=/opt/RStudio
- create-rstudio-server-dir.service
[Unit]
Description=Ensure /var/run/rstudio-server directory exists
Before=rstudio-server.service
[Service]
Type=oneshot
ExecStart=/bin/mkdir -p /var/run/rstudio-server
ExecStartPost=/bin/chown rstudio-server:rstudio-server /var/run/rstudio-server
ExecStartPost=/bin/chmod 755 /var/run/rstudio-server
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
- rstudio-server.service
[Unit]
Description=RStudio Server
# After=network.target
After=create-rstudio-server-dir.service
Requires=create-rstudio-server-dir.service
[Service]
Type=simple
# ExecStart=/opt/rstudio/bin/rstudio-server
ExecStart=/opt/rstudio/bin/rserver
User=rstudio-server
Group=rstudio-server
WorkingDirectory=/opt/rstudio
Restart=always
LimitNOFILE=10000
[Install]
WantedBy=multi-user.target
[Unit]
Description=RStudio Server
After=network.target
[Service]
# The user and group that the service will run as
User=rstudio
Group=rstudio
# Executable and arguments
ExecStart=/usr/lib/rstudio-server/bin/rserver
ExecStop=/usr/lib/rstudio-server/bin/rserver --stop
# Ensure that the RStudio Server process is always restarted in case of failure
Restart=on-failure
RestartSec=5s
# Set working directory
WorkingDirectory=/home/rstudio
# Limit the amount of memory the process can use (optional)
MemoryLimit=2G
# Log output configuration
StandardOutput=syslog
StandardError=syslog
# Timeout settings (optional)
TimeoutStartSec=60
TimeoutStopSec=30
[Install]
WantedBy=multi-user.target
- /etc/rstudio/rserver.conf
# /etc/rstudio/rserver.conf
# Enable authentication (default setting)
auth-required-user-group=*
# Allow any system user to access RStudio Server (by default, it's local system users)
auth-pam-helper-enable=true
# Set the default port (default is 8787)
www-port=8787
# Allow remote access (optional if you're using localhost only)
www-address=0.0.0.0
# Max number of concurrent sessions per user (optional)
session-timeout-minutes=60
二 19 17:25:43 Jetson rserver[88085]: ERROR system error 13 (Permission denied) [path: /var/lib/rstudio-server, target-dir: ]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::createDirectory(const string&) const src/cpp/shared_core/FilePath.cpp:849; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:874
$ sudo mkdir -p /var/lib/rstudio-server
(base) alexlai@Jetson:/etc/systemd/system$ sudo chown -R rstudio-server:rstudio-server /var/lib/rstudio-server/
Check PAM Configuration for RStudio Server: Open the PAM configuration file for RStudio Server and ensure it exists:
bash Copy code cat /etc/pam.d/rstudio If it doesn't exist, create it with the following content:
bash Copy code
/etc/pam.d/rstudio
auth required pam_unix.so account required pam_unix.so password required pam_unix.so session required pam_unix.so
I did compile RStudio as,
$ cmake .. -DRSTUDIO_TARGET=Server -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/rstudio
$ sudo make install
$ ls -l /opt/
total 0
drwxr-xr-x 9 root root 190 Dec 17 08:15 rstudio
drwxr-xr-x 3 root root 21 Dec 16 15:23 rstudio-tools
alexlai@hc4Noble:/opt$ ls /opt/rstudio
COPYING INSTALL NOTICE R README.md SOURCE VERSION bin db extras resources www www-symbolmaps
alexlai@hc4Noble:/opt$ ls /opt/rstudio-tools/
aarch64
Question 1: Do I have to create rstudio:rstudio <-- change this to rstudio-server:rstudio-server Question 2: How to start RStudio with a service file
Question 1:
sudo groupadd rstudio
sudo useradd -m -g rstudio rstudio
alexlai@hc4Noble:/opt$ sudo chown rstudio:rstudio -R /opt/rstudio
alexlai@hc4Noble:/opt$ ls -l /opt/
total 0
drwxr-xr-x 9 rstudio rstudio 190 Dec 17 08:15 rstudio
drwxr-xr-x 3 root root 21 Dec 16 15:23 rstudio-tools
alexlai@hc4Noble:/opt$ ls -l /opt/rstudio
total 316
-rw-r--r-- 1 rstudio rstudio 35071 Dec 16 14:39 COPYING
-rw-r--r-- 1 rstudio rstudio 6013 Dec 16 14:39 INSTALL
-rw-r--r-- 1 rstudio rstudio 246817 Dec 16 14:39 NOTICE
drwxr-xr-x 3 rstudio rstudio 131 Dec 17 08:15 R
-rw-r--r-- 1 rstudio rstudio 2057 Dec 16 14:39 README.md
-rw-r--r-- 1 rstudio rstudio 508 Dec 17 08:15 SOURCE
-rw-r--r-- 1 rstudio rstudio 20 Dec 16 15:53 VERSION
drwxr-xr-x 5 rstudio rstudio 4096 Dec 17 08:15 bin
drwxr-xr-x 2 rstudio rstudio 4096 Dec 17 08:15 db
drwxr-xr-x 9 rstudio rstudio 100 Dec 17 08:15 extras
drwxr-xr-x 19 rstudio rstudio 4096 Dec 17 08:15 resources
drwxr-xr-x 8 rstudio rstudio 4096 Dec 17 08:15 www
drwxr-xr-x 2 rstudio rstudio 56 Dec 17 08:15 www-symbolmaps
Question 2:
sudo groupadd rstudio
sudo useradd -m -g rstudio rstudio
alexlai@hc4Noble:/opt$ sudo chown rstudio:rstudio -R /opt/rstudio
alexlai@hc4Noble:/opt$ ls -l /opt/
total 0
drwxr-xr-x 9 rstudio rstudio 190 Dec 17 08:15 rstudio
drwxr-xr-x 3 root root 21 Dec 16 15:23 rstudio-tools
alexlai@hc4Noble:/opt$ ls -l /opt/rstudio
total 316
-rw-r--r-- 1 rstudio rstudio 35071 Dec 16 14:39 COPYING
-rw-r--r-- 1 rstudio rstudio 6013 Dec 16 14:39 INSTALL
-rw-r--r-- 1 rstudio rstudio 246817 Dec 16 14:39 NOTICE
drwxr-xr-x 3 rstudio rstudio 131 Dec 17 08:15 R
-rw-r--r-- 1 rstudio rstudio 2057 Dec 16 14:39 README.md
-rw-r--r-- 1 rstudio rstudio 508 Dec 17 08:15 SOURCE
-rw-r--r-- 1 rstudio rstudio 20 Dec 16 15:53 VERSION
drwxr-xr-x 5 rstudio rstudio 4096 Dec 17 08:15 bin
drwxr-xr-x 2 rstudio rstudio 4096 Dec 17 08:15 db
drwxr-xr-x 9 rstudio rstudio 100 Dec 17 08:15 extras
drwxr-xr-x 19 rstudio rstudio 4096 Dec 17 08:15 resources
drwxr-xr-x 8 rstudio rstudio 4096 Dec 17 08:15 www
drwxr-xr-x 2 rstudio rstudio 56 Dec 17 08:15 www-symbolmaps
sudo nano /etc/systemd/system/RStudioServer.service
[Unit]
Description=RStudio Server
After=network.target
[Service]
Type=simple
ExecStart=/opt/rstudio/bin/rserver
User=rstudio
Group=rstudio
WorkingDirectory=/opt/rstudio
Restart=always
LimitNOFILE=10000
[Install]
WantedBy=multi-user.target
sudo mkdir -p /var/run/rstudio-server
sudo chown rstudio-server:rstudio-server /var/run/rstudio-server
sudo chmod 755 /var/run/rstudio-server
$ sudo mkdir /var/lib/rstudio-server
$ sudo chown -R rstudio-server:rstudio-server /var/lib/rstudio-server
alexlai@hc4Noble:/opt$ ls -l /var/lib/rstudio-server
ls: cannot access '/var/lib/rstudio-server': No such file or directory
----
The message you're seeing indicates that the SSSD (System Security Services Daemon) service failed to start because it couldn't find the necessary configuration files:
javascript
Copy code
ConditionPathExists=|/etc/sssd/sssd.conf was not met
ConditionDirectoryNotEmpty=|/etc/sssd/conf.d was not met
This means that the required configuration file /etc/sssd/sssd.conf is missing, and possibly the /etc/sssd/conf.d directory is empty, which prevents SSSD from starting.
Steps to Resolve the Issue:
1. Check if /etc/sssd/sssd.conf Exists
First, check whether the /etc/sssd/sssd.conf file exists. If it doesn't, you'll need to create it.
bash
Copy code
sudo ls /etc/sssd/sssd.conf
If the file is missing, you will need to create it manually. If the file exists but is empty or misconfigured, you can edit it to include basic configuration settings.
2. Create or Recreate the /etc/sssd/sssd.conf File
If the file is missing, you can create a basic configuration for SSSD. Here's an example of a simple sssd.conf that uses local files for authentication:
Create or edit the file:
bash
Copy code
sudo nano /etc/sssd/sssd.conf
Add the following content to configure SSSD to use local files for user authentication:
makefile
Copy code
[sssd]
domains = default
config_file_version = 2
services = nss, pam
[domain/default]
id_provider = files
auth_provider = files
chpass_provider = files
This configuration tells SSSD to use the local /etc/passwd, /etc/shadow, and /etc/group files for user authentication.
Set the correct permissions for the sssd.conf file:
bash
Copy code
sudo chmod 600 /etc/sssd/sssd.conf
sudo chown root:root /etc/sssd/sssd.conf
3. Ensure /etc/sssd/conf.d Directory Exists
Check if the /etc/sssd/conf.d directory exists. If it doesn't, you can create it:
bash
Copy code
sudo ls /etc/sssd/conf.d
If the directory does not exist, you can create it:
bash
Copy code
sudo mkdir /etc/sssd/conf.d
This directory is typically used for storing additional configuration files, but it's not strictly necessary for local file-based authentication.
4. Restart the SSSD Service
After creating the configuration file and ensuring the correct directory structure, try restarting the SSSD service again:
bash
Copy code
sudo systemctl restart sssd
sudo systemctl status sssd
If everything is configured correctly, the service should now start without errors.
5. Verify the SSSD Service
Verify that the SSSD service is running and active:
bash
Copy code
sudo systemctl status sssd
The output should indicate that the service is active and running. If it is still not starting, check the SSSD logs for more detailed error messages:
bash
Copy code
sudo journalctl -u sssd
6. Revert Changes in /etc/nsswitch.conf (if Needed)
If you were testing by temporarily disabling SSSD, you can revert the changes in /etc/nsswitch.conf to re-enable SSSD once it is properly configured:
Edit /etc/nsswitch.conf and revert the passwd, group, and shadow lines to include sss:
bash
Copy code
sudo nano /etc/nsswitch.conf
The relevant lines should be:
makefile
Copy code
passwd: files systemd sss
group: files systemd sss
shadow: files sss
Conclusion
The issue seems to be caused by the missing or misconfigured /etc/sssd/sssd.conf file, which prevents the SSSD service from starting. By creating this file and ensuring that it’s properly configured to use local files for authentication, you should be able to resolve the issue and get SSSD running.
Once the SSSD service is running correctly, you can proceed to test your RStudio Server login again, as SSSD may be required to resolve user authentication. If you still encounter issues, let me know and we can dive deeper into the SSSD logs.
---
[Logging](https://docs.posit.co/ide/server-pro/server_management/logging.html#:~:text=The%20logging%20configuration%20file%20is,Global%20(%20%5B*%5D%20))
- /etc/rstudio/logging.conf
[*] log-level=info logger-type=syslog
[@rserver] log-level=debug logger-type=file max-size-mb=10 rotate-days=2 max-rotations=50 delete-days=10 warn-syslog=0
[file-locking] log-dir=/var/log/file-locking log-file-mode=600
二 19 20:19:11 Jetson rsession-rstudio-server[14169]: INFO No rsession configuration found at /etc/rstudio/rsession.conf
十二 19 20:19:11 Jetson rsession-rstudio-server[14169]: INFO Encryption versions set to max: 0, min: 0
十二 19 20:19:16 Jetson rsession-rstudio-server[14169]: INFO Set CRAN URL for session to 'https://cran.rstudio.com/' (source: preference defaults)
十二 19 20:19:17 Jetson rsession-rstudio-server[14169]: INFO No keybindings/rstudio_bindings.json found at /etc/rstudio/keybindings/rstudio_bindings.json
十二 19 20:19:17 Jetson rsession-rstudio-server[14169]: INFO No keybindings/editor_bindings.json found at /etc/rstudio/keybindings/editor_bindings.json
十二 19 20:19:17 Jetson rsession-rstudio-server[14169]: INFO No keybindings/addins.json found at /etc/rstudio/keybindings/addins.json
十二 19 20:28:41 Jetson systemd[1]: Stopping RStudio Server...
░░ Subject: A stop job for unit rstudio-server.service has begun execution
░░ Defined-By: systemd
░░ Sup
$ cat /etc/rstudio/rsession.conf rsession-max-requests=200 rsession-timeout=300