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

三、尾言

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



相关文章
|
3天前
|
机器学习/深度学习 Ubuntu 数据挖掘
Ubuntu系统部署Anaconda环境及Python语言的详细流程
以上就是在Ubuntu系统中安装Anaconda环境及Python语言的详细流程。Anaconda为Python科学计算提供了便捷的管理方式,帮助用户轻松处理不同项目之间依赖管理的复杂性。通过以上步骤,你现在应该有了一个完全可用的Anaconda环境,可以开始在Ubuntu上进行Python编程和数据科学项目的探索了。
13 5
|
1天前
|
Ubuntu Shell Docker
在Docker环境下如何“安装”Ubuntu
【8月更文挑战第18天】在Docker环境中“安装”Ubuntu实际上是指利用Ubuntu镜像构建容器。
11 1
|
3天前
|
Ubuntu 安全 测试技术
Ubuntu 22.04 Samba 安装和配置
SMB(Server Message Block)是一种跨平台的文件共享协议,它允许不同操作系统之间的文件和打印机共享。在本文中,我们将详细介绍如何在 Ubuntu 服务器上部署和配置一个 SMB 服务器,并涵盖多通道配置、性能测试、安全最佳实践以及一些常见问题。【8月更文挑战第1天】
19 1
|
4天前
|
NoSQL Ubuntu Java
如何在 Ubuntu 14.04 上安装 Graylog2 并实现日志集中管理
如何在 Ubuntu 14.04 上安装 Graylog2 并实现日志集中管理
10 1
|
4天前
|
分布式计算 Ubuntu Hadoop
在Ubuntu 16.04上如何在独立模式下安装Hadoop
在Ubuntu 16.04上如何在独立模式下安装Hadoop
10 1
|
4天前
|
存储 Ubuntu Go
在Ubuntu 16.04上安装Go 1.6的方法
在Ubuntu 16.04上安装Go 1.6的方法
10 1
|
4天前
|
存储 Ubuntu Go
在Ubuntu 18.04上安装Go的方法
在Ubuntu 18.04上安装Go的方法
8 1
|
4天前
|
存储 Ubuntu Linux
在Ubuntu 14.04上安装Go 1.6的方法
在Ubuntu 14.04上安装Go 1.6的方法
12 1
|
4天前
|
存储 Ubuntu 开发工具
在Ubuntu 18.04上安装Git的方法
在Ubuntu 18.04上安装Git的方法
9 0
|
4天前
|
存储 Ubuntu 开发工具
在Ubuntu 16.04上安装Git的方法
在Ubuntu 16.04上安装Git的方法
6 0