2010년 5월 1일, 2막

WSL2에서 systemctl 사용 본문

Computer/Tips

WSL2에서 systemctl 사용

창천(蒼天) 2022. 8. 3. 23:42
sudo systemctl daemon-reload

WSL2에서 systemctl 실행 시 아래 오류 발생

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

 

systemctl enable 처리

wget --content-disposition \
> "https://gist.githubusercontent.com/djfdyuruiry/6720faa3f9fc59bfdf6284ee1f41f950/raw/952347f805045ba0e6ef7868b18f4a9a8dd2e47a/install-sg.sh"
chmod +x /tmp/install-sg.sh
/tmp/install-sg.sh && rm /tmp/install-sg.sh

powershell에서 wsl 중지

wsl --shutdown

powershell에서 wsl 재시작

wsl genie -s

 


sudo apt update
sudo apt install -y git
git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh

 

powershell에서 wsl 중지

wsl --shutdown