Skip to content
This repository has been archived by the owner on Dec 30, 2021. It is now read-only.

Feature request: systemd for CentOS 8 in CentWSL #41

Open
datdinhquoc opened this issue May 31, 2020 · 10 comments
Open

Feature request: systemd for CentOS 8 in CentWSL #41

datdinhquoc opened this issue May 31, 2020 · 10 comments
Labels
enhancement New feature or request

Comments

@datdinhquoc
Copy link

I'm on WSL2, which supports 'systemd', however, after running CentOS8.exe to install CentOS 8, I found out that there's no systemd.

$ sudo dnf install nginx -y
$ sudo systemctl start nginx
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

May CentWSL (CentOS 8) come with systemd please?

@mahmoudajawad
Copy link

This is hard to achieve on WSL. If you are following the same discussions on Microsoft/WSL repo you will get more technical details on why. Alas, it was achieved by a community member to run systemd in a bottle but I can't recall the exact method. I believe you can find it with a quick search in github.

@datdinhquoc
Copy link
Author

This is hard to achieve on WSL.

it was promoted every on the internet that wsl2 would support systemd.
i'm on wsl2 now, but it's not working :(

@yuk7 yuk7 added the enhancement New feature or request label Jun 10, 2020
@vaska94
Copy link

vaska94 commented Jun 11, 2020

@yuk7 we can use this solution as a workaround : https://superuser.com/a/1556780
it works for me.

@choyongsun
Copy link

i do not working systemctl
error message

[root@slimes1 ~]# sudo systemctl start nginx
ERROR:systemctl: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR:systemctl: Oops, 1 unsupported directory settings. You need to create those before using the service.
ERROR:systemctl: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

@PavelSosin-320
Copy link

Ubuntu 20.04 someway achieved support in systemd although in the very strange way: when Ubuntu 20.04 is started from Ubuntu-2004.exe it systemd starts with PID 1 and supports all necessary features. If any other method is used like wsl -d Ubuntu2004, Open tab in Windows terminal, etc. it starts from init. This is not most graceful solution but reflects 2 different scenario: full Linux bootstrap and simple creation of pipe with Linux Ty. Maybe, it is not so extremally hard?
The main issue that full bootstrap takes some time but Ubuntu prints message that user has to be patient until systemd is settled. Nobody expects that Linux reboot and bash invocation takes the same time.

@tziady
Copy link

tziady commented Nov 6, 2020

So, out of my understanding here. I am using CentOS from this repository. Appears to function well and even install the applications and services that I want. However, it does not seem to have systemctl functionality. However, I am trying to run a LAMP stack. So, do I need to create /etc/init.d scripts for the services that I need manually?

Thanks. New to WSL2 and CentOS on it. But old Unix user and trying to get this to function the best possible practices. Will use for application development purposes.

Thanks,
Tamer

@yuk7
Copy link
Collaborator

yuk7 commented Nov 6, 2020

I recommend use subsystemctl for WSL2.
This makes systemd work with PID1 in new namespace.

https://github.com/sorah/subsystemctl

@tziady
Copy link

tziady commented Nov 7, 2020

Thank you for the info. I have installed it and having some trouble; but likely wrong paths or something. Will figure out.

Cheers,
T

@cardin
Copy link

cardin commented Dec 13, 2020

@tziady You can also consider this: https://github.com/gdraheim/docker-systemctl-replacement

It's a Python program that tries to emulate the behavior of systemctl (the master branch also includes some edits to emulate journalctl).

EDIT: pasted the wrong link

@PavelSosin-320
Copy link

@yuk7 I use your Centos 8.1 installed from GitHub upgraded to 8.2 because Microsoft Store Centos8 doesn't work at all. Who choose CentOS or Fedora wants RedHat stuff to work. but it uses systemd directly. I mentioned that Ubuntu 20.04 achieved full systemd functionality when it is run from its own Windows Ubuntu20.04 LTS exe bootstrap program and maintains scores of units. The Ubuntu 20.04 looks like OEM installation - it has oem files in the /boot folder. Maybe, this is the secret?
Meanwhile, I finally succeeded to upgrade my WSL Kernel to 5.4.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants