CausticLab / hass-configurator-docker

Linux x32/64 and ARM builds for the hass-configurator
67 stars 15 forks source link

0.4.1 not working on RaspberryPi 4 #42

Open ScratMan opened 2 years ago

ScratMan commented 2 years ago

Hello, when trying to update my hass-configurator-docker running on my Raspberry pi 4 using causticlab/hass-configurator-docker:latest it fails to start. I need to use the causticlab/hass-configurator-docker:arm tag to keep it working, but it's 0.4.0.

Why ? Isn't the Pi 4 Armv7 ?

The log shows this continuously

No configuration file found proceeding with default values,
Fatal Python error: init_interp_main: can't initialize time,
PermissionError: [Errno 1] Operation not permitted,
Python runtime state: core initialized,
Current thread 0xb6f8f390 (most recent call first):,
<no Python frame>

The inspect of the container when failing:

{
    "AppArmorProfile": "",
    "Args": [],
    "Config": {
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": null,
        "Domainname": "",
        "Entrypoint": [
            "/app/run.sh"
        ],
        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LANG=C.UTF-8",
            "GPG_KEY=E3FF2839C048B25C084DEBE9B26995E310250568",
            "PYTHON_VERSION=3.9.5",
            "PYTHON_PIP_VERSION=21.1.1",
            "PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/1954f15b3f102ace496a34a013ea76b061535bd2/public/get-pip.py",
            "PYTHON_GET_PIP_SHA256=f499d76e0149a673fb8246d88e116db589afbd291739bd84f2cd9a7bca7b6993"
        ],
        "ExposedPorts": {
            "3218/tcp": {}
        },
        "Hostname": "309990fc0eec",
        "Image": "causticlab/hass-configurator-docker:latest",
        "Labels": {
            "com.docker.compose.config-hash": "aafb07caf0db97cae44f1c47eef0831b7dcd1e368cb45a1761f4e3ace58c6b6d",
            "com.docker.compose.container-number": "1",
            "com.docker.compose.oneoff": "False",
            "com.docker.compose.project": "hass-configurator",
            "com.docker.compose.project.config_files": "docker-compose.yml",
            "com.docker.compose.project.working_dir": "/home/homeassistant/docker/compose-files/hass-configurator",
            "com.docker.compose.service": "hass-configurator",
            "com.docker.compose.version": "1.29.1",
            "maintainer": "Martin <Munsio> Treml"
        },
        "OnBuild": null,
        "OpenStdin": false,
        "StdinOnce": false,
        "Tty": false,
        "User": "",
        "Volumes": {
            "/config": {},
            "/hass-config": {}
        },
        "WorkingDir": "/app"
    },
    "Created": "2021-12-03T21:40:29.736189176Z",
    "Driver": "overlay2",
    "ExecIDs": null,
    "GraphDriver": {
        "Data": {
            "LowerDir": "/home/docker/overlay2/c14e3a22f2e8cd4e4800ca2e0dfa7f6a53ee01237b0ecf102477f19db9969d82-init/diff:/home/docker/overlay2/8ca1d30b1c0f019051758884b3c0aa454b5ddfe27e9b7b3ef7b8985d9ea9ffae/diff:/home/docker/overlay2/bc925949c4f5c8bcfabd685f07c52fda7b9c222b1f9f43f57a78ad86283bd499/diff:/home/docker/overlay2/2c3d19d057bc9a9545b4d104da4ae39421cb43a1274a91c0a63b93c0221fa82e/diff:/home/docker/overlay2/f4e4ce1b30a601fa607966839dd86aeac8d754b910d7c5bc6163688e8801bae0/diff:/home/docker/overlay2/8d3d7b9a864d504c6bcf593bedba525ce77a1ac1d75774f3aceca4eeffceda8b/diff:/home/docker/overlay2/4beaaff52f774e52b9266102d68b6e148720e51cb6afe316fd23bf7ba20bd503/diff:/home/docker/overlay2/94ecd8a9ac06039369b24f3a5c8abbddab449f391aad5ce871ced1cb604f747e/diff:/home/docker/overlay2/b3a2c590482361d0553be7aeda5cd2ac1b153d0d9943f8202215c0eb1057ecf2/diff:/home/docker/overlay2/6769db37cb984e42ae4a7e4263b64640d420e36e9916aa2ff096929bffe847ac/diff",
            "MergedDir": "/home/docker/overlay2/c14e3a22f2e8cd4e4800ca2e0dfa7f6a53ee01237b0ecf102477f19db9969d82/merged",
            "UpperDir": "/home/docker/overlay2/c14e3a22f2e8cd4e4800ca2e0dfa7f6a53ee01237b0ecf102477f19db9969d82/diff",
            "WorkDir": "/home/docker/overlay2/c14e3a22f2e8cd4e4800ca2e0dfa7f6a53ee01237b0ecf102477f19db9969d82/work"
        },
        "Name": "overlay2"
    },
    "HostConfig": {
        "AutoRemove": false,
        "Binds": [
            "/home/homeassistant/docker/hass-configurator/configurator-config:/config",
            "/home/homeassistant/.homeassistant:/hass-config"
        ],
        "BlkioDeviceReadBps": null,
        "BlkioDeviceReadIOps": null,
        "BlkioDeviceWriteBps": null,
        "BlkioDeviceWriteIOps": null,
        "BlkioWeight": 0,
        "BlkioWeightDevice": null,
        "CapAdd": [
            "AUDIT_WRITE",
            "CHOWN",
            "DAC_OVERRIDE",
            "FOWNER",
            "FSETID",
            "KILL",
            "MKNOD",
            "NET_BIND_SERVICE",
            "NET_RAW",
            "SETFCAP",
            "SETGID",
            "SETPCAP",
            "SETUID",
            "SYS_CHROOT"
        ],
        "CapDrop": [
            "AUDIT_CONTROL",
            "BLOCK_SUSPEND",
            "DAC_READ_SEARCH",
            "IPC_LOCK",
            "IPC_OWNER",
            "LEASE",
            "LINUX_IMMUTABLE",
            "MAC_ADMIN",
            "MAC_OVERRIDE",
            "NET_ADMIN",
            "NET_BROADCAST",
            "SYSLOG",
            "SYS_ADMIN",
            "SYS_BOOT",
            "SYS_MODULE",
            "SYS_NICE",
            "SYS_PACCT",
            "SYS_PTRACE",
            "SYS_RAWIO",
            "SYS_RESOURCE",
            "SYS_TIME",
            "SYS_TTY_CONFIG",
            "WAKE_ALARM"
        ],
        "Cgroup": "",
        "CgroupParent": "",
        "CgroupnsMode": "host",
        "ConsoleSize": [
            0,
            0
        ],
        "ContainerIDFile": "",
        "CpuCount": 0,
        "CpuPercent": 0,
        "CpuPeriod": 0,
        "CpuQuota": 0,
        "CpuRealtimePeriod": 0,
        "CpuRealtimeRuntime": 0,
        "CpuShares": 0,
        "CpusetCpus": "",
        "CpusetMems": "",
        "DeviceCgroupRules": null,
        "DeviceRequests": null,
        "Devices": [],
        "Dns": [],
        "DnsOptions": [],
        "DnsSearch": [],
        "ExtraHosts": [],
        "GroupAdd": null,
        "IOMaximumBandwidth": 0,
        "IOMaximumIOps": 0,
        "IpcMode": "private",
        "Isolation": "",
        "KernelMemory": 0,
        "KernelMemoryTCP": 0,
        "Links": null,
        "LogConfig": {
            "Config": {},
            "Type": "json-file"
        },
        "MaskedPaths": [
            "/proc/asound",
            "/proc/acpi",
            "/proc/kcore",
            "/proc/keys",
            "/proc/latency_stats",
            "/proc/timer_list",
            "/proc/timer_stats",
            "/proc/sched_debug",
            "/proc/scsi",
            "/sys/firmware"
        ],
        "Memory": 0,
        "MemoryReservation": 0,
        "MemorySwap": 0,
        "MemorySwappiness": null,
        "NanoCpus": 0,
        "NetworkMode": "hass-configurator_default",
        "OomKillDisable": null,
        "OomScoreAdj": 0,
        "PidMode": "",
        "PidsLimit": null,
        "PortBindings": {
            "3218/tcp": [
                {
                    "HostIp": "",
                    "HostPort": "3218"
                }
            ]
        },
        "Privileged": false,
        "PublishAllPorts": false,
        "ReadonlyPaths": [
            "/proc/bus",
            "/proc/fs",
            "/proc/irq",
            "/proc/sys",
            "/proc/sysrq-trigger"
        ],
        "ReadonlyRootfs": false,
        "RestartPolicy": {
            "MaximumRetryCount": 0,
            "Name": "always"
        },
        "Runtime": "runc",
        "SecurityOpt": null,
        "ShmSize": 67108864,
        "UTSMode": "",
        "Ulimits": null,
        "UsernsMode": "",
        "VolumeDriver": "",
        "VolumesFrom": []
    },
    "HostnamePath": "/home/docker/containers/1c91babb4dea010d1e3066a9ebca8129edd46122590151d01c22a6a844c736d2/hostname",
    "HostsPath": "/home/docker/containers/1c91babb4dea010d1e3066a9ebca8129edd46122590151d01c22a6a844c736d2/hosts",
    "Id": "1c91babb4dea010d1e3066a9ebca8129edd46122590151d01c22a6a844c736d2",
    "Image": "sha256:b3c4307f8b81d9806540ca2dd4998f7b72753417dd814d8ad095b36386f96362",
    "LogPath": "/home/docker/containers/1c91babb4dea010d1e3066a9ebca8129edd46122590151d01c22a6a844c736d2/1c91babb4dea010d1e3066a9ebca8129edd46122590151d01c22a6a844c736d2-json.log",
    "MountLabel": "",
    "Mounts": [
        {
            "Destination": "/hass-config",
            "Mode": "",
            "Propagation": "rprivate",
            "RW": true,
            "Source": "/home/homeassistant/.homeassistant",
            "Type": "bind"
        },
        {
            "Destination": "/config",
            "Mode": "",
            "Propagation": "rprivate",
            "RW": true,
            "Source": "/home/homeassistant/docker/hass-configurator/configurator-config",
            "Type": "bind"
        }
    ],
    "Name": "/hass-configurator",
    "NetworkSettings": {
        "Bridge": "",
        "EndpointID": "",
        "Gateway": "",
        "GlobalIPv6Address": "",
        "GlobalIPv6PrefixLen": 0,
        "HairpinMode": false,
        "IPAddress": "",
        "IPPrefixLen": 0,
        "IPv6Gateway": "",
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "MacAddress": "",
        "Networks": {
            "hass-configurator_default": {
                "Aliases": [
                    "hass-configurator",
                    "309990fc0eec",
                    "1c91babb4dea"
                ],
                "DriverOpts": null,
                "EndpointID": "",
                "Gateway": "",
                "GlobalIPv6Address": "",
                "GlobalIPv6PrefixLen": 0,
                "IPAMConfig": {},
                "IPAddress": "",
                "IPPrefixLen": 0,
                "IPv6Gateway": "",
                "Links": null,
                "MacAddress": "",
                "NetworkID": "22a8c6a785b41058959b11c8f03d16911361fe18254cca4bc6d79105c2663e3d"
            }
        },
        "Ports": {},
        "SandboxID": "f053cb2db2cbf4aa8a32b8a9c9dd676e06aa0b6d674c5b9234133f7f16c96c1e",
        "SandboxKey": "/var/run/docker/netns/f053cb2db2cb",
        "SecondaryIPAddresses": null,
        "SecondaryIPv6Addresses": null
    },
    "Path": "/app/run.sh",
    "Platform": "linux",
    "Portainer": {
        "ResourceControl": {
            "Id": 102,
            "ResourceId": "1c91babb4dea010d1e3066a9ebca8129edd46122590151d01c22a6a844c736d2",
            "SubResourceIds": [],
            "Type": 1,
            "UserAccesses": [],
            "TeamAccesses": [],
            "Public": false,
            "AdministratorsOnly": true,
            "System": false
        }
    },
    "ProcessLabel": "",
    "ResolvConfPath": "/home/docker/containers/1c91babb4dea010d1e3066a9ebca8129edd46122590151d01c22a6a844c736d2/resolv.conf",
    "RestartCount": 14,
    "State": {
        "Dead": false,
        "Error": "",
        "ExitCode": 1,
        "FinishedAt": "2021-12-03T21:49:02.94467672Z",
        "OOMKilled": false,
        "Paused": false,
        "Pid": 0,
        "Restarting": true,
        "Running": true,
        "StartedAt": "2021-12-03T21:49:02.890633579Z",
        "Status": "restarting"
    }
}
Munsio commented 2 years ago

I there and thanks for reaching out!

I am currently pretty occupied with some other stuff and I do not have a Pi4 on Hand right now. But that shouldn't stop us from resolving the issue you are facing if you are willing to do some sort of pair debugging ;)

I will take a look into the posted logs and configs later that day but in the mean time what you could try is cloning the repo and trying to build it yourself like described in https://github.com/CausticLab/hass-configurator-docker#build-locally

Maybe it is because the last version is already a little bit old from the base image it is created. If building locally and running it work we may get away on this with a simple rebuild of all the images with the latest base image versions.

Oh and be sure to build it on the Pi4 itself.

ScratMan commented 2 years ago

Hi, thanks for the support. I managed to use the command to build changing the . with Dockerfile, but had some errors :

/home/docker/git_repos/hass-configurator-docker# docker build -f Dockerfile --build-arg HC_BUILD_VERSION=0.4.1 . -t hass-configurator-docker-local:0.4.1 --no-cache
Sending build context to Docker daemon  100.4kB
Step 1/10 : FROM python:3.9-alpine
3.9-alpine: Pulling from library/python
5480d2ca1740: Pull complete
d234b707fd03: Pull complete
503bbf7f1800: Pull complete
2d180caa33d8: Pull complete
5d39cf3c8efd: Pull complete
Digest: sha256:091e589aa641a59b10cc764bfc959a91b70003643f2aac91fd4fc0353f09dddf
Status: Downloaded newer image for python:3.9-alpine
 ---> 897efba2fbc7
Step 2/10 : LABEL maintainer="Martin <Munsio> Treml"
 ---> Running in 6795beb6a71c
Removing intermediate container 6795beb6a71c
 ---> 2b6a3b9ba405
Step 3/10 : WORKDIR /app
 ---> Running in 4db8b247e697
Removing intermediate container 4db8b247e697
 ---> f980ca0974ac
Step 4/10 : ARG HC_BUILD_VERSION
 ---> Running in 27cc40d13d42
Removing intermediate container 27cc40d13d42
 ---> 904fc706ae56
Step 5/10 : RUN apk update &&     apk upgrade &&     apk add --no-cache bash git openssh &&     pip install --no-cache-dir hass-configurator==${HC_BUILD_VERSION} gitpython pyotp
 ---> Running in 8cd825c1d670
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/armv7/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/armv7/APKINDEX.tar.gz
ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.15/main: temporary error (try again later)
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/main: No such file or directory
ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.15/community: temporary error (try again later)
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/community: No such file or directory
2 errors; 37 distinct packages available
The command '/bin/sh -c apk update &&     apk upgrade &&     apk add --no-cache bash git openssh &&     pip install --no-cache-dir hass-configurator==${HC_BUILD_VERSION} gitpython pyotp' returned a non-zero code: 2

When using the built image, I get the same errors

Fatal Python error: init_interp_main: can't initialize time,
Python runtime state: core initialized,
PermissionError: [Errno 1] Operation not permitted,
Current thread 0xb6f23390 (most recent call first):,
<no Python frame>
Munsio commented 2 years ago

Hmm the Fetching error does not seem right. Maybe we need to update the image anyway. I hope to get some spare time today evening than I will take a look into it.

Munsio commented 2 years ago

Okay i dug a little deeper and it seems that you are not the only one having this error. https://github.com/alpinelinux/docker-alpine/issues/135

For some a simple update of the docker version may help, for others running the container in privileged mode. What also bothers me is PermissionError: [Errno 1] Operation not permitted, but that there is no further explanation on WHAT permission failed. Your mapped folders have the right permissions?

ScratMan commented 2 years ago

Hello. Everything is up to date, and the mapped folders are the same as for 0.4.0. I also tried launching the build as root, same issue.

Munsio commented 2 years ago

Everything is up to date

Great to hear but what exact versions are you using?

Potential causes that I read on regarding this problem are with running an 32bit OS on a 64bit CPU and that because of that a security library libseccomp2 is broken.

One workaround would be to run the container in privileged mode. If you do not want to do that you need to update your libseccomp2 library. As I do not know your distro and so on this is something you need to figure out alone.

Regardless of which option you choose I personally would try the privileged one first to see if it solves it and than proceed to the libseccomp2 one for a permanent solution.

Munsio commented 2 years ago

@ScratMan did you get sort it out? If so could you share what exactly you did so others stumbling across this issue know how to resolve it!?

ScratMan commented 2 years ago

@ScratMan did you get sort it out? If so could you share what exactly you did so others stumbling across this issue know how to resolve it!?

Hello, no, I couldn't fix that issue. I checked that docker and libraries are up to date, the folders are accessible, and works perfectly with 0.4.0, and I tried both with my user account and root, without success.

ScratMan commented 2 years ago

Hello, tried again today, still same issue.

root@raspberrypi:/home/docker/git_repos/hass-configurator-docker# docker build -f Dockerfile --build-arg HC_BUILD_VERSION=0.4.1 . -t hass-configurator-docker-local --no-cache Sending build context to Docker daemon 100.4kB Step 1/10 : FROM python:3.9-alpine ---> 897efba2fbc7 Step 2/10 : LABEL maintainer="Martin Treml" ---> Running in 96ad06697d5a Removing intermediate container 96ad06697d5a ---> 6dce9f18bee2 Step 3/10 : WORKDIR /app ---> Running in 0826cddad6aa Removing intermediate container 0826cddad6aa ---> e293c4d8b8a2 Step 4/10 : ARG HC_BUILD_VERSION ---> Running in 984b53535c68 Removing intermediate container 984b53535c68 ---> 164b1779440e Step 5/10 : RUN apk update && apk upgrade && apk add --no-cache bash git openssh && pip install --no-cache-dir hass-configurator==${HC_BUILD_VERSION} gitpython pyotp ---> Running in e05aa9d76c9e fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/armv7/APKINDEX.tar.gz fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/armv7/APKINDEX.tar.gz ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.15/main: temporary error (try again later) WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/main: No such file or directory ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.15/community: temporary error (try again later) WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/community: No such file or directory 2 errors; 37 distinct packages available The command '/bin/sh -c apk update && apk upgrade && apk add --no-cache bash git openssh && pip install --no-cache-dir hass-configurator==${HC_BUILD_VERSION} gitpython pyotp' returned a non-zero code: 2

Munsio commented 2 years ago

Those temporary errors are really strange. I try to get my hands on a Pi 4 for troubleshooting but I can't promise that it would be in the next few days - sry.