Ubuntu 报错:System has not been booted with systemd as init system (PID 1). Can‘t operate.

简介: 系统未使用 `systemd` 初始化导致错误。解决方法是通过 `apt` 安装。首先备份并更换`sources.list`,添加阿里云镜像源,然后更新源并以管理员权限运行 `apt-get install systemd -y` 和 `apt-get install systemctl -y` 安装所需组件。

@[toc]

错误原因

该错误提示表明你的系统没有使用 systemd 作为初始化系统。

在 Linux 系统中,初始化系统是启动系统时第一个启动的进程,负责启动和管理系统中的各种服务。

我在使用其它组件中出现了这个问题,通过 apt 安装该指令后成功解决。

通过 apt 进行安装

更换下载源并进行更新:

# 备份旧的下载源
mv /etc/apt/sources.list /etc/apt/sources.list.old

# 创建新的下载源
vim /etc/apt/sources.list

添加新的下载源(亲测可用):

deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

添加完成后,保存并退出,更新下载源:

apt update

安装

非管理员用户在命令前添加 sudo 权限指令:

apt-get install systemd -y
apt-get install systemctl -y
相关文章
|
8月前
|
Ubuntu Windows
处理ubuntu启动过程中报错error:proc_thermal_add错误的方法
了解以上方法,就像寻找鬼屋出口的吊灯,当初见“error:proc_thermal_add错误”时的恐惧不翼而飞。各位Ubuntu使用者都是勇敢的探险家,遇到的问题无非是丛林中的野兽,尝试、努力和坚持总能找到解决的办法。
225 21
|
Ubuntu
Ubuntu22.04,AOSP编译报错: libncurses.so.5: cannot open shared object file: No such file
本文描述了在Ubuntu 22.04系统上编译AOSP时遇到的`libncurses.so.5`缺失错误,并提供了通过安装相应库解决该问题的步骤。
2682 0
|
Ubuntu
蓝易云 - Ubuntu20.04安装软件报错:The following packages have unmet dependencies
如果以上步骤都不能解决问题,可能需要手动查找并安装缺失的依赖软件包。你可以通过运行 `sudo apt-cache search <package-name>`来搜索软件包,然后使用 `sudo apt install <package-name>`进行安装。
845 2
|
Linux Ubuntu
蓝易云 - Linux学习之Ubuntu20使用systemd管理OpenResty服务
这就是在Ubuntu 20使用systemd管理OpenResty服务的基本方法。
352 3
|
Ubuntu PHP
ubuntu php libzip安装 ./configure报错 checking for libzip... not found configure
ubuntu php libzip安装 ./configure报错 checking for libzip... not found configure
373 1
|
3月前
|
Ubuntu 安全 iOS开发
Nessus Professional 10.10 Auto Installer for Ubuntu 24.04 - Nessus 自动化安装程序
Nessus Professional 10.10 Auto Installer for Ubuntu 24.04 - Nessus 自动化安装程序
184 5
|
3月前
|
NoSQL Ubuntu MongoDB
在Ubuntu 22.04上安装MongoDB 6.0的步骤
这些步骤应该可以在Ubuntu 22.04系统上安装MongoDB 6.0。安装过程中,如果遇到任何问题,可以查阅MongoDB的官方文档或者Ubuntu的相关帮助文档,这些资源通常提供了解决特定问题的详细指导。
371 18
|
4月前
|
Ubuntu 安全 关系型数据库
安装MariaDB服务器流程介绍在Ubuntu 22.04系统上
至此, 您已经在 Ubuntu 22.04 系统上成功地完成了 MariadB 的标准部署流程,并且对其进行基础但重要地初步配置加固工作。通过以上简洁明快且实用性强大地操作流程, 您现在拥有一个待定制与使用地强大 SQL 数据库管理系统。
321 18
|
4月前
|
Ubuntu 安全 关系型数据库
安装MariaDB服务器流程介绍在Ubuntu 22.04系统上
至此, 您已经在 Ubuntu 22.04 系统上成功地完成了 MariadB 的标准部署流程,并且对其进行基础但重要地初步配置加固工作。通过以上简洁明快且实用性强大地操作流程, 您现在拥有一个待定制与使用地强大 SQL 数据库管理系统。
349 15