This is not a home assistant problem, rather a docker problem. I’m new to docker and am hoping someone here could give me a leg up. I’m installing the latest docker on ubuntu server 18.04.5. I have a co2/rh/temp sensor that I read over USB via:
git clone https://github.com/tomvanbraeckel/slab_ht2000.git
On my previous, non-docker install, I just git cloned that source and ran make to create the binary. My home assistant could then call this binary to read the sensor information. Easy peasy.
When I moved to docker, I mounted a file system so that the container could access and execute the same binary. However, some missing file or directory that the binary tries to find when it runs causes a failuer.
Running the command within the docker container:
/home/hass/dev/slab_ht2000/ht2000
bash: /home/hass/dev/slab_ht2000/ht2000: No such file or directory
The error is not that it can’t find the ht2000 binary, it’s that when the binary runs, that error is thrown.
I’ve straced the file activity and compared the output from the failing docker command and the native command that works, but I still can’t find the problem.
The failing strace is:
execve("/usr/bin/docker", ["docker", "exec", "-it", "home-assistant", "/home/hass/dev/slab_ht2000/ht200"...], 0x7fd5bdc2d0 /* 19 vars */) = 0
faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/sys/kernel/mm/transparent_hugepage/hpage_pmd_size", O_RDONLY) = -1 ENOENT (No such file or directory)
readlinkat(AT_FDCWD, "/proc/self/exe", "/usr/bin/docker", 128) = 15
…and it goes on from there for quite a while.
The working non-docker version is:
execve("/home/hass/dev/slab_ht2000/ht2000", ["/home/hass/dev/slab_ht2000/ht200"...], 0x7ff43a0650 /* 19 vars */) = 0
faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
Usage: ht2000 path_to_hidraw_device
Example: ht2000 /dev/hidraw0
Output example: 1470923902, 11-08-2016 15:58:22, 25.700000, 52.700000, 1309.000000
Output columns: epoch timestamp, human readable timestamp, temperature in degrees celsius, relative humidity in percent, CO2 level in PPM
+++ exited with 1 +++
I don’t have an /etc/ld.so.cache in my docker container. Apparently that comes from ldconfig, but I’ve never had to deal with that before.
I have no idea what I need to add to the container to make this work. Does anyone have any suggestions?
Docker compose:
version: '3'
services:
homeassistant:
container_name: home-assistant
image: homeassistant/home-assistant:stable
volumes:
- /home/hass/homeassistant:/config
- /home/hass:/home/hass
- /usr/lib/gcc:/usr/lib/gcc
- /lib/aarch64-linux-gnu:/lib/aarch64-linux-gnu
devices:
- /dev/usb/hiddev0:/dev/usb/hiddev0
- /dev/ttyACM0:/dev/ttyACM0
- /dev/hidraw0:/dev/hidraw0
environment:
- TZ=America/Halifax
restart: always
network_mode: host