openhab / openhab-docker

Repository for building Docker containers for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
209 stars 128 forks source link

Can't install anything in the image #377

Closed sylvainar closed 2 years ago

sylvainar commented 2 years ago

Summary

Hi there!

I wanted to be able to run some SSH commands from openhab, so I tried to install an SSH client in the image. I tried two different methods, by rebuilding a docker image over the existing one, and by adding a script in the cont-init.d folder.

Dockerfile:

FROM "openhab/openhab:3.2.0"

RUN apt-get clean && apt-get update --allow-insecure-repositories && apt-get install -y --allow-unauthenticated openssh-client

install.sh:

#!/bin/bash -ex
whoami

mkdir -p /tmp && apt-get clean && apt-get update --allow-insecure-repositories && apt-get install -y --allow-unauthenticated apt-utils openssh-client

and they both arrive to the same error:

openhab    | ++ whoami
openhab    | root
openhab    | ++ mkdir -p /tmp
openhab    | ++ apt-get clean
openhab    | ++ apt-get update --allow-insecure-repositories
openhab    | Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
openhab    | Get:2 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
openhab    | Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
openhab    | Ign:2 http://security.debian.org/debian-security bullseye-security InRelease
openhab    | Ign:1 http://deb.debian.org/debian bullseye InRelease
openhab    | Ign:3 http://deb.debian.org/debian bullseye-updates InRelease
openhab    | Fetched 199 kB in 1s (173 kB/s)
openhab    | Reading package lists...
openhab    | W: GPG error: http://security.debian.org/debian-security bullseye-security InRelease: At least one invalid signature was encountered.
openhab    | W: The repository 'http://security.debian.org/debian-security bullseye-security InRelease' is not signed.
openhab    | W: GPG error: http://deb.debian.org/debian bullseye InRelease: At least one invalid signature was encountered.
openhab    | W: The repository 'http://deb.debian.org/debian bullseye InRelease' is not signed.
openhab    | W: GPG error: http://deb.debian.org/debian bullseye-updates InRelease: At least one invalid signature was encountered.
openhab    | W: The repository 'http://deb.debian.org/debian bullseye-updates InRelease' is not signed.
openhab    | ++ apt-get install -y --allow-unauthenticated apt-utils openssh-client
openhab    | Reading package lists...
openhab    | Building dependency tree...
openhab    | Reading state information...
popenhab    | The following additional packages will be installed:
openhab    |   libbsd0 libcbor0 libedit2 libfido2-1 libmd0 libx11-6 libx11-data libxau6
openhab    |   libxcb1 libxdmcp6 libxext6 libxmuu1 xauth
openhab    | Suggested packages:
openhab    |   keychain libpam-ssh monkeysphere ssh-askpass
openhab    | The following NEW packages will be installed:
openhab    |   apt-utils libbsd0 libcbor0 libedit2 libfido2-1 libmd0 libx11-6 libx11-data
openhab    |   libxau6 libxcb1 libxdmcp6 libxext6 libxmuu1 openssh-client xauth
openhab    | 0 upgraded, 15 newly installed, 0 to remove and 3 not upgraded.
openhab    | Need to get 2,858 kB of archives.
openhab    | After this operation, 8,355 kB of additional disk space will be used.
openhab    | WARNING: The following packages cannot be authenticated!
openhab    |   apt-utils libmd0 libbsd0 libedit2 libcbor0 libfido2-1 openssh-client libxau6
openhab    |   libxdmcp6 libxcb1 libx11-data libx11-6 libxext6 libxmuu1 xauth
openhab    | Authentication warning overridden.
openhab    | Get:1 http://deb.debian.org/debian bullseye/main armhf apt-utils armhf 2.2.4 [424 kB]
openhab    | Get:2 http://deb.debian.org/debian bullseye/main armhf libmd0 armhf 1.0.3-3 [27.4 kB]
openhab    | Get:3 http://deb.debian.org/debian bullseye/main armhf libbsd0 armhf 0.11.3-1 [103 kB]
openhab    | Get:4 http://deb.debian.org/debian bullseye/main armhf libedit2 armhf 3.1-20191231-2+b1 [81.1 kB]
openhab    | Get:5 http://deb.debian.org/debian bullseye/main armhf libcbor0 armhf 0.5.0+dfsg-2 [19.6 kB]
openhab    | Get:6 http://deb.debian.org/debian bullseye/main armhf libfido2-1 armhf 1.6.0-2 [48.0 kB]
openhab    | Get:7 http://deb.debian.org/debian bullseye/main armhf openssh-client armhf 1:8.4p1-5 [842 kB]
openhab    | Get:8 http://deb.debian.org/debian bullseye/main armhf libxau6 armhf 1:1.0.9-1 [19.0 kB]
openhab    | Get:9 http://deb.debian.org/debian bullseye/main armhf libxdmcp6 armhf 1:1.1.2-3 [24.9 kB]
openhab    | Get:10 http://deb.debian.org/debian bullseye/main armhf libxcb1 armhf 1.14-3 [136 kB]
openhab    | Get:11 http://deb.debian.org/debian bullseye/main armhf libx11-data all 2:1.7.2-1 [311 kB]
openhab    | Get:12 http://deb.debian.org/debian bullseye/main armhf libx11-6 armhf 2:1.7.2-1 [713 kB]
openhab    | Get:13 http://deb.debian.org/debian bullseye/main armhf libxext6 armhf 2:1.3.3-1.1 [47.8 kB]
openhab    | Get:14 http://deb.debian.org/debian bullseye/main armhf libxmuu1 armhf 2:1.1.2-2+b3 [23.3 kB]
openhab    | Get:15 http://deb.debian.org/debian bullseye/main armhf xauth armhf 1:1.1-1 [37.7 kB]
openhab    | debconf: delaying package configuration, since apt-utils is not installed
openhab    | Fetched 2,858 kB in 1s (2,568 kB/s)
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/00-apt-utils_2.2.4_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: ./shlibs: Cannot utime: Operation not permitted
openhab    | tar: ./symbols: Cannot utime: Operation not permitted
openhab    | tar: ./triggers: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/01-libmd0_1.0.3-3_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: ./shlibs: Cannot utime: Operation not permitted
openhab    | tar: ./symbols: Cannot utime: Operation not permitted
openhab    | tar: ./triggers: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/02-libbsd0_0.11.3-1_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: ./shlibs: Cannot utime: Operation not permitted
openhab    | tar: ./symbols: Cannot utime: Operation not permitted
openhab    | tar: ./triggers: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/03-libedit2_3.1-20191231-2+b1_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: ./shlibs: Cannot utime: Operation not permitted
openhab    | tar: ./symbols: Cannot utime: Operation not permitted
openhab    | tar: ./triggers: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/04-libcbor0_0.5.0+dfsg-2_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: ./shlibs: Cannot utime: Operation not permitted
openhab    | tar: ./symbols: Cannot utime: Operation not permitted
openhab    | tar: ./triggers: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/05-libfido2-1_1.6.0-2_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./conffiles: Cannot utime: Operation not permitted
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: ./postinst: Cannot utime: Operation not permitted
openhab    | tar: ./postrm: Cannot utime: Operation not permitted
openhab    | tar: ./preinst: Cannot utime: Operation not permitted
openhab    | tar: ./prerm: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/06-openssh-client_1%3a8.4p1-5_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: ./shlibs: Cannot utime: Operation not permitted
openhab    | tar: ./triggers: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/07-libxau6_1%3a1.0.9-1_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: ./shlibs: Cannot utime: Operation not permitted
openhab    | tar: ./triggers: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/08-libxdmcp6_1%3a1.1.2-3_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: ./shlibs: Cannot utime: Operation not permitted
openhab    | tar: ./symbols: Cannot utime: Operation not permitted
openhab    | tar: ./triggers: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/09-libxcb1_1.14-3_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/10-libx11-data_2%3a1.7.2-1_all.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: ./shlibs: Cannot utime: Operation not permitted
openhab    | tar: ./symbols: Cannot utime: Operation not permitted
openhab    | tar: ./triggers: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/11-libx11-6_2%3a1.7.2-1_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: ./shlibs: Cannot utime: Operation not permitted
openhab    | tar: ./symbols: Cannot utime: Operation not permitted
openhab    | tar: ./triggers: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/12-libxext6_2%3a1.3.3-1.1_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: ./shlibs: Cannot utime: Operation not permitted
openhab    | tar: ./triggers: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/13-libxmuu1_2%3a1.1.2-2+b3_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | tar: ./control: Cannot utime: Operation not permitted
openhab    | tar: ./md5sums: Cannot utime: Operation not permitted
openhab    | tar: .: Cannot utime: Operation not permitted
openhab    | tar: Exiting with failure status due to previous errors
openhab    | dpkg-deb: error: tar subprocess returned error exit status 2
openhab    | dpkg: error processing archive /tmp/apt-dpkg-install-dSfgrD/14-xauth_1%3a1.1-1_armhf.deb (--unpack):
openhab    |  dpkg-deb --control subprocess returned error exit status 2
openhab    | Errors were encountered while processing:
openhab    |  /tmp/apt-dpkg-install-dSfgrD/00-apt-utils_2.2.4_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/01-libmd0_1.0.3-3_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/02-libbsd0_0.11.3-1_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/03-libedit2_3.1-20191231-2+b1_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/04-libcbor0_0.5.0+dfsg-2_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/05-libfido2-1_1.6.0-2_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/06-openssh-client_1%3a8.4p1-5_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/07-libxau6_1%3a1.0.9-1_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/08-libxdmcp6_1%3a1.1.2-3_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/09-libxcb1_1.14-3_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/10-libx11-data_2%3a1.7.2-1_all.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/11-libx11-6_2%3a1.7.2-1_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/12-libxext6_2%3a1.3.3-1.1_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/13-libxmuu1_2%3a1.1.2-2+b3_armhf.deb
openhab    |  /tmp/apt-dpkg-install-dSfgrD/14-xauth_1%3a1.1-1_armhf.deb
openhab    | E: Sub-process /usr/bin/dpkg returned an error code (1)

Also I was obliged to use some insecure flags to access the package repositories but it's already tracked in #373

Possible Solution

I don't have any idea here.

Your Environment

I'm using an Rpi 3B+ and Docker 20.10.8

Image

Docker Host

Configuration

Relevant part of my docker-compose.yml:

openhab:
    container_name: openhab
    image: openhab/openhab:3.2.0 
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      - /opt/openhab/conf:/openhab/conf
      - /opt/openhab/userdata:/openhab/userdata
      - /opt/openhab/addons:/openhab/addons
      - /opt/openhab/cont-init.d:/etc/cont-init.d
      - /home/openhab/.ssh:/root/.ssh
    devices:  
      - /dev/ttyUSB0:/dev/ttyUSB0
    restart: always
    network_mode: host
    environment:
      - USER_ID=999
      - GROUP_ID=994
      - CRYPTO_POLICY=unlimited
wborn commented 2 years ago

Duplicates #373