Cant uninstall Docker from Ubuntu on WSL - docker

I am trying to uninstall Docker but I always get an Error. I already searched in the internet but wasnt succesful to fix the error. I have the impression there are some broken packages but I am very new to Linux in general.
This is the result:
sudo apt-get purge -y docker-ce
1 ↵ Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
docker-ce*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 181 MB disk space will be freed.
(Reading database ... 44147 files and directories currently installed.)
Removing docker-ce (18.03.1~ce-0~ubuntu) ...
invoke-rc.d: could not determine current runlevel
* Stopping Docker: docker start-stop-daemon: warning: failed to kill 466: No such process
No process in pidfile '/var/run/docker-ssd.pid' found running; none killed.
invoke-rc.d: initscript docker, action "stop" failed.
dpkg: error processing package docker-ce (--purge):
subprocess installed pre-removal script returned error exit status 1
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
I hope anybody can help me with that. :)

I had this same error trying to remove docker.io from WSL, which is apparently preinstalled. The problem is that the pre-removal script is failing because docker has never run, and therefore it cannot be stopped.
In my case I sudo-edited /var/lib/dpkg/info/docker.io.prerm and replaced /sbin/stop docker (which was failing) with true (which simply returns success). After that, apt remove docker.io worked perfectly.
(I found the solution here, an old problem from 2013: docker can't be uninstalled if it never worked (Ubuntu))

I had the same error while removing docker packages docker-ce docker-ce-cli. Basically docker service was not running on my machine, which is why I wanted to remove it completely and install again. As docker service never ran, script /var/lib/dpkg/info/docker-ce.prerm was failing to stop docker service. Removing this check worked perfectly..

Related

podman error: Error: error creating build container: initializing source

I have a strange problem with podman. I have a large Dockerfile of an open source project called spilo that I was always able to build. Today for some strange reason the same code doesn't work anymore. It's true that I haven't used podman for a month but today I got a strange problem. To simplify the error I created a simple Dockerfile just to show you the problem:
ARG BASE_IMAGE=ubuntu:18.04
ARG PGVERSION=14
ARG COMPRESS=false
FROM $BASE_IMAGE as builder-false
RUN apt-get update; apt-get install -y pgbackrest
FROM scratch as builder-true
COPY --from=builder-false / /
FROM builder-${COMPRESS}
Now if I run:
podman build . -t prova:latest
I got the following error:
[3/3] STEP 1/1: FROM builder-false
Resolving "builder-false" using unqualified-search registries (/etc/containers/registries.conf.d/999-podman-machine.conf)
Trying to pull docker.io/library/builder-false:latest...
Error: error creating build container: initializing source docker://builder-false:latest: reading manifest latest in docker.io/library/builder-false: errors:
denied: requested access to the resource is denied
unauthorized: authentication required
It seems it try to search the builder-false image from docker.io repository instead try to build it from the row above. The steps to create the builder-false are not executed.
Can anyone help me to address this issue?
The original spilo project Dockerfile always worked. I reinstalled the podman VM but no luck. I also restarted the Mac, no luck.
I think there is a bug somewhere in dependencies of pgbackrest. I got this on my podman (centos 8) executing RUN apt-get install -y pgbackrest:
chfn: PAM: System error
adduser: `/usr/bin/chfn -f PostgreSQL administrator postgres' returned error code 1. Exiting.
dpkg: error processing package postgresql-common (--configure):
installed postgresql-common package post-installation script subprocess returned error exit status 1
With docker works fine.

How to fix this annoying docker error? (failed to register layer)

This error appears when I try to press ANY docker image.
This is a Fresh installation of docker in 5.0.21-rt14-MANJARO
Unable to find image 'ubuntu:16.04' locally
16.04: Pulling from library/ubuntu
35b42117c431: Extracting [==================================================>] 43.84MB/43.84MB
ad9c569a8d98: Download complete
293b44f45162: Download complete
0c175077525d: Download complete
docker: failed to register layer: Error processing tar file(exit status 1): Error cleaning up after pivot: remove /.pivot_root336598748: device or resource busy.
See 'docker run --help'.
I had the same error with the 5.0.xxx Kernel. Switching back to 4.19.59-1-MANJARO solved the problem...
EDIT:
you might try:
sudo tee /etc/modules-load.d/loop.conf <<< "loop"
sudo modprobe loop
then reboot and try again.
I'm now on 5.2.4-1-MANJARO
and everything works.
I followed these instructions here:
https://linuxhint.com/docker_arch_linux/
Yes, the problem is with your kernel version. I installed the version 5.2.4 and works very well.
Version with problem: 5.0.21

docker install container-selinux hang on centos

i have centos 7 (on Xen) and I'm trying to install the latest stable update.
first thing that I did is to stop the docker service and remove old versions from the procedure
then I have tried to install docker-ce using the command (I have already added the docker repo):
sudo yum install docker-ce
from some reason the installation hang.
command output:
Loaded plugins: fastestmirror, langpacks Loading mirror speeds from
cached hostfile * base: repo1.ash.innoscale.net * epel:
mirror.us.leaseweb.net * extras: mirror.rackspace.com * updates:
ftp.osuosl.org Resolving Dependencies There are unfinished
transactions remaining. You might consider running
yum-complete-transaction, or "yum-complete-transaction --cleanup-only"
and "yum history redo last", first to finish them. If those don't work
you'll have to try removing/installing packages by hand (maybe
package-cleanup can help).
--> Running transaction check
---> Package docker-ce.x86_64 0:17.09.0.ce-1.el7.centos will be installed
--> Processing Dependency: container-selinux >= 2.9 for package: docker-ce-17.09.0.ce-1.el7.centos.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.28-1.git85ce147.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================================================================= Package Arch
Version Repository
Size
================================================================================================================================================================================= Installing: docker-ce x86_64
17.09.0.ce-1.el7.centos docker-ce-stable 21 M Installing for dependencies: container-selinux
noarch 2:2.28-1.git85ce147.el7
extras 29 k
Transaction Summary
================================================================================================================================================================================= Install 1 Package (+1 Dependent package)
Total size: 21 M Installed size: 76 M Is this ok [y/d/N]: y
Downloading packages: Running transaction check Running transaction
test Transaction test succeeded Running transaction Installing :
2:container-selinux-2.28-1.git85ce147.el7.noarch
the installation hang on container-selinux.
after stopping (I have waited 1 hour) the yum install process I'm getting the error:
warning: %post(container-selinux-2:2.28-1.git85ce147.el7.noarch)
scriptlet failed, signal 2 Non-fatal POSTIN scriptlet failure in rpm
package 2:container-selinux-2.28-1.git85ce147.el7.noarch
now here is the strange thing... actually after stopping the process the container-selinux has been installed (not sure if successfully)
so after that I was able to install docker-ce without issue but only after interrupt the fist installation that was hang
any idea how to complete the installation without the be hanging?
remarks:
1) already tried reboot
2) already tried to install using the command: yum install --setopt=obsoletes=0 docker-ce
3) the repository extras already enabled
4) no disk space or performance issue on the server
5) already tried: yum-complete-transaction --cleanup-only
6) there is already containers + volumes that their data (under /var/lib/docker/) is still exist on disk
after several hours of trying things to make the installation work without hanging I have succeeded only after yum update all the packages in the server
looks like that the package (in my case) container-selinux-2.28-1.git85ce147.el7.noarch.rpm (here) contains some Requirements of the packages (here):
libselinux-utils
policycoreutils >= 2.5-11
policycoreutils-python
selinux-policy >= 3.13.1-39
selinux-policy-base >= 3.13.1-39
selinux-policy-targeted >= 3.13.1-39
I didn't try to update only them but probably it will do the work

Run Vagrant inside Docker container

I am looking for a way to run vagrant inside docker container. I tried using Ubuntu base container but had faced some issues while doing vagrant up, it failed.
root#991baf290ddc:/srv# vagrant up
VirtualBox is complaining that the installation is incomplete. Please
run VBoxManage --version to see the error message which should contain
instructions on how to fix this error.
root#991baf290ddc:/srv# VBoxManage --version
WARNING: The character device /dev/vboxdrv does not exist. Please install the virtualbox-dkms package and the appropriate headers, most likely linux-headers-.
You will not be able to start VMs until this problem is fixed.
5.0.40_Ubuntur115130
I tried installing virtualbox-dkms package but no help.
Deleting module version: 5.0.40 completely from the DKMS tree.
Done.
Loading new virtualbox-5.0.40 DKMS files...
dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
dpkg: warning: version '3.10.0-514.16.1.el7.x86_64' has bad syntax: invalid character in revision number
It is likely that 3.10.0-514.16.1.el7.x86_64 belongs to a chroot's host
Building only for *
Building initial module for *
: using /lib/modules/4.4.0-83-generic/build/.config
(I hope this is the correct config for this kernel)
Done.
Error! The directory /lib/modules/* doesn't exist.
You cannot install a module onto a non-existant kernel.
The command '/bin/sh -c dpkg-reconfigure virtualbox-dkms' returned a non-zero code: 6
[root#test-docker vagrant-in-docker]#

capistrano 2 : `tar' could not be found in the path on the local host

I am using Capistrano version 2 and trying to deploy code on server.
but when i enter cap deploy:check command i am getting below error.
* executing "which tar"
servers: ["53.79.454.474"]
[53.79.454.474] executing command
command finished in 1088ms
The following dependencies failed. Please check them and try again:
--> `tar' could not be found in the path on the local host
I also try to install tar on my remote ubuntu machine, but still getting the same error.
sudo apt-get install tar
Reading package lists... Done
Building dependency tree
Reading state information... Done
tar is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I don't know why i am getting this error. please help
Thanks,
This error appears because the machine that holds your repo does not have tar installed (windows). You should have no problems when moving your :repo_url to your production server or any other server with a linux distribution.
** Edit
Before moving the repo, you could try to set the :copy_compression as :zip in your production.rb
if that fails (it might), and you absolutely want/need to stick to microsoft, there will be no way around installing cygwin with tar enabled on the machine your repo lies on and adding cygwin to your PATH variable.
Check this google discussion for more information.

Resources