Reputation: 55
I've been trying to install docker on my WSL and it is constantly throwing an error
I've tried sudo apt-get remove ec2-instance-connect
and it is throwing this error:
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)
It is not allowing me to run an upgrade
or install
any new packages.
Can anyone help me here?
Upvotes: 5
Views: 1165
Reputation: 20734
I just ran across someone else with pretty much the same issue on the Unix & Linux Stack. When looking for an answer, I just found this (unanswered) question. I posted an answer there, but I'll repeat the relevant parts for this question in case anyone else comes across it.
ec2-instance-connect
turns out to be a pretty problematic package if installed erroneously on WSL. It should typically only be installed on Ubuntu when running in an Amazon/AWS EC2 instance.
It has both a post-install and post-remove script that assume Systemd, which isn't available on WSL. As far as I can tell, since the postinstall
never completes successfully, it attempts to run every time you do many other apt
commands.
To get rid of it (and stop the errors), it's not enough to sudo apt purge ec2-instance-connect
, because the post-remove errors will still fail (and the package will remain). You'll need to:
sudo rm /var/lib/dpkg/info/ec2-instance-connect.postrm
sudo apt purge ec2-instance-connect
sudo deluser --system --quiet ec2-instance-connect
apt
should be working properly again after this, but please see the Unix & Linux Stack answer linked above for some discussion on other things to check that may need to be cleaned up.
Upvotes: 4