4

apt-get dist-upgradeWindows 10 Spring Creators Update (RS4) 上运行 Ubuntu 18.04 时,我收到此错误:

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

4

2 回答 2

5

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

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

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

于 2018-05-31T20:21:15.163 回答
1

问题可能是因为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
于 2020-05-16T03:51:06.540 回答