【问题标题】:(using WSL ubuntu app) system has not been booted with system as init system (PID 1). Can't operate(使用 WSL ubuntu 应用程序)系统尚未以系统作为初始化系统 (PID 1) 启动。无法操作
【发布时间】:2018-10-02 07:51:26
【问题描述】:

我是 Ubuntu 的第一个用户。我在 wmware 中安装 Ubuntu 失败,所以我在 Microsoft 应用商店中安装了 Ubuntu 应用程序,一切都很好。 但是,当我插入关闭或停止命令以关闭我的 ubuntu 时,我不断收到“系统尚未启动,系统作为 init 系统(PID 1)。无法操作”的错误信息。

我尝试使用带有此链接 (https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/) 的 docker,但在多次进入 2 号进程后我失败了。我不确定我的失败是因为安装了码头收费箱而不是普通收费箱。 (我的电脑只是 windows 10。不是 windows pro)

我想我必须尝试其他事情。如果你不介意我问,我该如何解决这个问题?

(还有一个。如果我只是单击右上角的“X”按钮,与使用“停止”或“关闭”命令关闭 Ubuntu 有什么不同吗?

谢谢

【问题讨论】:

  • 要“关闭” WSL 实例,这可行:$ exit
  • @bvj 使用exit 不会“关闭” WSL 实例,它只是关闭终端。使用exit 后再次运行它并在htop 的正常运行时间掠夺。
  • @ABMRuman 有趣的观察。有可能它在退出时被暂停?
  • @bvj 虽然我对此不确定,但我相信 WSL 旨在像其他 Windows 进程一样在后台运行。

标签: docker ubuntu windows-subsystem-for-linux


【解决方案1】:

我发现这很有用:https://linuxhandbook.com/system-has-not-been-booted-with-systemd/

就我而言

# start docker using systemctl
sudo systemctl docker start 
# returns: 
# 
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

基本建议是:

# check if your system is using `systemd` or `sysvinit`
ps -p 1 -o comm=

如果命令不返回 systemd,在我的例子中,WSL 上的 Ubuntu-20.04,命令返回 init,然后使用命令模式

# start services using sysvinit
service docker start

这对我有用。

【讨论】:

  • service docker start 为我返回 docker: unrecognized service
【解决方案2】:

首先,通过 MS Store 安装的 Ubuntu 使用的是 WSL(适用于 Linux 的 Windows 子系统)技术。这仅仅意味着没有虚拟化,Windows 和 Linux 内核并存(Linux 内核尚未完全实现)。

因此,如果您尝试“关闭您的 Ubuntu”,您将像 Windows 一样关闭整个计算机。但在这种情况下,WSL 显然没有这样做的权利。

换句话说,您可以像查看任何其他终端一样查看 Ubuntu bash 窗口,例如CMD 或 PowerShell。

当您在 WSL (Ubuntu) 中启动程序时,您也可以在 Windows 任务管理器中看到它 - 这只是一个证明,没有虚拟化。

关于码头工人: 如果我没记错的话,Windows 10 Home 不提供 Hyper-V 虚拟化。这意味着您必须使用不同的,例如通过使用 VirtualBox。为了使它工作,我可以推荐你关注this tutorial,特别是对于VirtualBox,请检查这个答案here

希望对你有帮助:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-25
    • 1970-01-01
    • 1970-01-01
    • 2020-04-15
    • 2019-02-11
    • 1970-01-01
    • 2013-05-21
    • 2011-10-14
    相关资源
    最近更新 更多