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

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:

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

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
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}" "\${@}"

# 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

Confirm password environment variable exists

if [[ -z ${RSTUDIO_PASSWORD} ]]; then
echo “The environment variable RSTUDIO_PASSWORD is not set”
exit 1

Read in the password from user

read -s -p "Password: " PASSWORD
echo “”

if [[ ${USERNAME} == ${USER} && ${PASSWORD} == ${RSTUDIO_PASSWORD} ]]; then
echo “Successful authentication”
exit 0
echo “Invalid authentication”
exit 1

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:

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:

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.

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/ --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.