Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System has not been booted with systemd as init system (PID 1). Can't operate [closed]

People also ask

How do I boot to systemd as init?

To boot under systemd, select the boot menu entry that you created for the purpose. If you didn't bother to create one, just select the entry for your patched kernel, edit the kernel command line directly in grub and add init=/lib/systemd/systemd. systemd.

How do I enable systemd?

Enabling and Disabling Services To tell systemd to start services automatically at boot, you must enable them. To start a service at boot, use the enable command: sudo systemctl enable application .


Instead, use: sudo service redis-server start

I had the same problem, stopping/starting other services from within Ubuntu on WSL. This worked, where systemctl did not.

And one could reasonably wonder, "how would you know that the service name was 'redis-server'?" You can see them using service --status-all


Instead of using

sudo systemctl start redis

use:

sudo /etc/init.d/redis start

as of right now we do not have systemd in WSL

Or sometime it might be redis-server, like:

>> sudo /etc/init.d/redis-server start
Starting redis-server: redis-server.

Just do a ls, like: ls /etc/init.d


I had this problem running WSL 2

the solution was the command

 $ sudo dockerd

if after that you still have a problem with permission, run the command:

 $ sudo usermod -aG docker your-user

I was trying to start Docker within ubuntu and WSL.

This worked for me,

sudo service docker start


If you are using Docker, you may try an image that has Ubuntu with System D already active with this command:

docker run -d --name redis --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro jrei/systemd-ubuntu:18.04

Then you just need to run:

docker exec -it redis /bin/bash

and there you can just install Redis, start it, restart it or whatever you need.


For WSL2, I had to install cgroupfs-mount, than start the daemon, as described here:

sudo apt-get install cgroupfs-mount
sudo cgroupfs-mount
sudo service docker start

Total newbie here - after trying most of the above suggestions, the command that worked for me was sudo service apache2 --full-restart and the web server started up.

Maybe the error came up because I have been following lots of setup instructions without a reboot/restart. I'm working on Ubuntu 20.04 in WSL2 using Apache2 Debian.