WSL does not have systemd
WSL does not have systemd.
What is systemd?
Many Linux distributions use systemd
to manage system settings and services.
The systemctl
command is used to interact with processes that are controlled by systemd. It can examine the status of units and targets, as well as start, stop, and reconfigure them.
In order to remain lightweight, WSL does not include systemd (a service management system in Linux). Instead, it uses SysVinit to start services on your machine.
The problem that can arise
In normal Ububtu we can use this command
sudo systemctl start mongodb
to start the mongodb server.
but as WSL version of Ubuntu does not have systemd
this command will not work.
The workaround
we can use this command
sudo service mongodb start
to start the mongodb server or any other service.
Other related command
# command to start the server
sudo service mongodb start
# command to stop the server
sudo service mongodb stop
# command to check the status os the server
sudo service mongodb status