core: armv7 QNAP Docker: Restarting loop - Core finish process exit code 256 - Core finish process received signal 11 (exit code 139 and exit code 135)
Version 2022.7+ currently boot loop on QNAP NAS ts-231p
INFO: Home Assistant Core finish process exit code 256
INFO: Home Assistant Core finish process received signal 11
…
What version of Home Assistant Core has the issue? 2022.7+
What was the last working version of Home Assistant Core? 2022.6.7
What type of installation are you running? Home Assistant Container
Additional information Running on QNAP NAS (TS-231P).
Processor: Annapurna Labs Alpine AL314 Quad-core ARM Cortex-A15 CPU @ 1.70GH
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 145 (16 by maintainers)
So I managed to bring up 2023.10.5 (lsat version with orjson 3.9.7) Additionalls: apk add ffmpeg ffmpeg-dev openblas openblas-dev cmake pip install ha-av==10.1.1 numpy=1.2.24(?) PyTurboJPEG pip install --no-binary=:all: webrtc-noise-gain
Currently the most recent builds of HA do not run on our hardware since they require Alpine 3.18. You can use my github project to build HA 2023.10.3 on your machine until we resolve the segmentation fault issue found on Alpine 3.18.
I have a project to ideally maintain and update an HA dockerfile for our hardware. It currently builds on my NAS but I can’t get it to build via Github Actions. Hopefully this project doesn’t need to be around for too long. I would like to hope that the underlying issues get addressed so official images work again. It might help if @magicse lays out a bullet point list of what you found that needs to be fixed/addressed.
https://github.com/Wetzel402/home-assistant-docker-armv7
I noticed one of the reasons HA was failing to install dependencies was that it needed zlib. I removed the
# Cleanup unnecessary files and cachessection and the images starts up correctly. I was able to get to the onboarding screen in a clean container. Running in my production container is TBD.Hello, I was testing different images and tags from the official armhf for a QNAP TS-231P3 (Alpine AL314 armv7) and I reached the exit code 139. So definetly the official images are broken for that architectures. Now I’m surviving with a linuxserver image, but I think that for future releases I will need use the snipped on: https://github.com/home-assistant/core/issues/86589#issuecomment-1673510507
Thank you for the thread and the help
Problem still with auditwheel + patchelf
I was able to use @magicse instructions to get an updated instance of HA running on my QNAP NAS also. This proves there is an issue with the official HA builds that needs to be addressed as we were suspecting. I hope the issue is addressed soon. This work around makes updating far more complex.
Edit: I’ve been struggling to use this method with my production HA docker compose. The closest I get is the log looping a message about receiving traffic from a reverse proxy but my HTTP config not being set up for it. As far as I can tell this means it must be using a default config rather than my production config but I can’t figure out why. Any tips or suggests would be appreciated.
Got my own Container now running. It was a lot of work. Thx to Magicse 😉
@frenck: is there any chance to get this fixed by the team in future? Topic open since January
I don’t know what developers are doing with their container. But now the new home assistant container image throws error 139 even after I change the entrypoint to /bin/ash. Most likely, the binaries are assembled in QEMU without taking into account the subtleties of the Alpine AL314 Quad-core armv7 hardware architecture. If you see “exit code = 135” or “exit code = 139”, then your devices architecture is not supported.
RUN |6 BUILD_ARCH=armv7 QEMU_CPU= SSOCR_VERSION=2.22.1 LIBCEC_VERSION=6.0.2 QEMU_CPU= ??
Thx I will try it 😉
I have the same problem with Qnap TS-431X. Tested versions 2023.3.0.dev20230202, 2023.2.0.dev20230120, 2023.2.0b9 and current “stable”.
2022.6.7 works well.
Hi @Wetzel402 Here strings that have differences from zcat /proc/config.gz
Alpine Linux 3.18 for TS-131K with 4K page size
Alpine Linux 3.17 from TS-231P with 32K page size
Will be better if this will be armv7 based NAS with 4K page size. I will try ask about this my friends because they have TS-131K with page size 4K and worked Home Assistant with Alpine 3.18
I recently picked up an x86 based 8 bay QNAP NAS and will be migrating this weekend. I can keep my old unit for now to continue troubleshooting this problem. If I run
zcat /proc/config.gzusing my new machine on Alpine 3.18 will that provide the data we need or does it need to be the armv7 based NAS with 32k page size?Hi @Wetzel402 I tried installing the latest original home assistant on a QNAP TS-131K (same CPU as TS-231p3) but with 1 Gb of memory and it still works with a 4K page size. And home assistant last version started and works without problems. So the problem is with the page size. Now I’m trying to compile the Alpine Linux 3.18 kernel inside the Alpine Linux 3.17 container, let’s see what happens.
I also wrote to QNAP support, but they are stubborn and say that 32K is good and they are not interested in third-party containers.
Commands to build Alpine inside container
Once the build process is complete, the customized ISO image in the output/ directory.
As I understand it, PAGE SIZE is set through the definition of PAGE_SHIFT in the configuration files… Where PAGE_SHIFЕ = 12 by default 2^12 = 4K (4096). For 32K must be 15, 2^15=32768
some interesting article https://lwn.net/Articles/822868/
Hi @Wetzel402 I’ll look and try to do something… I need to force myself)) We just have constant air raid warnings due war… and the mood is very sad.
General problem support for 32k pages
Hello @magicse sorry the delay… the crazy life.
I tried the 3 points, but unfortunetly didn’t work. Then I tried the Dockerfile in project of @Wetzel402. It worked. I don’t know exactly why it didn’t work in your Dockerfile. I think that maybe there are some missing dependency or for me, the most probable is that
pip3 install homeassistantinstall the lastest version that has some kind of trouble.Need more testing to understand what happened to prevent any possible issues in the future.
@terox orjson … requires rustc 1.65+, but the latest we can have (thanks CentOS 6) is 1.62.
orjson … requires rustc 1.65+, but the latest we can have (thanks CentOS 6) is 1.62.
or
or
The effect that this works more slowly occurs during the initial initialization stage. After initialization it works normally. This is because any additional wheels are now assembled locally.
Conclusion - the image works in the same speed as the original one. Slowdown occurs at the stage of first initialization and when installing new components… since the assembly now occurs locally and does not download a ready-made packages from the repository.
https://github.com/home-assistant/core/assets/13585785/a039be31-3a03-4a83-9b18-9c6ae63c877a
@Wetzel402 Version Dockerfile with Python 3.11 to get latest homeassistant 2023.9 Dockerfile
@magicse, Have you tested this Dockerfile? It builds fine but I find that when HA starts it tries installing dependencies and fails.
the wheels will be assembled during the docker assembly process and will not use ready-made wheels from home assistant. This set of commands is what assembles and installs the wheels without any patchelfs.
RUN apk add g++ gcc make RUN apk add libcap libpcap-dev RUN apk add python3 RUN python3 -m ensurepip --upgrade RUN apk add git RUN apk add python3-dev libffi-dev libftdi1-dev bzip2-dev openssl-dev cargo jpeg-dev zlib-dev RUN pip3 install aiohttp RUN pip3 install ffmpeg RUN pip3 install libpcap RUN pip3 install tzdata RUN pip3 install PyNaCl RUN pip3 install Pillow RUN pip3 install git+https://github.com/boto/botocore RUN pip3 install homeassistant
Also I added issue about Page Size 32K https://github.com/alpinelinux/docker-alpine/issues/342
@terox
CODE 139 https://www.qnap.com/da-dk/how-to/faq/article/why-do-the-installed-third-party-containers-not-run-successfully-on-specific-32-bit-arm-devices
After they changed the memory page size from 4 to 32 K, a problem appeared with images that were designed (compiled) for 4K memory pages. Some applications or libraries are sensitive to page size mismatches. For example - jemalloc library (it must be compiled with next option for example ./configure --with-lg-page=15 # for pagesize 32K 2^15). With patchelf i think same problem. It detect page memory size from elf file compiled for 4K pagesize and make wrong patch of binaries and due this we get errors with native homeassistant wheels compiled under 4K pagesize settings. https://github.com/NixOS/patchelf/pull/216 When Homeassistant start use jemalloc we start get 139 or 135 error and this problem resolved with seting variable DISABLE_JEMALLOC = true and correct script inside homeassistant to check this. When Homeassistant start use auditwheel with patchelf we start get broken wheells libary binaries.
I have created a ticket on QNAP about this issue. Also you could create an issue about this on Alpine gihub for last alpine image with 32K page size support. But this isn’t really a problem though… It’s a more modern approach. It’s just that most docker images for arm32v7 continue to be created with a page size of 4K and not 32K.
Try Alpine 3.17 it work well
I think the best variant create own project on Github with Dockerfile and use Actions to automatic build image and push it to Docker hub for public. I’m not a big expert in Github Actions and If anyone can help in creating an accurate Dockerfile and correct build-and-push.yml, I would be very grateful and appreciative. Need create something like this
Dockerfile
Also need create or update GitHub Actions workflow configuration (e.g., .github/workflows/build-and-push.yml) to build the Docker image for ARMv7… Something like this
I think the best variant for now this
Download Alpina 3.16 or 3.17 official minimal clean docker image (only 5mb in size) https://hub.docker.com/_/alpine And install everything in it from scratch Python 3.10.10, g++, gcc and homeassistant with pip install homeassistant command. Also added this
pip3 install git+https://github.com/boto/botocore<- due error https://github.com/home-assistant/core/issues/95192I was trying to see if this user had a github but I’m not finding it. I would be useful to see what changes they made. Also since I’m not finding source code I’m a little leery to use the image.
Is the team depreciating container installation?
My model of QNAP NAS does not support VM install plus, since the VM still uses containers I would be concerned the same problem might still arise on my hardware. If I’m not mistaken this issue also effects some single board computers such as early RPi.
Edit: I do understand we are a very limited subset of users. If I have a little guidance I will gladly make a pull request to fix it.
Edit2: @magicse, you seem to understand the issue. Can you make a pull request to fix it?
@Wetzel402 QNAP updated its native reverse proxy and now there is no need to install docker nginx. You can use the native one from QNAP by automatically pulling up the certificate.
Try instruction above
I think the best variant for now this 1 https://github.com/home-assistant/core/issues/86589#issuecomment-1436089123 2 https://github.com/home-assistant/core/issues/86589#issuecomment-1436499486
Download Alpina 3.16 or 3.17 official minimal clean docker image (only 5mb in size) https://hub.docker.com/_/alpine And install everything in it from scratch Python 3.10.10, g++, gcc and homeassistant with pip install homeassistant command.
@magicse, Were you able to build a working image? I’ve been running the image provided by linuxserver.io which did not have the problem but they are now ending life for
armhfso the last version available is 2023.4.4.Interestingly it appears as though 2023.2.x is the last official version to do the looping
Home Assistant Core finish process exit code 256 Home Assistant Core finish process received signal 11. Versions 2023.3+ seem to completely crash the container.I would like to reiterate for everyone here there is clearly something wrong with the way the official container is built for our architecture because the linuxserver.io container works just fine. I am currently back on their 2023.4.4 container.
For clarity, I am running a QNAP TS-431XeU which has a Alpine AL314 Quad-core ARM Cortex-A15 CPU.
Sorry to hear that, however, not related and not justifying any of your actions above.
…/Frenck
@magicse, great work. Sounds like HA wheels need to be rebuilt.
Removing site-packagaes folder inside of original Home Assistant and rebuilding packages give fully worked Home Assistant without segfaults and restarting loop.
$\textcolor{red}{\textsf{Conclusion: segfault and loop reboot problem is 100\% due to badly built whl packages for armv7.}}$
Just for information so is probably easier to debug. The core image is built starting FROM the homeassistant/docker image, that is build on top of the python3.10 homeassistant/docker-base image that, in turn, is based on the armv7-base:
https://github.com/home-assistant/docker-base/tree/master/alpine (armv7-base) https://github.com/home-assistant/docker-base/tree/master/python/3.10 (python3.10 -alpine 3.16 docker-base) https://github.com/home-assistant/docker (homeassistant-base) https://github.com/home-assistant/core (core)
you could probably try to check if the problem is really in the wheels or in some misconfigured image from all the layers
Before everything it starts with arm32v7/alpine:3.16
Ok so you’re trying to do all what is done from multiple github actions alone … And it’s a good method, first trying to make it work and then slowly remove some custom builded image using the “offical” one is a good method to narrow down what is going wrong. You already did a great work I suspect that since the base image was the 2022.11.0 and stayed that for long time probably something was not working as expected but it could also be something other
as I said I used the core one 😄 no problem I was just curious because I saw that the new version should have the base image with the new python so maybe that will solve the issue without compiling
@Wetzel402 @jrieger @larsxschneider @lswysocki @boyarale @Gerigot
Next experiment inside of original Home Assistant docker container to get worked Home Assistant
I removed old python by rm command because apk del python3 can’t delete it, I think because of some wrong installation of Python in Home Assistan container.
After that I reinstall Python and Home Assistant inside of container.
And voila Home Assistant works without problems
Therefore, questions remain about the Python installed in the original Home Assistant container.
Listing of worked installation
List of commands to install Home assistant in to the clear minimal Alpine 3.16 docker image.
To start home assistant run hass
@Wetzel402 I downloaded Alpina 3.16 official minimal clean docker image (only 5mb in size) https://hub.docker.com/_/alpine And I installed everything in it from scratch myself Python 3.10.10, g++, gcc and homeassistant with pip install homeassistant command.
After installation I ran *hass script and Home Assistant 2023.2.5 started and everything works great. This indicates that the docker image https://hub.docker.com/r/homeassistant/home-assistant which is posted on homeassistant is not built correctly.

QNAP armv7l May be problem with armv7l <-- > armv7hf and package architecture (armv7l) does not match system (armhf) also it not armv7hf-musl armv7hf armv7l-musl
bash-5.1# cat /proc/cpuinfo processor : 0 model name : Annapurna Labs Alpine AL314 Quad-core ARM Cortex-A15 CPU @ 1.70GHz Speed : 1.7GHz Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc0f CPU revision : 4
@Wetzel402
May be you are right and they use different wheels for example for cryptography. I see by names that they didn’t use musllinux for arch armv7l . musllinux used for aarch64 and x86_64 arch. Also aarch64 and x86_64 arch builded for Python 3.6, and armv7l armv8l builded for Python 3.10
Debugging of official image give me error in ld-musl-armhf.so.1 while importing (for exmaple) numpy or cryptography
I think we could start from this point… For example when simple importing of numpy inside of container will be without segmentation fault.
@magicse, right now I think comparing the repositories to find differences would be a good start. Why does linuxserver.io’s image run when the official does not?
I was hoping that @Gerigot’s fix would also correct the issue with QNAP but it appears that isn’t the case. More investigation and research is needed…
@Wetzel402
linuxserver.io’s container Home Assistant 2023.2.1 work well.
@magicse can you try with a pre-release version? like the new one from today 2023.2.0b9
So that we can ensure that it’s related with the problem #75142.
Because the fix was for armv6 and I’m not sure the problem with your device is the same, although it seems similar.
This issue might be resolved finally. If the latest official container still isn’t working you can try linuxserver.io’s container.
#75142