Unable to launch fully containerized Rstudio

Thanks for the update, Michael. I did manage to get the RStudio Sever 1.3. working both locally and in the container. There are some Rocker containers that use 1.3 and R 4.0.x, so, that’s what we’re using now.

I think I found a solution: RStudio when launched without Singularity is having strange troubles with authentication - #32 by fenz

Hi. I’m having some authentication problems as well, but wanted to comment on the message @dugan made about the database config. I’m running rstudio-server-2021.09.0+351-1 and had the database issue. Here’s what I did to work around that (if it’s helpful to anyone else).

In the script.sh.erb file before launching rserver, I did a few things

**mkdir $TMPDIR/rstudio**
    - we set $TMPDIR with slurm automatically, but if you launch rstudio against $TMPDIR directly, it seems to set permissions to 1777 which we didn't like, making everything run in a subdirectory helped keep $TMPDIR 700.
**echo "directory=${TMPDIR}/rstudio" > $TMPDIR/rstudio/database.conf**
   - create a database.conf file pointing to where we want it and it will be unique to the job.
**set the server-data-dir, server-working-dir, database-config-file, and secure-cookie-key-file all to use the appropriate things in ${TMPDIR}/rstudio

I still can’t log into it, but I think that’s a topic being discussed in another thread.

This did not solve my issue as the singularity container could see RSTUDIO_AUTH. Anyhow, I’d like to share my findings.

I was running rstudio-server over singularity with this repo config and by doing this I got the following error when launching the app and trying to using my login and RSTUDIO_PASSWORD:

ERROR Could not find details for server user 'gb637'; LOGGED FROM: virtual
rstudio::core::ProgramStatus rstudio::server::Options::read(int, char* const*,
std::ostream&) src/cpp/server/ServerOptions.cpp:299

ERROR system error 2 (No such file or directory) [description: User not found.,
user-value: gb637]; 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:300

Investigating rstudio source code I came to the getpwnam_r function called by User::getUserFromIdentifier when retrieving user data here.

That took me to how RStudio uses PAM authentication and by doing some tests with the Singularity container I noticed it was checking my user against passwd only, ignoring sssd/ldap configuration.

I’ve installed rstudio-server-rhel-2021.09.0-351-x86_64.rpm into the node server and overwritten /etc/pam.d/rstudio with /etc/pam.d/login. But with no success. Still getting the same error.

So I assume if one could find a way to make singularity container look at sssd authentication the container with newer versions of rstudio-server could work.

I’ve tested rstudio-server outside singularity container and it did work as is getpwnam from the node itself and not inside the container, thus being able to query sssd/ldap users.

Hope that information helps other with similar issues.