Uninstallation will fail because the prerm
script cannot stop the docker instance (because none is running):
root@hv ~ # aptitude purge lxc-docker
The following packages will be REMOVED:
lxc-docker{p}
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 4,483 kB will be freed.
Do you want to continue? [Y/n/?]
(Reading database ... 56846 files and directories currently installed.)
Removing lxc-docker ...
stop: Unknown instance:
dpkg: error processing lxc-docker (--purge):
subprocess installed pre-removal script returned error exit status 1
docker start/running, process 11949
Errors were encountered while processing:
lxc-docker
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
This script causes the problem /var/lib/dpkg/info/lxc-docker.prerm
(docker/packaging/ubuntu/lxc-docker.prerm
)
#!/bin/sh
# Stop docker
/sbin/stop docker
The script should only try to stop docker if an instance is running.
Thank you, Daniel!. Good catch. This has been done in the Debian package, I'll correct this.
I had pretty much the same problem on Ubuntu 12.04.
Error
# apt-get purge lxc-docker
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
bsdtar
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
lxc-docker*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 4,753 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 235601 files and directories currently installed.)
Removing lxc-docker ...
stop: Unknown instance:
dpkg: error processing lxc-docker (--purge):
subprocess installed pre-removal script returned error exit status 1
docker start/running, process 1841
Errors were encountered while processing:
lxc-docker
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB
localepurge: Disk space freed in /usr/share/gnome/help: 0 KiB
localepurge: Disk space freed in /usr/share/omf: 0 KiB
Total disk space freed by localepurge: 0 KiB
E: Sub-process /usr/bin/dpkg returned an error code (1)
To workaround it, I just did a dirty trick, commented out /sbin/stop docker
in the pre-removal script /var/lib/dpkg/info/lxc-docker.prerm
and it went through.
@dbanck, @terrywang could you verify the following patch works for you?
41cdd9b
Most helpful comment
I had pretty much the same problem on Ubuntu 12.04.
Error
To workaround it, I just did a dirty trick, commented out
/sbin/stop docker
in the pre-removal script/var/lib/dpkg/info/lxc-docker.prerm
and it went through.