In WSL (Windows Subsystem for Linux), using the systemctl command to manage certain services can result in the error: System has not been booted with systemd as init system (PID 1). Can't operate.

Taking starting Nginx as an example:

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

This indicates that your system was not booted with systemd, so the operation cannot be performed.

You can use the ps -p 1 command to check the process with PID 1:

ps -p 1
  PID TTY          TIME CMD
    1 ?        00:00:00 init(Debian)
  • If it shows init, your system is using the traditional SysV init.
  • If it shows systemd, your system is using systemd.

The systemctl command you are using is the core control tool for the systemd system manager and cannot be used under SysV init.

Solution

Switch the initialization method of your WSL subsystem from init to systemd. For detailed instructions, please see:

You can also use the service command as an alternative management tool. Examples are shown below:

sudo service nginx start       # Start
sudo service nginx stop        # Stop
sudo service nginx restart     # Restart
sudo service nginx reload      # Reload configuration
sudo service nginx status      # Check status
service --status-all           # List all services