Closed werewolf666 closed 5 years ago
Instead of using sudo systemctl start docker
use: sudo /etc/init.d/docker start
, as of right now we do not have systemd in WSL 2.
The same is not working when trying to start mongodb service.
@imdpkmr are you trying to use systemctl
? Please try using the mongo equivalent of the command I put above, or sudo service mongod start
, does that fix your issue?
I have also faced the same issue when I'm using the systemctl
command for starting the puppet service.
Instead of that, I had used the service puppet start
command on ubuntu and it just worked fine for me. I hope someone gets help from this.
I also face the same issue with postgresql. do you have any idea how to solve it? thanks
I also face the same issue with postgresql. do you have any idea how to solve it? thanks
@ZhengxunWu Try the command sudo service postgresql start
for starting the postgresql service instead of sudo systemctl start postgresql
I also face the same issue with postgresql. do you have any idea how to solve it? thanks
@ZhengxunWu Try the command
sudo service postgresql start
for starting the postgresql service instead ofsudo systemctl start postgresql
problem solved.
Some services like docker (standalone, ubuntu version, installed using bash) still might not run even if you use sudo /etc/init.d/docker start
or sudo service docker start
or /etc/init.d/docker start
.
What you have to do is, run the linux subsystem as administrator by right clicking from start menu.
This will solve the issue and sudo service
command will execute as it should, as a sudo user.
May I ask is there suggested command for systemctl enable
equivalent?
Also one for sudo systemctl daemon-reload
?
$ sudo service firewalld start
* Starting dynamic firewall daemon firewalld [ OK ]
$ sudo service firewalld status
* firewalld is not running
there's no error, but it seems there should be...
$ sudo firewall-cmd --list-ports
FirewallD is not running
$ sudo irewall-cmd --list-services
FirewallD is not running
System has not been booted with systemd as init system (PID 1). Can't operate. Failed to talk to init daemon.
I got this when I try to run sudo tasksel
I was try the methodo to install the GUI of Ubuntu.
Some services like docker (standalone, ubuntu version, installed using bash) still might not run even if you use
sudo /etc/init.d/docker start
orsudo service docker start
or/etc/init.d/docker start
.What you have to do is, run the linux subsystem as administrator by right clicking from start menu. This will solve the issue and
sudo service
command will execute as it should, as a sudo user.
it
Some services like docker (standalone, ubuntu version, installed using bash) still might not run even if you use
sudo /etc/init.d/docker start
orsudo service docker start
or/etc/init.d/docker start
.What you have to do is, run the linux subsystem as administrator by right clicking from start menu. This will solve the issue and
sudo service
command will execute as it should, as a sudo user.
it works for me, run subsystem as administrator, and use 'sudo /etc/init.d/docker start'.
I can't upgrade InfluxDB because part of the script in apt-get install influxdb results in an error determining the current runlevel. There are also a lot of other packages that just wont run.
I'm going back to Hyper-V for the time being until you all get it worked out, ok?
Es posible que algunos servicios como docker (versión independiente, ubuntu, instalada con bash) aún no se ejecuten, incluso si usa
sudo /etc/init.d/docker start
orsudo service docker start
o/etc/init.d/docker start
.Lo que debe hacer es ejecutar el subsistema de Linux como administrador haciendo clic derecho en el menú de inicio. Esto resolverá el problema y el
sudo service
comando se ejecutará como debería, como usuario de sudo.
Hello, I have followed the steps to solve my problem however this has not worked for me. when I run sudo /etc/init.d/docker start
I getsudo: /etc/init.d/docker: command not found
. What could I do in that case. Thank you
when I run sudo /etc/init.d/docker start I get sudo: /etc/init.d/docker: command not found. What could I do in that case. same error for me
Are you using the docker.io
package from the official ubuntu repository? If yes, just run
$ sudo dockerd
I had this problem running WSL 2
the solution was the command
$ sudo dockerd
Open other terminal and try it
$ docker ps -a
if after that you still have a problem with permission, run the command:
$ sudo usermod -aG docker your-user
@felipementel Your answer is the most near to solve my problem. I can run docker commands but now I'm getting a "docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:319: getting the final child's pid from pipe caused \"EOF\"": unknown. ERRO[0006] error waiting for container: context canceled". Could you help me with this? Thank you very much in advance for your help.
Hi @TheTechOddBug ! i think that i can help you, sure!
So, tell me what are you doing to construction this error? And tell me about your environment ...
it still showing /etc/init.d/docker: command not found.
Hi @TheTechOddBug ! i think that i can help you, sure!
So, tell me what are you doing to construction this error? And tell me about your environment ...
Well @felipementel, I upgraded my system to Windows 10 2004, enabled WSL2 and installed an Ubuntu distribution. I set WSL v2 as default. I installed docker inside that Ubuntu distribution and follow your comments to make docker commands work but when I try to run the hello-world simple container with docker run, I got the previously commented error. Again, thank you for your help!
hi @TheTechOddBug,
check this --> https://success.docker.com/article/error-oci-runtime-create-failed-docker-1809
**sudo dockerd**
Thank you Felipe. It worked for me!
Is there any equivalent to sudo systemctl enable docker
at the moment? I'd like to be able to start the service automatically on boot.
so how does docker help u fix issues with the System has not been booted with systemd as init system (PID 1), having same issue on kali linux wsl during the setup of openvas, when I do the openvas-setup or the openvas-check-setup gives me that and everything else is running.
I also face the same issue with postgresql. do you have any idea how to solve it? thanks
@ZhengxunWu Try the command
sudo service postgresql start
for starting the postgresql service instead ofsudo systemctl start postgresql
problem solved.
service is unrecognized in my scenario.
For people looking for ways to enable services, I did find this and it was helpful to me https://github.com/shayne/wsl2-hacks/blob/master/README.md
Is enabling systemd / systemctl on the roadmap anytime soon? Going back to Ubuntu VM until then...
Recently, there is something added. See my comment here https://github.com/microsoft/WSL/issues/994#issuecomment-698927438
I am also getting this error while i am starting any service in docker debian_10_buster container. Actully i had install debian_10_buster image in docker and i want to restart some services like ntpd, networking, freeswitch using systemctl cmd but it's throwing an error like this. someone can help me to resolve this issue. Error :- System has not been booted with systemd as init system (PID 1). Can't operate. Failed to create bus connection: Host is down
@imdpkmr are you trying to use
systemctl
? Please try using the mongo equivalent of the command I put above, orsudo service mongod start
, does that fix your issue? @craigloewen-msft This returnsmongod: unrecognized service
. I understand that this is because mongodb is not installed yet. But the error in the issue title appears when I try to install mongodb itself. How do I come out of this loop?
May I ask is there suggested command for
systemctl enable
equivalent?
did you find an equivalent ?
If you are having WSL2, and running Ubuntu on Windows,
In Windows, start the Ubuntu terminal as Administrator
then run sudo service docker start
If you are having WSL2, and running Ubuntu on Windows,
In Windows, start the Ubuntu terminal as Administrator then run
sudo service docker start
i have docker desktop on windows and wsl2 and ubuntu too
i followed what you said but i get this error on ubuntu
docker: unrecognized service
Hi, I am facing the same issue, and when I'm starting docker service on WS2[Ubuntu Interface], docker service immediately starting and shutting down. This is when I'm trying to reboot the centos image :: System has not been booted with systemd as init system (PID 1). Can't operate.
From Ubuntu Interface :: tanmayroot@DESKTOP-S3H1OVS:/var/tmp/dock$ sudo service docker start [sudo] password for tanmayroot:
Ami missing something? or doing some blunder?
Regards, Tanmay
Hi @TheTechOddBug ! i think that i can help you, sure!
So, tell me what are you doing to construction this error? And tell me about your environment ...
I ran sudo dockerd, and i ended up on :: failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables v1.8.4 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded. (exit status 3)
Any thoughts to it? PS :: After sudo dockerd, I ran "sudo apt-get update -y".
Hi, I am facing the same issue, and when I'm starting docker service on WS2[Ubuntu Interface], docker service immediately starting and shutting down. This is when I'm trying to reboot the centos image :: System has not been booted with systemd as init system (PID 1). Can't operate.
From Ubuntu Interface :: tanmayroot@DESKTOP-S3H1OVS:/var/tmp/dock$ sudo service docker start [sudo] password for tanmayroot:
- Starting Docker: docker [ OK ] tanmayroot@DESKTOP-S3H1OVS:/var/tmp/dock$ sudo service docker status
- Docker is not running
Ami missing something? or doing some blunder?
Regards, Tanmay
Try this, Once the installation of docker is finished, do the following commands in order
sudo groupadd docker
sudo usermod -aG docker 'your_user_name'
su 'your_user_name'
sudo service docker start
docker version
(check whether the docker client and server engine is running)Hello, I am having this issue with rpcbind. I'm running Ubuntu 20.04.1 under Windows 10 (WSL2) and am trying to mount a directory in the filesystem. Trying to solve issues with doing this I've realised I can't restart rpcbind from the command line.
$ sudo /etc/init.d/rpcbind start
* Starting RPC port mapper daemon rpcbind ln: failed to create symbolic link '/run/sendsigs.omit.d/rpcbind': No such file or directory
[fail]
$ sudo service rpcbind start
* Starting RPC port mapper daemon rpcbind ln: failed to create symbolic link '/run/sendsigs.omit.d/rpcbind': No such file or directory
[fail]
$ systemctl start rpcbind
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
In my process list rpcbind shows as: _rpc 1783 266 0 14:47 ? 00:00:00 /sbin/rpcbind -w
Which if I compare to a linux box: root 941 1 0 Nov03 ? 00:00:01 /sbin/rpcbind -f -w
So for some reason rpc isn't a root process, I'm guessing because it's not using systemd. I'm not really familiar with this area and keep going around in circles. Googling so far hasn't bore fruit. Anyone have any ideas?
systemd still not working until now?
It works on my machine with WSL2:
Install daemonize and fontconfig
$ sudo apt install -y fontconfig daemonize
Edit /etc/profile
SYSTEMD_PID=$(ps -ef | grep '/lib/systemd/systemd --system-unit=basic.target$' | grep -v unshare | awk '{print $2}')
if [ -z "$SYSTEMD_PID" ]; then sudo /usr/bin/daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target SYSTEMD_PID=$(ps -ef | grep '/lib/systemd/systemd --system-unit=basic.target$' | grep -v unshare | awk '{print $2}') fi
if [ -n "$SYSTEMD_PID" ] && [ "$SYSTEMD_PID" != "1" ]; then exec sudo /usr/bin/nsenter -t $SYSTEMD_PID -a su - $LOGNAME fi
3. Edit /etc/sudoers
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target %sudo ALL=(ALL) NOPASSWD: /usr/bin/nsenter -t [0-9] -a su - [a-zA-Z0-9]
4. Restart WSL2 or source profile
$ sudo source /etc/profile
[Support by Running Snaps on WSL2 (Insiders only for now)](https://forum.snapcraft.io/t/running-snaps-on-wsl2-insiders-only-for-now/13033)
sudo: source: command not found
It works on my machine with WSL2:
- Install daemonize and fontconfig
$ sudo apt install -y fontconfig daemonize
- Edit /etc/profile
SYSTEMD_PID=$(ps -ef | grep '/lib/systemd/systemd --system-unit=basic.target$' | grep -v unshare | awk '{print $2}') if [ -z "$SYSTEMD_PID" ]; then sudo /usr/bin/daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target SYSTEMD_PID=$(ps -ef | grep '/lib/systemd/systemd --system-unit=basic.target$' | grep -v unshare | awk '{print $2}') fi if [ -n "$SYSTEMD_PID" ] && [ "$SYSTEMD_PID" != "1" ]; then exec sudo /usr/bin/nsenter -t $SYSTEMD_PID -a su - $LOGNAME fi
- Edit /etc/sudoers
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target %sudo ALL=(ALL) NOPASSWD: /usr/bin/nsenter -t [0-9]* -a su - [a-zA-Z0-9]*
- Restart WSL2 or source profile
$ sudo source /etc/profile
Yes,it works.I know this from https://kubernetes.io/blog/2020/05/21/wsl-docker-kubernetes-on-the-windows-desktop/#minikube-enabling-systemd same from Daniel Llewellyn.
The same is not working when trying to start mongodb service.
@imdpkmr @ankitkhalaur I came across this issue, and wrote a SysV init script that allows to start and stop MongoDB without Systemd. Seems to work fine, even after the MongoDB installation with apt-get
has returned an error.
In case that it's useful for somebody: https://github.com/heidemn/mongod-sysv
Of course the above-mentioned generic systemd workaround might be the better approach.
I also face the same issue with postgresql. do you have any idea how to solve it? thanks
@ZhengxunWu Try the command
sudo service postgresql start
for starting the postgresql service instead ofsudo systemctl start postgresql
Thank you very much! Worked like a charm <3
Some services like docker (standalone, ubuntu version, installed using bash) still might not run even if you use
sudo /etc/init.d/docker start
orsudo service docker start
or/etc/init.d/docker start
.What you have to do is, run the linux subsystem as administrator by right clicking from start menu. This will solve the issue and
sudo service
command will execute as it should, as a sudo user.
Thank you very much, This solved my issue.
Instead of using
sudo systemctl start docker
use:sudo /etc/init.d/docker start
, as of right now we do not have systemd in WSL 2.
that's great! it works for me
on WSL2 debian
service --status-all
service memcached status
Some services like docker (standalone, ubuntu version, installed using bash) still might not run even if you use
sudo /etc/init.d/docker start
orsudo service docker start
or/etc/init.d/docker start
.What you have to do is, run the linux subsystem as administrator by right clicking from start menu. This will solve the issue and
sudo service
command will execute as it should, as a sudo user.
@abmruman Thanks for your valuable comment it helped me to solve my issue for WSL 2 windows ubuntu
system:win10Pro-1903-18362.239 subLinux:ubuntu1804
when is input 【sudo systemctl start docker】but i can not start docker-daemon ,it show me this:【System has not been booted with systemd as init system (PID 1). Can't operate】 so,is i did wrong?