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

Posted 通信汪的美好生活

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了win11安装的Ubuntu20.04子系统出现System has not been booted with systemd as init system (PID 1)问题的解决流程相关的知识,希望对你有一定的参考价值。

目录

一、前言

二、具体解决方法

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

第二步:重新安装xrdp

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

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

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

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

 第七步:成功进入Ubuntu20.04 

 三、尾言


一、前言

        由于研究方向是无人机路径规划需要用到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

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

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

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

 第七步:成功进入Ubuntu20.04 

 三、尾言

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

以上是关于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)问题的解决流程

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

win11使用wsl的ubuntu系统安装Go

windows10安装ubuntu20.04双系统详细图文教程,windows10安装ubuntu20.04详细教程

Win10 安装 Ubuntu 20.04 双系统完美避坑教程 (非虚拟机)

联想 lenovo thinkbook 14 G2 ITL 安装 ubuntu20.04 + win10 双系统