如何通过命令重启 Ubuntu 服务器?错误“重启失败:参数无效。系统尚未使用 systemd 作为初始化系统 (PID 1) 启动”

如何通过命令重启 Ubuntu 服务器?错误“重启失败:参数无效。系统尚未使用 systemd 作为初始化系统 (PID 1) 启动”

我通过 Microsoft Store 在 Windows 10 上安装了 Ubuntu!我无法重新启动它,我尝试使用 Google,但出现错误:

[email protected]:~# sudo reboot now
Failed to write reboot parameter file: No such file or directory
[email protected]:~# sudo reboot -f
Rebooting.
Failed to reboot: Invalid argument
[email protected]:~# sudo reboot
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to talk to init daemon.
[email protected]:~# sudo reboot -h
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to talk to init daemon.
[email protected]:~# sudo reboot -h now
Failed to write reboot parameter file: No such file or directory
[email protected]:~# sudo shutdown -r now
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to talk to init daemon.
[email protected]:~# sudo shutdown -r -H +0
System has not been booted with systemd as init system (PID 1). Can't operate.
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to talk to init daemon.
[email protected]:~# sudo systemctl reboot
System has not been booted with systemd as init system (PID 1). Can't operate.
System has not been booted with systemd as init system (PID 1). Can't operate.
[email protected]:~#

如何重启?谢谢

我得到了答案:

wslreboot
wsl --shutdown

答案1

我认为您已经以超级用户身份登录,因此不需要sudo在命令前输入任何内容。无论如何,请尝试此命令,看看它是否有效:

#/sbin/reboot

或者

#/sbin/shutdown -r now

答案2

尝试使用sudo service redis-server start

您的 WSL 版本可能不使用 systemd。上述命令用于重启服务器。

相关内容