【问题标题】:How to work around runlevel error in Ubuntu on Windows 10 Spring Creators Update?如何在 Windows 10 Spring Creators Update 上解决 Ubuntu 中的运行级别错误?
【发布时间】:2018-05-31 20:11:49
【问题描述】:

在 Windows 10 Spring Creators Update (RS4) 上运行的 Ubuntu 18.04 中执行 apt-get dist-upgrade 时,我收到此错误:

Preparing to unpack .../ebtables_2.0.10.4-3.5ubuntu2.18.04.1_amd64.deb ...
invoke-rc.d: could not determine current runlevel
 * Error: insufficient privileges to access the ebtables rulesets.
invoke-rc.d: initscript ebtables, action "stop" failed.
dpkg: warning: old ebtables package pre-removal script subprocess returned error exit status 1
dpkg: trying script from the new package instead ...
invoke-rc.d: could not determine current runlevel
 * Error: insufficient privileges to access the ebtables rulesets.
invoke-rc.d: initscript ebtables, action "stop" failed.
dpkg: error processing archive /var/cache/apt/archives/ebtables_2.0.10.4-3.5ubuntu2.18.04.1_amd64.deb (--unpack):
 new ebtables package pre-removal script subprocess returned error exit status 1
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
invoke-rc.d: could not determine current runlevel
Errors were encountered while processing:
 /var/cache/apt/archives/ebtables_2.0.10.4-3.5ubuntu2.18.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我并不真正关心 ebtables(它似乎是一个默认/内置包),但我不想筛选每个更新的输出来确定除此之外是否还有新错误。

【问题讨论】:

  • 这是这个问题的副本(在更合适的 StackExchange 站点上):Unable to update ebtables on WSL。此外,这是更新脚本中的一个错误,它已经在一个新的 ebtables 包中得到解决。旧包的更新现已成功。

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


【解决方案1】:

事实证明,WSL 不支持 init/runlevels(这是有道理的,因为它实际上并没有正常的 Linux 启动过程),如下所述: https://github.com/Microsoft/WSL/issues/1761#issuecomment-393154803

好消息是在 Ubuntu Cosmic 中进行了修复,过滤到 Bionic (18.04) 和 Xenial (16.04): https://github.com/Microsoft/WSL/issues/1761#issuecomment-393652849

如果您之前遇到过这个问题,现在应该已经解决了。

【讨论】:

【解决方案2】:

问题可能是因为service_control 脚本在尝试服务命令之前尝试使用invoke-rc.d(这不起作用,因为 Docker 容器中没有运行级别)。

所以更改脚本中的if 条件,或者懒惰的方法是让它寻找一个不存在的路径,以便它使用服务命令。例如:

if [ -x /xxxusr/sbin/invoke-rc.d ]; then
  /usr/sbin/invoke-rc.d $OMSAGENT_WS start
  elif [ -x /sbin/service ]; then
  /sbin/service $OMSAGENT_WS start

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-27
    • 2022-06-23
    • 2019-07-25
    • 2017-08-29
    • 2018-02-07
    • 1970-01-01
    • 2017-09-23
    • 1970-01-01
    相关资源
    最近更新 更多