Monday, June 20, 2022

Resolve "System has not been booted with systemd as init system (PID 1). Can't operate" in WSL2 Ubuntu 20.04 distro

This blog explains how to fix the following error occurred when starting all the Chef services in Ubuntu 20.04 with WSL2 using "sudo chef-server-ctl reconfigure" command.

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



The reason for getting the above error is systemd is not running under WSL2. 

Let's try to fix the error with Distroid open source tool.

  • Go to WSL2 terminal and run the commands mentioned below to make the Ubuntu distro run with systemd
  • Download latest installer script 

curl -L -O "https://raw.githubusercontent.com/nullpo-head/wsl-distrod/main/install.sh"

  • Run downloaded installer script

chmod +x install.sh

sudo ./install.sh install

  • Use the following command to enable distroid in the WSL2 distro

sudo /opt/distrod/bin/distrod enable



  • Close WSL2 terminal, open a new Windows command prompt and run the following command to stop the Ubuntu distro

wsl --terminate <<your distro name >>


Now you would be able to open new WSL2 terminal and try out the Chef service start command successfully


No comments:

Post a Comment