如何在Windows10SpringCreators更新中解决Ubuntu中的运行级错误?

如何在Windows10SpringCreators更新中解决Ubuntu中的运行级错误?,ubuntu,windows-subsystem-for-linux,ebtables,Ubuntu,Windows Subsystem For Linux,Ebtables,在运行Windows 10 Spring Creators Update(RS4)的Ubuntu 18.04中执行apt get dist升级时,我遇到以下错误: 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

在运行Windows 10 Spring Creators Update(RS4)的Ubuntu 18.04中执行
apt get dist升级时,我遇到以下错误:

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(它似乎是一个默认的/内置的软件包),但我不想筛选每个更新的输出,以确定除了这个之外是否还有新的错误。

结果是WSL不支持init/runlevels(这很有意义,因为它实际上没有正常的Linux引导过程),如下所述:

好消息是UbuntuCosmic已经做了一个修复,过滤到了Bionic(18.04)和Xenial(16.04):


如果您以前遇到过此问题,现在应该解决。

问题可能是因为
service\u control
脚本在尝试服务命令(将起作用)之前试图使用
invoke rc.d
(由于Docker容器中没有运行级别,因此不起作用)

因此,如果脚本中的
条件或延迟方式是,请更改
,使其查找不存在的路径,以便使用service命令。例如:

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

这是此问题的重复(在更合适的StackExchange站点上):。此外,这是更新脚本中的一个bug,它已经在一个新的ebtables包中得到了解决。从旧包进行的更新现已成功。问题是由失败的
stop
操作非不支持的运行级别引起的。请参阅:,以及链接注释中的补丁:在windows 10上的WSL for Ubuntu20.04中仍然存在相同的问题——您知道这个问题是否已经解决了吗?