How to Handle RStudio Server Errors on WSL Ubuntu

Published May 7, 2022
Updated Nov 15, 2025
2 minutes read
Note

This old post is translated by AI.

##Introduction

It seems some people have landed here from related search terms, so I'll explain the following error.

`warning message: in system("timedatectl", intern = true) : running command 'timedatectl' had status 1`

`System has not been booted with systemd as init system (PID 1). Can't operate.` `Failed to create bus connection: Host is down`

`TTY detected. Printing informational message about logging configuration.`

##The Conclusion Is: You Can Usually Ignore It

This error rarely causes problems, so you can probably ignore it. That said, you'd want to know what causes it and when it becomes a problem. I don't completely understand it either, but I'll summarize what I know for someone's benefit.

###Cause: systemd Doesn't Start with PID 1 Due to WSL's Specifications

If you're using native Linux, you might know that the daemon normally used to keep resident software like Rstudio-server running is systemctl 💡 However, for some reason, WSL2 is designed not to start systemd used by systemctl. (Then how does the sudo rstudio-server start command work?)

And somehow RStudio-server starts without using systemctl (brute forcing it?), so this warning appears after startup.

Hereafter, I'll refer to this phenomenon as "the systemd problem in WSL" 👋

###The Problem: Just an Annoying Error

Having experienced WSL2+Rstudio-server (+Python, Go, etc.) for about a year, I've never faced a major problem caused by the systemd issue. If I had to mention something, it would be inconvenient when you want to use systemctl 😈 (obvious since there's no systemd)

So my impression is that it's just an annoying error.

###Solution: Install genie

That said, having this message appear every time is annoying, so you'd want to fix it. There is a workaround. That is using a third-party tool called genie. genie was created specifically for this problem.

Note

Let me say this first: there's probably no fundamental solution to this problem at the moment. I think we need to wait for Microsoft to improve WSL2 itself. Also, the method I'm introducing here has many caveats. Please read the genie repository explanation in detail. (genie also says don't install without reading everything ⚠️)

First, install dependencies. What you need to prepare:

  • WSL2 (Win10)
  • Ubuntu
  • Python 3.9 or later
  • .NET Runtime
  • daemonize

Python 3.9 or later

Conda or anything works. If you have no preference, apt install should be fine. Python just needs to be 3.9 or later, but currently only up to 3.9 is in the apt repository.

sudo apt update
sudo apt install -i python3.9 python3-pip

.NET runtime

Microsoft has an explanation page for installing .NET runtime. For troubleshooting, please check there 👼

https://docs.microsoft.com/ja-jp/dotnet/core/install/linux-ubuntu#2004-

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
 
sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y aspnetcore-runtime-6.0

daemonize

Install daemonize after completing .NET runtime installation.

sudo apt install daemonize

Install genie

Once prepared, finally install genie 🧞🧞‍♀️

Various blogs have already explained installation methods, including building from source. As of May 2022, you can install via apt install.

sudo apt install -y systemd-genie

Using genie

From here, it's about how to operate genie.

sudo genie -s

The above command launches a shell where genie has started systemd with PID=1 🎉 Let's check:

 ps aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.2 173408 12620 ?        Ss   09:04   0:00 systemd
root          50  0.0  0.2  67836 15132 ?        S<s  09:04   0:00 /lib/systemd/systemd-journald
root          72  0.0  0.1  20564  6756 ?        Ss   09:04   0:00 /lib/systemd/systemd-udevd
systemd+      76  0.0  0.1  18380  7584 ?        Ss   09:04   0:00 /lib/systemd/systemd-networkd

Looks good!

In my environment, I couldn't get genie to launch at WSL2 startup via .zshrc, so I start it as needed.

##Finally

So I've introduced error handling up to using genie, but for RStudio users, the content probably wasn't satisfying 🤔 WSL2 just came out, and with new environments like WSLg for Win11 appearing one after another, there's a possibility that WSL2 or RStudio-server will address this issue in the future.

##References

Chiko-san's Zenn article that I referenced (Ubuntu)

https://zenn.dev/km1992/articles/4dc74aa582be06

Blog I referenced when installing genie in the past

https://shikiyura.com/2020/06/execute_systemctl_on_wsl2/

Someone trying on Fedora

https://www.tomoyan.net/windows/wsl

Someone trying on CentOS8

https://memo.open-code.club/%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89/%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB/dnf.html

wsl distrod including systemd

https://github.com/nullpo-head/wsl-distrod