E sub process usr bin dpkg returned an error code 1 docker

Im having issues trying to install JRE into my docker container. I keep getting the error message; Processing triggers for libc-bin (2.28-10) ... Processing triggers for systemd (241-7~deb10u1) ...

Im having issues trying to install JRE into my docker container.

I keep getting the error message;

Processing triggers for libc-bin (2.28-10) ...
Processing triggers for systemd (241-7~deb10u1) ...
Processing triggers for ca-certificates (20190110) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.
Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.38.1+dfsg-1) ...
Errors were encountered while processing:
 openjdk-11-jre-headless:amd64
 openjdk-11-jre:amd64
 default-jre
E: Sub-process /usr/bin/dpkg returned an error code (1)

If I scroll up the build output a bit, I also see the following issues;

Setting up default-jre-headless (2:1.11-71) ...
Setting up openjdk-11-jre-headless:amd64 (11.0.4+11-1~deb10u1) ...
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: error: error creating symbolic link '/usr/share/man/man1/rmid.1.gz.dpkg-tmp': No such file or directory
dpkg: error processing package openjdk-11-jre-headless:amd64 (--configure):
 installed openjdk-11-jre-headless:amd64 package post-installation script subprocess returned error exit status 2
dpkg: dependency problems prevent configuration of openjdk-11-jre:amd64:
 openjdk-11-jre:amd64 depends on openjdk-11-jre-headless (= 11.0.4+11-1~deb10u1); however:
  Package openjdk-11-jre-headless:amd64 is not configured yet.

dpkg: error processing package openjdk-11-jre:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of default-jre:
 default-jre depends on openjdk-11-jre; however:
  Package openjdk-11-jre:amd64 is not configured yet.

dpkg: error processing package default-jre (--configure):
 dependency problems - leaving unconfigured
Setting up ca-certificates-java (20190405) ...
head: cannot open '/etc/ssl/certs/java/cacerts' for reading: No such file or directory

My Dockerfile is very simple, but it just wont work

FROM nginx:latest

RUN apt-get update -y && apt-get install -y 
    unzip 
    wget 
    default-jre 
    nginx

It looks to be using debian buster, any help getting this to work would be greatly appreciated. I’ve been trying for days.

Output of docker version:

Client:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.6.2
 Git commit:   b9f10c9
 Built:        Thu, 16 Jun 2016 21:17:51 +1200
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Output of docker info:

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Output of systemctl status docker.service:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled
  Drop-In: /etc/systemd/system/docker.service.d
           └─docker.conf
   Active: failed (Result: exit-code) since Thu 2016-09-01 14:34:00 ICT; 14s ago
     Docs: https://docs.docker.com
  Process: 10581 ExecStart=/usr/bin/dockerd -H fd:// -D --tls=true --tlscert=/var/dock
 Main PID: 10581 (code=exited, status=203/EXEC)

Sep 01 14:34:00 ubuntu systemd[1]: Starting Docker Application Container Engine...
Sep 01 14:34:00 ubuntu systemd[1]: docker.service: Main process exited, code=exited, s
Sep 01 14:34:00 ubuntu systemd[1]: Failed to start Docker Application Container Engine
Sep 01 14:34:00 ubuntu systemd[1]: docker.service: Unit entered failed state.
Sep 01 14:34:00 ubuntu systemd[1]: docker.service: Failed with result 'exit-code'.

Output of systemctl status journalctl -xe:

Sep 01 14:33:44 ubuntu audit: CWD cwd="/var/lib/docker"
Sep 01 14:33:44 ubuntu audit: PATH item=0 name="/usr/bin/docker" inode=17303833 dev=fc
Sep 01 14:33:44 ubuntu audit: PATH item=1 name="/lib64/ld-linux-x86-64.so.2" inode=175
Sep 01 14:33:44 ubuntu audit: PROCTITLE proctitle=646F636B6572007073
Sep 01 14:33:49 ubuntu audit[10520]: SYSCALL arch=c000003e syscall=59 success=yes exit
Sep 01 14:33:49 ubuntu audit: EXECVE argc=2 a0="docker" a1="images"
Sep 01 14:33:49 ubuntu audit: CWD cwd="/var/lib/docker"
Sep 01 14:33:49 ubuntu audit: PATH item=0 name="/usr/bin/docker" inode=17303833 dev=fc
Sep 01 14:33:49 ubuntu audit: PATH item=1 name="/lib64/ld-linux-x86-64.so.2" inode=175
Sep 01 14:33:49 ubuntu audit: PROCTITLE proctitle=646F636B657200696D61676573
Sep 01 14:34:00 ubuntu systemd[1]: Starting Docker Socket for the API.
-- Subject: Unit docker.socket has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has begun starting up.
Sep 01 14:34:00 ubuntu systemd[1]: Listening on Docker Socket for the API.
-- Subject: Unit docker.socket has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has finished starting up.
-- 
-- The start-up result is done.
Sep 01 14:34:00 ubuntu systemd[1]: Starting Docker Application Container Engine...
-- Subject: Unit docker.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has begun starting up.
Sep 01 14:34:00 ubuntu systemd[10581]: docker.service: Failed at step EXEC spawning /u
-- Subject: Process /usr/bin/dockerd could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The process /usr/bin/dockerd could not be executed and failed.
-- 
-- The error number returned by this process is 2.
Sep 01 14:34:00 ubuntu systemd[1]: docker.service: Main process exited, code=exited, s
Sep 01 14:34:00 ubuntu systemd[1]: Failed to start Docker Application Container Engine
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has failed.
-- 
-- The result is failed.
Sep 01 14:34:00 ubuntu audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967
Sep 01 14:34:00 ubuntu systemd[1]: docker.service: Unit entered failed state.
Sep 01 14:34:00 ubuntu systemd[1]: docker.service: Failed with result 'exit-code'.

Output of uname -a:

ot@ubuntu:/var/lib/docker# uname -a
Linux ubuntu 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Additional environment details (AWS, VirtualBox, physical, etc.):

Steps to reproduce the issue:

  1. apt-get install docker.io
Errors were encountered while processing:
 docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)
  1. docker ps -a
An error occurred trying to connect: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.23/containers/json: read unix @->/var/run/docker.sock: read: connection reset by peer

Additional information you deem important (e.g. issue happens only occasionally):

Если вы столкнулись с ошибкой  с «sub process usr bin dpkg returned an error code 1» при установке программного обеспечения на Ubuntu Linux, вот как вы можете это исправить.

Одной из распространенных проблем в Ubuntu и других дистрибутивах на основе Debian являются ломанные пакеты.

Вы пытаетесь обновить систему или установить новый пакет, и столкиваеиесь с такой ошибкой, как «Sub-process /usr/bin/dpkg returned an error code 1.

Вот что случилось на днях.

Я пытался установить радио приложение на Ubuntu, и система вернула мне эту ошибку:

Unpacking python-gst-1.0 (1.6.2-1build1) ...
Selecting previously unselected package radiotray.
Preparing to unpack .../radiotray_0.7.3-5ubuntu1_all.deb ...
Unpacking radiotray (0.7.3-5ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up polar-bookshelf (1.0.0-beta56) ...
ln: failed to create symbolic link '/usr/local/bin/polar-bookshelf': No such file or directory
dpkg: error processing package polar-bookshelf (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-appindicator (12.10.1+16.04.20170215-0ubuntu1) ...
Setting up python-gst-1.0 (1.6.2-1build1) ...
Setting up radiotray (0.7.3-5ubuntu1) ...
Errors were encountered while processing:
polar-bookshelf
E: Sub-process /usr/bin/dpkg returned an error code (1)

Здесь важны последние три строки:

Errors were encountered while processing:
polar-bookshelf
E: Sub-process /usr/bin/dpkg returned an error code (1)

Это говорит мне, что пакет полярнаяpolar-bookshelf является причиной. Это может иметь решающее значение для устранения этой ошибки.

Решение проблемы Sub-process /usr/bin/dpkg returned an error code (1)

Попробуем исправить этот сломанный пакет.

Я покажу вам несколько методов, которые вы можете попробовать по одному.

Они простые в использовании и просто без проблем осуществимы.

Вы должны попытаться запустить sudo apt update, а затем попытаться установить новый пакет или обновиться после каждого из описанных здесь методов.

Способ 1: переконфигурировать базу данных пакетов

Первый метод, который вы можете попробовать, – перенастроить базу данных пакетов.

Вероятно, база данных повреждена при установке пакета.

Реконфигурация часто устраняет проблему.

sudo dpkg --configure -a

Способ 2: Использовать принудительную установку

Если установка ранее прервалась, вы можете попробовать установить пакет принудительно:

sudo apt-get install -f

Способ 3. Попробуйте удалить проблемный пакет.

sudo apt remove 

Способ 4. Удалите информационные файлы с информацией о проблемном пакете

Это должно быть вашим последним прибежищем.

Вы можете попробовать удалить файлы, связанные с пакетом, из /var/lib/dpkg/info.

Вам нужно немного узнать о базовых командах Linux, чтобы выяснить, что происходит, и как использовать их с вашей проблемой.

В моем случае у меня была проблема с polar-bookhelof.

Поэтому я искал файлы, связанные с ним:

ls -l /var/lib/dpkg/info | grep -i polar-bookshelf
-rw-r--r-- 1 root root 2324811 Aug 14 19:29 polar-bookshelf.list
-rw-r--r-- 1 root root 2822824 Aug 10 04:28 polar-bookshelf.md5sums
-rwxr-xr-x 1 root root     113 Aug 10 04:28 polar-bookshelf.postinst
-rwxr-xr-x 1 root root      84 Aug 10 04:28 polar-bookshelf.postrm

Теперь мне нужно удалить эти файлы:

sudo mv /var/lib/dpkg/info/polar-bookshelf.* /tmp

I had a similar issue. After Ubuntu upgrade from 18.04.4 to 20.04.2 docker would not start, and errored when trying to install, remove, purge, repair it. (VPN is outside of my control).

$ sudo apt-get purge -y docker-ce
...
1 not fully installed or removed.
...
Removing docker-ce (5:20.10.4~3-0~ubuntu-bionic) ...
Job for docker.service canceled.
invoke-rc.d: initscript docker, action "stop" failed.
dpkg: error processing package docker-ce (--remove):
 installed docker-ce package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
dpkg: error while cleaning up:
 installed docker-ce package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 docker-ce
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

I had both docker.io from Debian/Ubuntu and docker-ce from docker.com installed. This post discusses the differences.

dpkg -l | grep -i docker

Looks for me it was choking on containerd which would not start. You can check messages in /var/log/syslog

Removing folders, uninstalling all docker packages and reinstalling docker.io worked.

NOTE: I did not care about previous images or containers, if you do then this might NOT work for you.

$ sudo rm -rf /var/lib/containerd/
$ sudo rm -rf /var/lib/docker/
$ sudo apt-get purge -y docker-ce docker-ce-cli docker.io containerd.io
$ sudo apt-get install docker.io

That message is generic. It just means that the dpkg instance called by apt/apt-get failed for some reason. It doesn’t explain why, how, or give hints how to solve it. As a diagnostic message, it is not useful.

You need to read the lines before the message (sometimes quite a number of them) to find the real error that prevents you from completing the installation.

Yeah, but how do I solve it?

There is no single way to solve it. There are so many reasons why this can happen that it’s futile to attempt to list them all in a single post. Each and every circumstance is almost unique to that package/environment.

But, there’s redemption. The fact that you see this message means that probably there is more relevant information in the lines before the message. For illustrative purposes I will use a example:

(Reading database ... 81657 files and directories currently installed.)
 Removing mongodb-10gen ...
 arg: remove
 invoke-rc.d: unknown initscript, /etc/init.d/mongodb not found.
 dpkg: error processing mongodb-10gen (--remove):
  subprocess installed pre-removal script returned error exit status 100
 invoke-rc.d: unknown initscript, /etc/init.d/mongodb not found.
 dpkg: error while cleaning up:
  subprocess installed post-installation script returned error exit status 100
 Errors were encountered while processing:
  mongodb-10gen
 E: Sub-process /usr/bin/dpkg returned an error code (1)

Now, to find the problem, you need to read backwards:

  • E: Sub-process /usr/bin/dpkg returned an error code (1) doesn’t tell me anything useful. So moving on.

  • Errors were encountered while processing: mongodb-10gen just tells me what package have problems. Is useful but not enough.

  • subprocess installed post-installation script returned error exit status 100: this tells me that the script that failed was the postinst, the one executed in post-installation. This will come handy in some situations, but not in this one.

  • dpkg: error while cleaning up: nothing useful here.

  • invoke-rc.d: unknown initscript, /etc/init.d/mongodb not found. BINGO! This tells us that invoke-rc.d, a binary that controls the init script in most Debian-like system, failed. It failed because it couldn’t find the /etc/init.d/mongodb script. This is bad. We need to create it or copy from somewhere else so it starts working again. Reinstalling the package is also normally an option for file not found errors.

    In this case, reporting a bug is not necessary because is probable that we were the ones that removed the script, but if you are completely sure you didn’t touch the file (a debsums -sla should confirm it) then report a bug.

So, what exactly do you need to get help? Ideally, the complete output of the problem. It’s also helpful to include the output of sudo dpkg -C and sudo apt-get check, and the output of apt-cache policy package1 package2... where «package1 package2 …» includes all the packages with problems.

My goal is to get a docker container running with nordvpn installed and connected.

Get docker container going

sudo docker pull ubuntu:latest
sudo docker run -it ubuntu bash
// now im in the docker container
apt install update
apt install wget
wget {{nordvpn_link.deb}}
dpkg -i {{nordvpn_link.deb}}
// some errors about dependencies after above command so ...
apt install -f
// then
apt install nordvpn

First big error

root@f706a3f4012f:/home# apt install nordvpn
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nordvpn is already the newest version (3.6.0-2).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Setting up nordvpn (3.6.0-2) ...
[ERROR] Unknown environment `bash'
dpkg: error processing package nordvpn (--configure):
installed nordvpn package post-installation script subprocess returned error exit status 255
Errors were encountered while processing:
nordvpn
E: Sub-process /usr/bin/dpkg returned an error code (1)

I read here to run the following command

dpkg --configure -a
// errors
Setting up nordvpn (3.6.0-2) ...
[ERROR] Unknown environment `bash'
dpkg: error processing package nordvpn (--configure):
installed nordvpn package post-installation script subprocess returned error exit status 255
Errors were encountered while processing:
nordvpn

I am not sure as to why this is happening with the docker container as the process went smoothly on my regular ubuntu desktop installation.

Понравилась статья? Поделить с друзьями:

Читайте также:

  • E recv error on uevent 4pda
  • E recovery windowsre winre wim system32 logfiles srt srttrail txt ошибка
  • E okved 1080 фсс ошибка как исправить
  • E oc2 ошибка чп митсубиси
  • E oc1 ошибка частотника

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии