ARM64 QNAP LXC Hass.io Installation heads to python fatal: Can't initialize threads for interpreter

Hi!

I’m running HomeAssistant at QNAP TS-932X with Cortex A57 inside and couple days ago decided to move to Hass.io installation cause needed full HTTPS and DDNS support.

Selecting between available options I’ve chosen Hass.io LXC installation cause QNAP Virtualization station is unavailable for my arch.
LXC installation was made with all necessary config changes:

Modified /usr/local/container-station/lxc/share/lxc/config/common.conf

“lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed” into “lxc.mount.auto = proc:mixed sys:mixed”

Modified container-station-data/lib/lxc/ubuntu-xenial-arm64/config

linux.kernel_modules: bridge,br_netfilter,ip_tables,ip6_tables,ip_vs,netlink_diag,nf_nat,overlay,xt_conntrack
raw.lxc: |-
lxc.cgroup.devices.allow = a
lxc.cap.drop =
security.nesting: "true"
security.privileged: "true"

And then made hassio install based on “Installing Home Assistant” article and I had no errors during install, here is output:

root@ubuntu-xenial-arm64:~# sudo add-apt-repository universe                                                                                                                                                            
'universe' distribution component is already enabled for all sources.                                                                                                                                                   
root@ubuntu-xenial-arm64:~# sudo -i                                                                                                                                                                                     
root@ubuntu-xenial-arm64:~# apt-get update                                                                                                                                                                              
Hit:1 http://ports.ubuntu.com/ubuntu-ports xenial InRelease                                                                                                                                                             
Get:2 http://ports.ubuntu.com/ubuntu-ports xenial-updates InRelease [109 kB]                                                                                                                                            
Hit:3 https://download.docker.com/linux/ubuntu xenial InRelease                                                                                                                                                         
Get:4 http://ports.ubuntu.com/ubuntu-ports xenial-security InRelease [109 kB]                                                                                                                                           
Get:5 http://ports.ubuntu.com/ubuntu-ports xenial-updates/main arm64 Packages [768 kB]                                                                                                                                  
Fetched 986 kB in 2s (343 kB/s)                                                                                                                                                                                         
Reading package lists... Done                                                                                                                                                                                           
root@ubuntu-xenial-arm64:~# apt-get install -y software-properties-common apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq network-manager socat                                            
Reading package lists... Done                                                                                                                                                                                           
Building dependency tree                                                                                                                                                                                                
Reading state information... Done                                                                                                                                                                                       
socat is already the newest version (1.7.3.1-1).                                                                                                                                                                        
apparmor-utils is already the newest version (2.10.95-0ubuntu2.11).                                                                                                                                                     
apt-transport-https is already the newest version (1.2.32).                                                                                                                                                             
avahi-daemon is already the newest version (0.6.32~rc+dfsg-1ubuntu2.3).                                                                                                                                                 
ca-certificates is already the newest version (20170717~16.04.2).                                                                                                                                                       
curl is already the newest version (7.47.0-1ubuntu2.14).                                                                                                                                                                
dbus is already the newest version (1.10.6-1ubuntu3.5).                                                                                                                                                                 
network-manager is already the newest version (1.2.6-0ubuntu0.16.04.3).                                                                                                                                                 
software-properties-common is already the newest version (0.96.20.9).                                                                                                                                                   
jq is already the newest version (1.5+dfsg-1ubuntu0.1).                                                                                                                                                                 
0 upgraded, 0 newly installed, 0 to remove and 48 not upgraded.                                                                                                                                                         
root@ubuntu-xenial-arm64:~# systemctl disable ModemManager                                                                                                                                                              
root@ubuntu-xenial-arm64:~# systemctl stop ModemManager                                                                                                                                                                 
root@ubuntu-xenial-arm64:~# curl -fsSL get.docker.com | sh
# Executing docker install script, commit: 1b02882d63b9cfc484ad6b0180171c679cfe0f3a                                                                                                                                     
Warning: the "docker" command appears to already exist on this system.                                                                                                                                                  
                                                                                                                                                                                                                        
If you already have Docker installed, this script can cause trouble, which is                                                                                                                                           
why we're displaying this warning and provide the opportunity to cancel the                                                                                                                                             
installation.                                                                                                                                                                                                           
                                                                                                                                                                                                                        
If you installed the current Docker package using this script and are using it                                                                                                                                          
again to update Docker, you can safely ignore this message.                                                                                                                                                             
                                                                                                                                                                                                                        
You may press Ctrl+C now to abort this script.                                                                                                                                                                          
+ sleep 20                                                                                                                                                                                                              
^C                                                                                                                                                                                                                      
root@ubuntu-xenial-arm64:~# curl -sL "https://raw.githubusercontent.com/home-assistant/supervised-installer/master/installer.sh" | bash -s -- -m qemuarm-64                                                             
[Info] Install supervisor Docker container                                                                                                                                                                              
[Info] Install supervisor startup scripts                                                                                                                                                                               
[Info] Install AppArmor scripts                                                                                                                                                                                         
[Info] Run Hass.io                                                                                                                                                                                                      
[Info] Install cli 'ha' 

As you can see I used qemuarm-64, looks like It’s best option available for my aarch64.
Then tested http://:8123 - got ERR_CONNECTION_REFUSED(

root@ubuntu-xenial-arm64:~# ha                                                                                                                                                                                          
Error: No such container: hassio_cli  

Hmmm. I’ve started to investigate whats happened. This looks like a script with parameters:

curl -sL “…/installer.sh” | bash -s – -m qemuarm-64

I’m not very good in shell scripts, but as I can see it’s trying to pull some containers to docker
I’ve tried to create a container homeassistant/qemuarm-64-homeassistant:latest manually in qnap container station to proof it’s working and then got output in qnap container shell:

<jemalloc>: Unsupported system page size                                                                                                       
<jemalloc>: Unsupported system page size                                                                                                       
<jemalloc>: Unsupported system page size                                                                                                       
Fatal Python error: _PyRuntimeState_Init_impl: Can't initialize threads for interpreter

The same messages I can see in lxc container ubuntu syslog:

May  5 13:20:07 ubuntu-xenial-arm64 hassio-supervisor[19058]: message repeated 2 times: [ <jemalloc>: Unsupported system page size]                                                                                     
May  5 13:20:07 ubuntu-xenial-arm64 hassio-supervisor[19058]: Fatal Python error: _PyRuntimeState_Init_impl: Can't initialize threads for interpreter                                                                   
May  5 13:20:07 ubuntu-xenial-arm64 hassio-supervisor[19058]: [cont-finish.d] executing container finish scripts...                                                                                                     

Looks like it’s a root cause. For some reason latest qemuarm-64 HA container refuses to work with my CPU (a bug or feature?)
I’ve tried other versions and found that homeassistant/qemuarm-64-homeassistant:0.107.7 works fine as a separate HA container!!

But how can I manage to tell hassio-supervisor inside LXC container to use this version? What should be corresponding version of hassio-supervisor container?
That’s a place I’m stuck. Can anyone recommend me how to do this?

Or maybe suggest any easier way to make hassio working on AARCH64 QNAP?

Finally managed to get HTTPS and DDNS working on container installation, so this direction of work (installing hassio on LXC) stopped. But still will be very pleased if someone can share your thoughts how to make it work on LXC