System has not been booted with systemd as init system (PID 1). Can't operate.解决方法

在WSL(Windows Subsystem for Linux,适用于Linux的Windows子系统)下通过systemctl命令启动某些服务将造成System has not been booted with systemd as init system (PID 1). Can't operate.这样的错误;

以启动Nginx为例:

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
wsl启动服务错误

解决方法

尝试使用以下方法启动服务:

service nginx start

原创内容,如需转载,请注明出处;

本文地址: https://www.perfcode.com/p/system-has-not-been-booted-with-systemd-as-init-system.html

分类: 计算机技术
推荐阅读:
使用C语言计算圆周率 以下是C语言代码示例,使用莱布尼茨级数计算圆周率:
Linux终端重用上一条命令的参数 在Linux系统下,当你想使用上一条命令所用的参数,你可以通过这一条命令实现:
Python any()函数 any()是 Python 内置函数之一,接受一个可迭代对象(例如列表、元组、集合或生成器)作为参数,如果至少有一个元素在逻辑上等价于 True,则返回 True,否则返回 False。
Python生成n个元素的全排列 本文将使用Python语言编写程序生成n个元素的全排列,代码不使用第三方库;
Rust语言中获取数组的大小 Rust语言中,数组提供len()方法可获取数组中的元素数量,即数组的大小;
Python map()函数 map() 是 Python 中的一个内置函数,它接受一个函数和一个或多个可迭代对象作为输入,返回一个新的可迭代对象,其中每个元素都是将输入函数应用于相应元素的结果。