处理时遇到错误:ec2-instance-connect

时间:2020-11-10 13:44:50

标签: windows amazon-ec2 windows-subsystem-for-linux

我一直在尝试在我的WSL上安装docker,并且不断抛出错误

我已经尝试过sudo apt-get remove ec2-instance-connect,并且抛出了此错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  ec2-instance-connect
0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 57.3 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 64032 files and directories currently installed.)
Removing ec2-instance-connect (1.1.12+dfsg1-0ubuntu3) ...
Deleted system user ec2-instance-connect
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
dpkg: error processing package ec2-instance-connect (--remove):
 installed ec2-instance-connect package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 ec2-instance-connect
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

不允许我运行upgradeinstall任何新软件包。

有人可以在这里帮助我吗?

1 个答案:

答案 0 :(得分:0)

我刚刚在 Unix 和 Linux 堆栈上遇到了其他人,几乎是 same issue。在寻找答案时,我刚刚发现了这个(未回答的)问题。我在那里发布了一个答案,但我会重复这个问题的相关部分,以防其他人遇到它。

如果在 WSL 上错误安装

data %>% glmmulti(dependent, explanatory) ,结果是一个非常有问题的包。在 Amazon/AWS EC2 实例中运行时,它通常只应安装在 Ubuntu 上。

它具有假定 Systemd 的安装后和删除后脚本,WSL 上不提供该脚本。据我所知,由于 ec2-instance-connect 从未成功完成,因此每次您执行许多其他 postinstall 命令时它都会尝试运行。

要摆脱它(并停止错误),仅 apt 是不够的,因为删除后的错误仍然会失败(并且包将保留)。您需要:

sudo apt purge ec2-instance-connect

sudo rm /var/lib/dpkg/info/ec2-instance-connect.postrm sudo apt purge ec2-instance-connect sudo deluser --system --quiet ec2-instance-connect 应该会在此之后再次正常工作,但请参阅上面链接的 Unix & Linux Stack 答案,以了解可能需要清理的其他检查事项。