Ubuntu – Can’t restart/shutdown Ubuntu under WSL

rebootshutdownwindowswindows-subsystem-for-linux

I just got Ubuntu from Microsoft Store and tried some things with it. However when i try to restart or shut down the system using sudo reboot or sudo shutdown -h I got a prompt saying

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

Does this means that I can't simply power off the machine since it's under WSL?
Do i have to just press X every time when i want to exit?

I've got the latest updates to Windows and Ubuntu.

Best Answer

I know this is old but just found that you can do it through powershell

list distributions:

wsl --list

will output something like

Windows Subsystem for Linux Distributions:
Ubuntu (Default)
docker-desktop-data
docker-desktop

terminate Ubuntu

wsl --terminate Ubuntu

or terminate all

wsl --shutdown

hope this helps!

Related Question