win11安装的Ubuntu20.04子系统出现System has not been booted with systemd as init system (PID 1)问题的解决流程

简介: win11安装的Ubuntu20.04子系统出现System has not been booted with systemd as init system (PID 1)问题的解决流程

一、前言

       由于研究方向是无人机路径规划需要用到ros机器人操作系统,我就在Win11系统的电脑上安装了一个Ubuntu20.04LTS版本的Linux子系统。之后我在打开linux子系统的情况下把自己的win11主系统给关机了,后来再把电脑开机通过远程桌面连接去访问Linux子系统时出现了下面的错误:

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: 主机关闭

二、具体解决方法

按照下面的操作就行了:

第一步:切换root用户至自己账号

自己账号就是安装ubuntu20.04时自己创建的那个用户账号

运行命令:

root@LAPTOP-S0G7C3PS:~# su renlinchao

现象:

Sleeping for 1 second to let systemd settle
Welcome to Ubuntu 20.04.5 LTS (GNU/Linux 5.10.16.3-microsoft-standard-WSL2 x86_64)
 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
  System information as of 2022年 10月 15日 星期六 19:28:27 CST
  System load:  0.0                Processes:             44
  Usage of /:   4.8% of 250.98GB   Users logged in:       0
  Memory usage: 5%                 IPv4 address for eth0: 172.27.54.91
  Swap usage:   0%
 * Super-optimized for small spaces - read how we shrank the memory
   footprint of MicroK8s to make it the smallest full K8s around.
   https://ubuntu.com/blog/microk8s-memory-optimisation
0 更新可以立即应用。

第二步:重新安装xrdp

sudo apt-get install xrdp

现象:

[sudo] renlinchao 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
xrdp 已经是最新版 (0.9.12-1)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。

第三步:重新配置端口并启动xrdp

运行命令:

sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini
echo "gnome-session" > ~/.xsession
sudo systemctl restart xrdp
sudo systemctl status xrdp

现象:

● xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-10-15 20:55:15 CST; 8s ago
       Docs: man:xrdp(8)
             man:xrdp.ini(5)
    Process: 570 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, status=0/SUCCESS)
    Process: 578 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=0/SUCCESS)
   Main PID: 579 (xrdp)
      Tasks: 1 (limit: 4634)
     Memory: 1.2M
     CGroup: /system.slice/xrdp.service
             └─579 /usr/sbin/xrdp
Oct 15 20:55:14 LAPTOP-S0G7C3PS xrdp[578]: (578)(139874801551168)[INFO ] address [0.0.0.0] port [3390] mode 1
Oct 15 20:55:14 LAPTOP-S0G7C3PS xrdp[578]: (578)(139874801551168)[INFO ] listening to port 3390 on 0.0.0.0
Oct 15 20:55:14 LAPTOP-S0G7C3PS xrdp[578]: (578)(139874801551168)[INFO ] xrdp_listen_pp done
Oct 15 20:55:14 LAPTOP-S0G7C3PS xrdp[578]: (578)(139874801551168)[DEBUG] Closed socket 7 (AF_INET6 :: port 3390)
Oct 15 20:55:14 LAPTOP-S0G7C3PS systemd[1]: xrdp.service: Can't open PID file /run/xrdp/xrdp.pid (yet?) after start: 不>Oct 15 20:55:15 LAPTOP-S0G7C3PS systemd[1]: Started xrdp daemon.
Oct 15 20:55:16 LAPTOP-S0G7C3PS xrdp[579]: (579)(139874801551168)[INFO ] starting xrdp with pid 579
Oct 15 20:55:16 LAPTOP-S0G7C3PS xrdp[579]: (579)(139874801551168)[INFO ] address [0.0.0.0] port [3390] mode 1
Oct 15 20:55:16 LAPTOP-S0G7C3PS xrdp[579]: (579)(139874801551168)[INFO ] listening to port 3390 on 0.0.0.0
Oct 15 20:55:16 LAPTOP-S0G7C3PS xrdp[579]: (579)(139874801551168)[INFO ] xrdp_listen_pp done
lines 1-23/23 (END)...skipping...
● xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-10-15 20:55:15 CST; 8s ago
       Docs: man:xrdp(8)
             man:xrdp.ini(5)
    Process: 570 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, status=0/SUCCESS)
    Process: 578 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=0/SUCCESS)
   Main PID: 579 (xrdp)
      Tasks: 1 (limit: 4634)
     Memory: 1.2M
     CGroup: /system.slice/xrdp.service
             └─579 /usr/sbin/xrdp
Oct 15 20:55:14 LAPTOP-S0G7C3PS xrdp[578]: (578)(139874801551168)[INFO ] address [0.0.0.0] port [3390] mode 1
Oct 15 20:55:14 LAPTOP-S0G7C3PS xrdp[578]: (578)(139874801551168)[INFO ] listening to port 3390 on 0.0.0.0
Oct 15 20:55:14 LAPTOP-S0G7C3PS xrdp[578]: (578)(139874801551168)[INFO ] xrdp_listen_pp done
Oct 15 20:55:14 LAPTOP-S0G7C3PS xrdp[578]: (578)(139874801551168)[DEBUG] Closed socket 7 (AF_INET6 :: port 3390)
Oct 15 20:55:14 LAPTOP-S0G7C3PS systemd[1]: xrdp.service: Can't open PID file /run/xrdp/xrdp.pid (yet?) after start: 不 允许的操作
Oct 15 20:55:15 LAPTOP-S0G7C3PS systemd[1]: Started xrdp daemon.
Oct 15 20:55:16 LAPTOP-S0G7C3PS xrdp[579]: (579)(139874801551168)[INFO ] starting xrdp with pid 579
Oct 15 20:55:16 LAPTOP-S0G7C3PS xrdp[579]: (579)(139874801551168)[INFO ] address [0.0.0.0] port [3390] mode 1
Oct 15 20:55:16 LAPTOP-S0G7C3PS xrdp[579]: (579)(139874801551168)[INFO ] listening to port 3390 on 0.0.0.0
Oct 15 20:55:16 LAPTOP-S0G7C3PS xrdp[579]: (579)(139874801551168)[INFO ] xrdp_listen_pp done

第四步:打开远程连接窗口

微信图片_20221017093912.png

第五步:点击连接,开始进入Linux子系统

微信图片_20221017093914.png

第六步:切换到的账户的输入密码,并点击认证

微信图片_20221017093917.png

第七步:成功进入Ubuntu20.04

微信图片_20221017093919.png

三、尾言

        尝试新事物重新各种各样的错误是肯定的,出现某种错误的原因也是多种多样的,如果上面的流程没有解决你的问题可以下面留言或者直接加我微信问我都是可以的,都是免费的,学技术问人不丢人,关键是要知道去学,不要让自己的大学四年或者研究生三年白白浪费了。



相关文章
|
6天前
|
Ubuntu Python
Ubuntu 安装Python3.8
Ubuntu 安装Python3.8
46 0
|
5天前
|
Ubuntu Linux Docker
window10下安装ubuntu系统以及docker使用
window10下安装ubuntu系统以及docker使用
|
5天前
|
Ubuntu Java
Ubuntu18.04下安装ES6.8基础服务 - 蓝易云
以上就是在Ubuntu 18.04下安装Elasticsearch 6.8的基本步骤。
8 0
|
6天前
|
并行计算 Ubuntu Docker
Docker环境Ubuntu20.04安装Python3.10版本
Docker环境Ubuntu20.04安装Python3.10版本
50 0
|
6天前
|
Ubuntu Shell Linux
ubuntu安装conda
ubuntu安装conda
12 0
|
6天前
|
Ubuntu Docker 容器
Ubuntu 22.04.3 LTS_安装Docker
Ubuntu 22.04.3 LTS_安装Docker
59 1
|
6天前
|
并行计算 Shell Docker
【环境配置】Ubuntu16.04安装nvidia-docker
【环境配置】Ubuntu16.04安装nvidia-docker
20 2
|
6天前
|
并行计算 Ubuntu
Ubuntu安装CUDA和cuDNN
Ubuntu安装CUDA和cuDNN
14 3
|
6天前
|
Ubuntu NoSQL 数据安全/隐私保护
如何在在虚拟机中安装Ubuntu
如何在在虚拟机中安装Ubuntu
14 0
|
6天前
|
SQL 分布式计算 关系型数据库
Ubuntu上安装MySQL以及hive
Ubuntu上安装MySQL以及hive
18 1