# SystemD in a Jail



## unitrunker (Aug 2, 2019)

This is a serious post so serious replies only please.

I'd like to run a Linux userland inside a jail. Nothing new there. The more popular Linux distros use SystemD. *What would it take to run a SystemD userland inside a jail?*

My guesses are:

1. Linuxulator adds / extends its API to support SystemD.
2. Substitute a fake SystemD that makes userland happy.
3. A combination of the above.

One such API is systemd-nspawn(1).

The goal is a happy path that satisfies the most common use cases for compatibility. This may be a pipe dream where running bhyve inside a jail is a much better (but more resource taxing) solution.


----------



## badbrain (Aug 3, 2019)

What is the specific distro you want to use inside a jail? ShellUser has a tutorial to install devuan inside jail.


----------



## unitrunker (Aug 3, 2019)

blackdog said:


> What is the specific distro you want to use inside a jail?


RH or CentOS or Ubuntu


----------



## Alexander Huemeyer (Aug 5, 2019)

Are u sure u need systemd? Also in docker-containers of your listed distros normaly no systemd is enabled.


----------



## badbrain (Aug 6, 2019)

Alexander Huemeyer said:


> Are u sure u need systemd? Also in docker-containers of your listed distros normaly no systemd is enabled.


For older versions of them, yes. For recent versions of them, no. They're now all systemd based.


----------



## Alexander Huemeyer (Aug 6, 2019)

blackdog said:


> For older versions of them, yes. For recent versions of them, no. They're now all systemd based.



They use systemd as init-system, but u can run all server tasks without systemd. U dont need an init-system in a jail.


----------



## badbrain (Aug 6, 2019)

Alexander Huemeyer said:


> They use systemd as init-system, but u can run all server tasks without systemd. U dont need an init-system in a jail.


I don't think it's that simple. But I could be wrong.


----------



## trasz@ (Jul 7, 2020)

From what I can see, at least with Ubuntu Bionic the `service` command works just fine without systemd, so if you want things to get started automatically it should be a matter of a trivial shell script to run as init for the Linux jail.


----------

