1
  1. I am new to linux.
  2. I try to deploy a shiny server locally on my windows machine with ubuntu WSL.
  3. I successfully installed ubuntu WSL on my windows machine and I can start ubuntu.
  • I come here so far:

tarjae@DESKTOP-LNI8ONS:~$

  • If I type dir I get this:
R       rstudio-server-latest-amd64.deb    shiny-server-1.5.17.973-amd64.deb.1
app1.R  shiny-server-1.5.17.973-amd64.deb

From now on everything that happens is random for me, depending on which tutorial I go through!

So my question is:

  1. How can I check whether I am the root or a user? (Source for basic managing linux commands)?
  2. Where is my shiny server?
  3. How can I start the server sudo start shiny-server does not work ->
tarjae@DESKTOP-LNI8ONS:~$ sudo start shiny-server
[sudo] password for tarjae:
sudo: start: command not found
  1. And finally how can I start app1.R

I am fully aware that all this is kind of wage. But I hope to get the next step for my purposes. ANY directing advice is highly appreciated.

Update1:

dpkg-query -l shiny shows

dpkg-query: no packages found matching shiny

  • After sudo apt install ./shiny-server-1.5.17.973-amd64.deb it shows:
Note, selecting 'shiny-server' instead of './shiny-server-1.5.17.973-amd64.deb'
shiny-server is already the newest version (1.5.17.973).
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded. 

Update 2:

With

tarjae@DESKTOP-LNI8ONS:~$ dpkg-query -l | grep shiny

I get:

ii  shiny-server                   1.5.17.973                            amd64        Shiny Server
  • Then with
tarjae@DESKTOP-LNI8ONS:~$ systemctl start shiny-server

I get:

tarjae@DESKTOP-LNI8ONS:~$ systemctl start shiny-server
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

Update 3:

tarjae@DESKTOP-LNI8ONS:/home/shiny$ sudo service shiny-server start

I get:

tarjae@DESKTOP-LNI8ONS:/home/shiny$

Nothing happens. Last days I read a blog where I should create a new user and I did and with this new user I could see something on localhost:3838. I am sorry to take your time!

If I do:

tarjae@DESKTOP-LNI8ONS:~$ service shiny-server status
#OR
tarjae@DESKTOP-LNI8ONS:~$ sudo service shiny-server status
# I get:
tarjae@DESKTOP-LNI8ONS:~$ 
2
  • Well, do you see the Shiny Server home page at the URL? If so, then it's working. Dec 25, 2021 at 19:03
  • Unfortunately not! Anyway many thanks for your time. I think with my windows brain I am not able to cover this.
    – TarJae
    Dec 25, 2021 at 19:12

2 Answers 2

1

Good to hear you have it working on a droplet. I gave it a shot myself on WSL2/Ubuntu, and there are definitely a few issues.

Honestly, you've done very well in parsing out the competing directions given how new you are to Linux. You've tried exactly the right things in exactly the right order. I can explain here why they didn't work, and, hopefully, how to get it running.

For your "Update2":
systemctl start shiny-server

Yes, this is the "normal" method of starting it, but systemctl requires Systemd, which doesn't work on WSL2 without some hacky workarounds. Systemd is the init mechanism for most Linux distributions nowadays, but WSL needs its own /init in order to setup its tight integration with Windows (see this answer for more details on /init and this one for more info on Systemd under WSL2).

For your "Update3":
sudo start shiny-server

And again, you are absolutely right. Many applications and distributions still provide "older-style" init scripts for the SysVInit system that predated Systemd. Those scripts will typically run on WSL2 (and even WSL1) using the service command.

However, often these init scripts have been unmaintained or untested for too long. In this case, there's a definite bug in the init script that is causing it to fail. This bug would even prevent it from running on a "normal" (non-WSL) Ubuntu.

Two lines in the script cause it to fail before it even gets started:

DAEMON=shiny-server
[ -x "$DAEMON" ] || exit 0

This basically says, "Does the file 'shiny-server' exist with executable permissions? If not, exit the script."

Unfortunately, it doesn't provide the path to shiny-server. Changing the first line to ...

DAEMON=/opt/shiny-server/bin/shiny-server

... allows it to work, at least for service shiny-server start:

$ pgrep -x shiny-server
$ sudo service shiny-server start
$ pgrep -x shiny-server
7184

That said, there appear to be even more issues beyond that one, so restarting the service will also fail, and there's no support for status either.

Note that both service and systemctl are "convenience" methods of a sort. It's entirely possible to handle this on your own, especially for "simple" servers like shiny.

You can either look at the /etc/init.d/shiny-server or /opt/shiny-server/config/systemd/shiny-server.service to see what those files are doing, although this will admittedly be easier as you gain Linux experience.

That at least has it running, although I haven't actually tried it out to know if the functionality in there works at that point. If you do run into additional problems, though, I feel confident we can sort them out on WSL2. It's "just" a matter of knowing where to look.

1
  • This is very helpful!
    – TarJae
    Dec 27, 2021 at 23:11
1

As per comments, it seems that you can open tcp ports on WSL. So the issue must be on systemd. Apparently it's not used by WSL as init. Perhaps you could start shiny-server manually.

2
  • I will try this out. Thank you very much. Now I have changed my strategy. I have decided to host both shinyserver and rstudio server on digital ocean. And I was successful. I learned a lot in the past few days. Later with more knowledge I will start a shinyserver on my machine.
    – TarJae
    Dec 27, 2021 at 17:37
  • @NotTheDr01ds, I changed the answer so that it wouldn't mislead others. Thank you for pointing out.
    – Krackout
    Dec 27, 2021 at 18:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .