Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(using WSL ubuntu app) system has not been booted with system as init system (PID 1). Can't operate

I'm a very first user of Ubuntu. I failed to install Ubuntu in wmware ,so I installed Ubuntu application in Microsoft app store and everything was quite all right. But when I insert shutdown or halt command to power off my ubuntu I kept getting 'system has not been booted with system as init system (PID 1). Can't operate' error message.

I tried to using docker following with this link (https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/) but I failed after going to Number 2 process many times. I'm not sure my failure is because of installing docker toll box instead of normal one. (my computer is just windows 10. not a windows pro)

I think I have to try other thing. If you don't mind me asking, how can I slove this problem?

(and one more. If I just click 'X' button at the top of right side, is it different with shutting down Ubuntu using 'halt' or 'shutdown' command?

Thank you

like image 632
jamie 8910 Avatar asked Oct 02 '18 07:10

jamie 8910


People also ask

How do I fix system has not been booted with systemd as init system?

How to fix 'System has not been booted with systemd' error? The simple answer is to not use the systemctl command. Instead, use the equivalent sysvinit command. It's not too complicated and both commands have somewhat similar syntax.

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.


2 Answers

I found this useful: https://linuxhandbook.com/system-has-not-been-booted-with-systemd/

In my case

# start docker using systemctl
sudo systemctl docker start 
# returns: 
# 
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

The basic advice is:

# check if your system is using `systemd` or `sysvinit`
ps -p 1 -o comm=

If the command doesn't return systemd, and in my case, Ubuntu-20.04 on WSL, the command returned init, then use the command pattern

# start services using sysvinit
service docker start

This works for me.

like image 90
kingaj Avatar answered Oct 23 '22 15:10

kingaj


First of all, Ubuntu installed via MS Store is using WSL (Windows Subsystem for Linux) Technology. It simply means there is no virtualization, Windows and Linux kernels are living side by side (the Linux kernel is not fully implemented yet).

So if you are trying to "shut down your Ubuntu", you would turn off the whole computer just like the Windows does. But in this case, WSL doesn't apparently have rights to do that.

In other words, you can look at your Ubuntu bash window just like any other terminal, like e.g. CMD or PowerShell.

When you start a program in the WSL (Ubuntu), you can see it also in Windows Task Manager - that's just a proof, that there is no virtualization.

Regarding docker: If I'm not mistaken Windows 10 Home doesn't provide Hyper-V virtualization. It means you'll have to use a different one e.g. by using VirtualBox. In order to make it work, I can recommend you to follow this tutorial and especially for VirtualBox please check this answer here

Hope it helps :)

like image 36
DzeryCZ Avatar answered Oct 23 '22 16:10

DzeryCZ