# RStudio without Singularity?

**URL:** <https://discourse.openondemand.org/t/rstudio-without-singularity/773>\
**Category:** Get Help\
**Tags:** question\
**Created:** [March 9, 2020, 5:30pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773 "2020-03-09T17:30:41Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![susan](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@susan](https://discourse.openondemand.org/u/susan)\
**Post date:** [March 9, 2020, 5:30pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/1 "2020-03-09T17:30:41Z")

</div>

I thought I’d read that OOD was now able to run RStudio without relying on Singularity but can’t find documentation to support that notion. Was I dreaming??

Thanks - Susan Litzinger  
PSC

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [March 9, 2020, 5:50pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/2 "2020-03-09T17:50:28Z")

</div>

You may have seen something by Morgan to use `unshare` though I don’t believe we got it working (you need to be ‘root’ with subuids so there’s added complexity).

I’m only now realizing that rstuido is [open source](https://github.com/rstudio/rstudio) so maybe they just fixed the bug? I haven’t checked, but it seems possible that they did.

The bug was this: rstudio server creates a temporary file that’s hard coded. Meaning, you cannot have 2 instances of it (2 users) running on the same machine. Unless you chroot the tmp directory, which we do through singularity.

That’s the the **only** reason we’re using singularity, so if that simple single thing got fixed, or we could unshare a different mount, or figure out if `R_SESSION_TMPDIR` is useful (I just happened upon this looking at some of the tickets) or whatever we would switch because it does seem to add to folks’ confusion.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![dugan](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@dugan](https://discourse.openondemand.org/u/dugan)\
**Post date:** [March 10, 2020, 1:22pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/3 "2020-03-10T13:22:30Z")

</div>

We’re not using singularity to run rstudio. I modified the rserver source to support a “–server-secure-key-dir” option to over-ride the hardcoded “/tmp/rstudio-server”. I’m happy to share my patch but I’m not sure how to include a file here.

–Mike Dugan

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [March 10, 2020, 1:31pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/4 "2020-03-10T13:31:30Z")

</div>

Yes! Maybe we can provide the patch upstream.

I’ve found this [ticket of theirs](https://github.com/rstudio/rstudio/issues/4666) that I’m going to start commenting on saying we need this.

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [March 10, 2020, 9:17pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/5 "2020-03-10T21:17:56Z")

</div>

Yea it seems that Rstudio 1.3 that’s in beta right now resolves this issue. Though I’m trying to get it to run, in preparation for their release, and am having a bit of trouble. I don’t know what `QT_QPA_PLATFORM` we should use.

```nohighlight
Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/users/PZS0714/johrstrom/temp/rstudio/rstudio-1.3.895/bin/platforms" ...
loaded library "/users/PZS0714/johrstrom/temp/rstudio/rstudio-1.3.895/plugins/platforms/libqxcb.so"
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

```

---

<div class="post-metadata">

**Author:** ![mcuma](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mcuma/32/171_2.png) [@mcuma](https://discourse.openondemand.org/u/mcuma)\
**Post date:** [March 11, 2020, 5:35pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/6 "2020-03-11T17:35:35Z")

</div>

Mike, I would be also curious to see the fix.

I am also wondering how did you install the RStudio Server. We install all our apps here as non-root and I haven’t been able to find any info it it’s possible to install the RStudio Server this way. We were dabbling with installing it into the OS image but that’s something our admins don’t like for non RedHat official RPMs, and they were also concerned about security implications of running the server.

That’s the other reason why we are running it in the container.

MC

---

<div class="post-metadata">

**Author:** ![dugan](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@dugan](https://discourse.openondemand.org/u/dugan)\
**Post date:** [March 11, 2020, 6:18pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/7 "2020-03-11T18:18:00Z")

</div>

I’m a novice with discourse and can’t figure out how to attach a file here without mangling it.  
So here’s my patch:

[https://scv.bu.edu/server-secure-key-dir-option.patch](https://scv.bu.edu/server-secure-key-dir-option.patch)

We also install apps as non-root into a shared filesystem so they are available to every compute node.  
So I configured the rstudio build to install into /usr/local/ood/rstudio-server. The files are owned my me  
but the server is started from the batch script and runs as the user.

–Mike

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [April 9, 2020, 3:24pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/8 "2020-04-09T15:24:11Z")

</div>

Thanks @dugan for the patch!

Yes in RStuido 1.3 (currently in beta/preview) you won’t need a container. We’ll try to update the community when it becomes stable and we have a working example of how it works (we’ll likely want to run it at OSC too).

---

<div class="post-metadata">

**Author:** ![maflister](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/maflister/32/139_2.png) [@maflister](https://discourse.openondemand.org/u/maflister)\
**Post date:** [June 5, 2020, 3:58am UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/9 "2020-06-05T03:58:15Z")

</div>

We’ve been testing RStudio Server 1.3.959. The issue #4666 referenced above addresses PID files. New version includes a new flag `--server-data-dir` that changes the location of `rstudio-rsession`. It does not address `rstudio-server` which contains the `secure-cookie-key` file. I think we still need something like @dugan’s patch to avoid dependency on Singularity or PRoot.

---

<div class="post-metadata">

**Author:** ![dugan](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@dugan](https://discourse.openondemand.org/u/dugan)\
**Post date:** [June 5, 2020, 9:41am UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/10 "2020-06-05T09:41:56Z")

</div>

It fact 1.3.959 solves all problems. It also has a “–secure-cookie-key-file” option.  
You can use that to put the cookie file anywhere you like. I’m using the unmodified rpm  
binaries but I didn’t install the rpm. I just dumped the files with rpm2cpio and moved them  
to a shared filesystem accessible to all my compute nodes.

–Mike

---

<div class="post-metadata">

**Author:** ![maflister](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/maflister/32/139_2.png) [@maflister](https://discourse.openondemand.org/u/maflister)\
**Post date:** [June 5, 2020, 1:52pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/11 "2020-06-05T13:52:33Z")

</div>

Thanks for that suggestion. I guess I expected there should be one flag to control temp file location rather than two. We also use the rpm2cpio method of installation. I put together our config and some notes from our recent experience with 1.3.959.

> **[mcw-rcc/bc\_rcc\_rstudio\_server](https://github.com/mcw-rcc/bc_rcc_rstudio_server)**
>
> RStudio Server app for Open OnDemand. Contribute to mcw-rcc/bc\_rcc\_rstudio\_server development by creating an account on GitHub.

  
Hopefully it’s useful to someone.

---

<div class="post-metadata">

**Author:** ![ndusek](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@ndusek](https://discourse.openondemand.org/u/ndusek)\
**Post date:** [July 6, 2020, 3:44pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/12 "2020-07-06T15:44:35Z")

</div>

@dugan and @maflister – Thank you both for the tips. I was also looking for a way to run RStudio Server without Singularity, so I was happy to see the `--server-data-dir` and `--secure-cookie-key-file` options included in v1.3.

Special thanks to @maflister for the GitHub repo. It looks like this will do exactly what we need. I will be cloning and testing this today.

---

<div class="post-metadata">

**Author:** ![datakid](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/datakid/32/248_2.png) [@datakid](https://discourse.openondemand.org/u/datakid)\
**Post date:** [July 7, 2020, 5:47am UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/13 "2020-07-07T05:47:15Z")

</div>

I was thinking of doing this too, but the pre/post scripts looked intimidating. Was it that easy? I did see that the files are all installed into `/usr/lib/rstudio-server` on both rpm and deb machines. So then it’s just the pre/post scripts which I presume create + populate `/etc/rstudio/`, create `/var/run/xxx` and install a systemd script?

I guess if running it out of a Module, you don’t need the systemd script - what do you do about the other two functions?

---

<div class="post-metadata">

**Author:** ![dugan](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@dugan](https://discourse.openondemand.org/u/dugan)\
**Post date:** [July 7, 2020, 12:28pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/14 "2020-07-07T12:28:16Z")

</div>

Yes, it was that easy. The rpm scripts do things that are needed to run rstudio-server  
as a daemon but we don’t want that with ondemand. The config files installed in /etc/rstudio are empty. All the rserver config parameters that we need can be specified  
on the commandline. If you needed an rsession config file, rserver has a “–rsession-config-file” option.

---

<div class="post-metadata">

**Author:** ![datakid](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/datakid/32/248_2.png) [@datakid](https://discourse.openondemand.org/u/datakid)\
**Post date:** [July 8, 2020, 12:54am UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/15 "2020-07-08T00:54:49Z")

</div>

Me. It was useful to me. Thank you.

---

<div class="post-metadata">

**Author:** ![westburg.2](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@westburg.2](https://discourse.openondemand.org/u/westburg.2)\
**Post date:** [May 26, 2022, 3:43pm UTC](https://discourse.openondemand.org/t/rstudio-without-singularity/773/16 "2022-05-26T15:43:11Z")

</div>


