# RStudio error ERROR system error 2 (No such file or directory)

**URL:** <https://discourse.openondemand.org/t/rstudio-error-error-system-error-2-no-such-file-or-directory/3325>\
**Category:** Get Help\
**Created:** [March 5, 2024, 5:14pm UTC](https://discourse.openondemand.org/t/rstudio-error-error-system-error-2-no-such-file-or-directory/3325 "2024-03-05T17:14:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rgas20](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/rgas20/32/309_2.png) [@rgas20](https://discourse.openondemand.org/u/rgas20)\
**Post date:** [March 5, 2024, 5:14pm UTC](https://discourse.openondemand.org/t/rstudio-error-error-system-error-2-no-such-file-or-directory/3325/1 "2024-03-05T17:14:47Z")

</div>

Hello, I’ve seen this issue posted a few times, but unfortunately, we aren’t sure what’s going on at our site. Any ideas would be appreciated.

Our RStudio app doesn’t launch. We’ve taken the OnDemand app from a cluster where it was working and updated the paths accordingly, but what worked on our old cluster doesn’t work on our new, and we’re not sure why.

There is no RStudio error log written, but this shows up on the node under /var/log/messages:

```auto
Mar 4 11:06:16 node040 rserver[1163460]: ERROR Could not find details for server user 'rstudio-server'; LOGGED FROM: virtual rstudio::core::ProgramStatus rstudio::server::Options::read(int, char* const*, std::ostream&) src/cpp/server/ServerOptions.cpp:304
Mar 4 11:06:16 node040 rserver[1163460]: ERROR system error 2 (No such file or directory) [description: User not found., user-value: rstudio-server]; OCCURRED AT rstudio::core::Error rstudio::core::system::User::Impl::populateUser(rstudio::core::system::User::Impl::GetPasswdFunc<T>&, T) [with T = const char* rstudio::core::system::User::Impl::GetPasswdFunc<T> = std::function<int(const char*, passwd*, char*, long unsigned int, passwd**)>] src/cpp/shared_core/system/User.cpp:68; LOGGED FROM: virtual rstudio::core::ProgramStatus rstudio::server::Options::read(int, char* const*, std::ostream&) src/cpp/server/ServerOptions.cpp:305

```

Where should we start with this issue? Here’s the script.sh.erb:

```auto
module purge
module use /cm/local/modulefiles
module use /mmfs1/cm/shared/modulefiles_local
module use /cm/shared/modulefiles
module load openssl/1.1.1

# load RStudio Server
module load <%= context.Rserver %>

# load R
module load <%= context.Rapp %>

#
# Start RStudio Server
#

# PAM auth helper used by RStudio
export RSTUDIO_AUTH="${PWD}/bin/auth"

# Generate an `rsession` wrapper script
export RSESSION_WRAPPER_FILE="${PWD}/rsession.sh"
(
umask 077
sed 's/^ \{2\}//' > "${RSESSION_WRAPPER_FILE}" << EOL
  #!/usr/bin/env bash

  # Log all output from this script
  export RSESSION_LOG_FILE="${PWD}/rsession.log"
  exec &>>"\${RSESSION_LOG_FILE}"

  # Launch the original command
  echo "Launching rsession..."
  set -x
  exec rsession --r-libs-user "${R_LIBS_USER}" "\${@}"
EOL
)
chmod 700 "${RSESSION_WRAPPER_FILE}"

# Set working directory to home directory
cd "${HOME}"

# Create a unique $TMPDIR for runtime files
export TMPDIR="/mmfs1/scratch/tmp/"
export TMP="/mmfs1/scratch/tmp/"

#export TMPDIR="$(mktemp -d)"

# Output debug info
module list

# Launch the RStudio Server
echo "Starting up rserver..."
set -x
rserver \
  --www-port ${port} \
  --auth-none 0 \
  --auth-pam-helper-path "${RSTUDIO_AUTH}" \
  --auth-encrypt-password 0 \
  --rsession-path "${RSESSION_WRAPPER_FILE}" \
  --server-data-dir "/mmfs1/scratch/tmp/$RANDOM-$RANDOM" \
  --secure-cookie-key-file "/mmfs1/scratch/tmp/$RANDOM-$RANDOM/rstudio-server/secure-cookie-key"

```

And our auth file:

> #!/usr/bin/env bash
> 
> # Confirm username is supplied
> 
> if [[$# -lt 1]]; then  
> echo “Usage: auth USERNAME”  
> exit 1  
> fi  
> USERNAME=“${1}”
> 
> # Confirm password environment variable exists
> 
> if [[-z ${RSTUDIO\_PASSWORD}]]; then  
> echo “The environment variable RSTUDIO\_PASSWORD is not set”  
> exit 1  
> fi
> 
> # Read in the password from user
> 
> read -s -p "Password: " PASSWORD  
> echo “”
> 
> if [[${USERNAME} == ${USER} && ${PASSWORD} == ${RSTUDIO\_PASSWORD}]]; then  
> echo “Successful authentication”  
> exit 0  
> else  
> echo “Invalid authentication”  
> exit 1  
> fi

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [March 5, 2024, 7:22pm UTC](https://discourse.openondemand.org/t/rstudio-error-error-system-error-2-no-such-file-or-directory/3325/2 "2024-03-05T19:22:44Z")

</div>

Sorry for the issues.

Could you also post the `output.log` from the app launch? That is largely going to have the information around what happened at launch.

I’m also curious, what version of R is this? I feel like for some versions we’ve had to set the `--server-user` flag for the `rserver` command.

Yeah, looking at the current app at OSC you can see the block to handle that if `r_version > 4.1`:

> <https://github.com/OSC/bc_osc_rstudio_server/blob/3764080d08aa332abc03ad6125fd94bdd96bcbe1/template/script.sh.erb#L131>

---

<div class="post-metadata">

**Author:** ![rgas20](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/rgas20/32/309_2.png) [@rgas20](https://discourse.openondemand.org/u/rgas20)\
**Post date:** [March 5, 2024, 8:58pm UTC](https://discourse.openondemand.org/t/rstudio-error-error-system-error-2-no-such-file-or-directory/3325/3 "2024-03-05T20:58:01Z")

</div>

Thanks for the suggestions. After adding the --server-user line we are making a bit of progress. I now get this in /var/log/messages on the node it runs on though:

```auto
Mar 5 20:42:45 node005 rserver[1770363]: 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:847; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:782

```

Forgive my ignorance but I’m not sure why it’s referring to /var/lib/rstudio-server? It should be using the path in the modulefile instead.

This is what we get in the output.log now, so not much information to go off of other than what is in messages on the node where it fails.

```auto
Script starting...
Waiting for RStudio Server to open port 62281...

Currently Loaded Modules:
  1) gcc/11.2.0 4) java/1.8.0_391
  2) openssl/1.1.1 5) R/4.3.2-gcc-11.2.0-mkl
  3) ondemand/rstudio/rstudio-2023.12.1

 

Starting up rserver...
++ whoami
+ rserver --www-port 62281 --auth-none 0 --auth-pam-helper-path /home/path.local/username/ondemand/data/sys/dashboard/batch_connect/sys/RStudio/output/f48f543d-24f2-4c6e-94e9-46fd163ab06d/bin/auth --auth-encrypt-password 0 --server-user=username@path.local --rsession-path /home/path.local/username/ondemand/data/sys/dashboard/batch_connect/sys/RStudio/output/f48f543d-24f2-4c6e-94e9-46fd163ab06d/rsession.sh --server-data-dir /mmfs1/scratch/tmp/14494-2723 --secure-cookie-key-file /mmfs1/scratch/tmp/474-20908/rstudio-server/secure-cookie-key
Timed out waiting for RStudio Server to open port 62281!
Cleaning up...

```

We are using R 4.3.2 with RStudio.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [September 1, 2024, 8:58pm UTC](https://discourse.openondemand.org/t/rstudio-error-error-system-error-2-no-such-file-or-directory/3325/4 "2024-09-01T20:58:54Z")

</div>

Closed on September 1, 2024, 8:58pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
