Home Assistant Core on Android Tablet

Looks like scapy (a networking library) has issues with rights. It’s a common thing when it’s used without root access (which we do not have, since we use termux). That said, it’s the first time I see such error.
I’ve also updated to the latest version this morning and did not experience that.

Out of curiosity, did you try to change the port you want the web interface to run from? Asking because operating on ports below 1024 usually requires higher permissions. It’s a long shot, but just in case.

Not have many idea about this. I didn’t have any permission problem.
BTW I did everything through ssh instead of on the phone, if that makes any change.

How did you do the whole process?
Current, on my Nexus 5 (obviusly rooted + Lineage OS) I can’t even install Termux.
To speak correctly, Termux won’t install itself properly (I think).
I’m using Nexus Root Toolkit to try some Termux apk, but I can’t execute pkg and other commands cause it says it couldn’t find them.
Same result with other terminal-like app.
So I can’t install python, and go further.

If you did it, it’s a proof that it can be done on Nexus 5

@ Gnoupi please help

The only way I have to fix rust issues is by specifying the cargo build target:

export CARGO_BUILD_TARGET="$(rustc -Vv | grep "host" | awk '{print $2}')"

If something else is happening or missing, it’s not visible in the screenshot you send. The actual cause of error is not there. It’s only pip reporting that the rustc subprocess terminated unexpectedly, but we don’t know why it did.

1 Like

In your case, with a Nexus 5, the best way it’s move from lineageOS (Android) to PostmarketOS (Alpine Linux distro)

Then you can install docker and run home assistant more easily. Even you can add more docker containers such as portainer, esphome, file browser, etc.

I have a Nexus 5 and tried everything, and the easiest and most stable way is PostmarketOS.

javi-n5:~$ neofetch
                 /\                    javi@javi-n5
                /  \                   ------------
               /    \                  OS: postmarketOS edge armv7l
              /      \                 Host: LGE MSM 8974 HAMMERHEAD
             /        \                Kernel: 5.18.1-postmarketos-qcom-msm8974
            /          \               Uptime: 23 hours, 3 mins
            \           \              Packages: 873 (apk)
          /\ \____       \             Shell: ash
         /  \____ \       \            Resolution: 1080x1920
        /       /  \       \           Terminal: /dev/pts/0
       /       /    \    ___\          CPU: Generic DT based system (4)
      /       /      \  / ____         Memory: 856MiB / 1883MiB
     /       /        \/ /    \
    /       / __________/      \
   /        \ \                 \
  /          \ \                 \
 /           / /                  \
/___________/ /____________________\
1 Like

Thanks a lot!

My Wi-Fi module is broken (is a sadly known issue).

Is Wi-Fi needed, or I can use at least one of these 2 solutions (to install/update docker/HA and mantain its connection)? :arrow_down:

I use wi-fi connection. Unfortunately I do not have a ethernet on the go adapter and I am not sure if it works.

If works, the problem would be charging the device while using OTG because then, the mobile phone set as charging device and usb host.

Pity that the WiFi module do not work…

Hi all,

I have been using for a while a 5G Nokia phone as a modem and since it’s basically it’s only function, I decided to install homeassistant on it (I don’t have anymore my pi3B).

I tried following the instructions here, tried many things actually, but i’m always stuck on cryptography and orjson.

My mobile uses an aarch64 platform. The full details about versions are:

Python: 3.10.7
platform: Linux-4.19.125-perf±aarch64-with-libc
pip: n/a
setuptools: 65.3.0
setuptools_rust: 1.5.2
rustc: 1.63.0

My latest problem with orjson is the code below. I’ve tried to run it running before export CARGO_BUILD_TARGET="$(rustc -Vv | grep “host” | awk ‘{print $2}’)" but it made no diference.

I have attached the error for cryptography here, since is too big to fit on this post.

Any ideas on what else could I try?

~ $ pip install orjson
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Collecting orjson
  Using cached orjson-3.8.0.tar.gz (949 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: orjson
  Building wheel for orjson (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for orjson (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [44 lines of output]
      Running `maturin pep517 build-wheel -i /data/data/com.termux/files/usr/bin/python --compatibility off`
         Compiling target-lexicon v0.12.4
         Compiling autocfg v1.1.0
         Compiling serde v1.0.144
         Compiling once_cell v1.13.1
         Compiling version_check v0.9.4
         Compiling rustversion v1.0.9
         Compiling libc v0.2.132
         Compiling ryu v1.0.11
         Compiling cfg-if v1.0.0
         Compiling itoa v1.0.3
         Compiling encoding_rs v0.8.31
         Compiling cc v1.0.73
         Compiling serde_json v1.0.85 (/data/data/com.termux/files/usr/tmp/pip-install-wvn6vp_r/orjson_9fff109b17ae4ad790eb0044f422b60f/local_dependencies/serde_json)
         Compiling associative-cache v1.0.1
         Compiling simdutf8 v0.1.4
         Compiling smallvec v1.9.0
         Compiling bytecount v0.6.3
         Compiling ahash v0.8.0
         Compiling num-traits v0.2.15
         Compiling num-integer v0.1.45
         Compiling pyo3-build-config v0.17.0
         Compiling castaway v0.2.2
         Compiling chrono v0.4.19
         Compiling pyo3-ffi v0.17.0
         Compiling orjson v3.8.0 (/data/data/com.termux/files/usr/tmp/pip-install-wvn6vp_r/orjson_9fff109b17ae4ad790eb0044f422b60f)
         Compiling arrayvec v0.7.2
         Compiling compact_str v0.6.1
         Compiling beef v0.5.2
      error: could not compile `orjson` due to 2 previous errors
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `"cargo" "rustc" "--release" "--target" "aarch64-linux-android" "--message-format" "json" "--lib"`
      📦 Including license file "LICENSE-APACHE"
      📦 Including license file "LICENSE-MIT"
      🔗 Found pyo3-ffi bindings
      🐍 Found CPython 3.10 at /data/data/com.termux/files/usr/bin/python
      error: failed to prepare thin LTO module: Opaque pointers are only supported in -opaque-pointers mode (Producer: 'LLVM15.0.1' Reader: 'LLVM 15.0.1')
      
      
      error: aborting due to previous error
      
      
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/data/data/com.termux/files/usr/bin/python', '--compatibility', 'off'] returned non-zero exit status 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for orjson
Failed to build orjson
ERROR: Could not build wheels for orjson, which is required to install pyproject.toml-based projects

All I can say is that this seems to be the cause, it’s found on both logs. Never had that before, though.

I see that it’s using LLVM/clang version 15, which seems to be a recent upgrade in Termux from this week. Mine is still using version 14. I see there were several issues of compatibility with this upgrade, some packages not up to date, some libraries not updated to match, etc.
So I’d say you’re unlucky and fell exactly in the wrong time.

That said, your error doesn’t seem related to Termux per se, more to the new LLVM version. Maybe we need to find a way to activate those opaque-pointers?

Maybe if i had the v14 files, I could donwgrade it…

I mean it’s embedded in the Termux package, and will most likely be this way for the future, so I’m not sure if it’s the way to go, rather to work around that or fix it.

If I could find it, could be quicker than looking for a way but I couldn’t find the Deb files.

About fixing, googled it around but couldn’t find a way yet

Ok. So, I managed to install it. What I did was:

orjson

pip download orjson==3.7.11

tar xvf orjson-3.7.11.tar.gz

cd orjson-3.7.11

nano Cargo.toml

commented out lto = "thin"

maturin build --release --strip

cd ..

rm orjson-3.7.11.tar.gz

tar -czvf orjson-3.7.11.tar.gz orjson-3.7.11

cryptography

pip download cryptography==37.0.4

tar xvf cryptography-37.0.4.tar.gz

cd cryptography-37.0.4/src/rust

nano Cargo.toml

commented out lto = "thin"

maturin build --release --strip

cd

cd ../../../

rm cryptography-37.0.4.tar.gz

tar -czvf cryptography-37.0.4.tar.gz cryptography-37.0.4

then i followed with installation steps, but manually installing orjson and cryptography:

python -m venv hass

source hass/bin/activate

pip install orjson-3.7.11.tar.gz

pip install cryptography-37.0.4.tar.gz

pip install homeassistant
2 Likes

Thank you for the guide and support! Comments from @Gnoupi and @leofuscaldi were very useful!

Managed to install it on an Asus ZenPad Z500M running Android 7. Did not have to install lineage OS. Also installed it in parallel on a OnePlus 7 Pro with LineageOS 18.1

Managed to connect multiple devices, works pretty well. I still have these issues in the log, if someone fixed these already, please share :slight_smile:

Setup failed for default_config: (DependencyError(...), 'Could not setup dependencies: hardware')
October 2, 2022 at 11:29:43 PM – (ERROR) setup.py
Unable to set up dependencies of default_config. Setup failed for dependencies: hardware
October 2, 2022 at 11:29:43 PM – (ERROR) setup.py
Error during setup of component hardware
October 2, 2022 at 11:29:41 PM – (ERROR) components/hardware/websocket_api.py

The hardware error can be fixed by using this commit to psutils fix #2138 (critical): re-define ethtool_cmd_speed · giampaolo/psutil@b88f4d8 · GitHub

I had trouble using pip download so I used unearth to get the url link and downloaded it with wget.

python -m pip install --upgrade unearth
unearth psutil | grep url
wget https://files.pythonhosted.org/packages/8f/57/828ac1f70badc691a716e77bfae258ef5db76bb7830109bf4bcf882de020/psutil-5.9.2.tar.gz
tar xvf psutil-5.9.2.tar.gz

change 2 files like in the commit and then:

rm psutil-5.9.2.tar.gz
tar -czvf psutil-5.9.2.tar.gz psutil-5.9.2
pip install psutil-5.9.2.tar.gz
3 Likes

Hey, I’m rather new to Linux in general, so please bear with me. I was having issues installing any packages that needed to generate a wheel, and came across this forum. I was trying to install cryptography through termux. I’ve never used home assistant, so my use case may differ here. I did a little research and found I could set an environment variable to force rustc to not use the lto flag, something like

export RUSTFLAGS="-C lto=n"

If this is a dumb way to do this, please let me know, but I was finally able to install what I needed after setting the variable.

3 Likes

I don’t think its dumb, its easier and faster than changing the files.

Hey everyone,

Having trouble at the orjson point:

Collecting orjson==3.7.11
  Using cached orjson-3.7.11.tar.gz (946 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [58 lines of output]
      Collecting maturin<0.14,>=0.13
        Using cached maturin-0.13.5.tar.gz (150 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting tomli>=1.1.0
        Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
      Building wheels for collected packages: maturin
        Building wheel for maturin (pyproject.toml): started
        Building wheel for maturin (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
× Building wheel for maturin (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [34 lines of output]
            running bdist_wheel
            running build
            running build_py
            creating build
            creating build/lib.linux-aarch64-cpython-310
            creating build/lib.linux-aarch64-cpython-310/maturin
            copying maturin/__main__.py -> build/lib.linux-aarch64-cpython-310/maturin
            copying maturin/__init__.py -> build/lib.linux-aarch64-cpython-310/maturin
            copying maturin/import_hook.py -> build/lib.linux-aarch64-cpython-310/maturin
            running egg_info
            creating maturin.egg-info
            writing maturin.egg-info/PKG-INFO
            writing dependency_links to maturin.egg-info/dependency_links.txt
            writing requirements to maturin.egg-info/requires.txt
            writing top-level names to maturin.egg-info/top_level.txt
            writing manifest file 'maturin.egg-info/SOURCES.txt'
            reading manifest file 'maturin.egg-info/SOURCES.txt'
            reading manifest template 'MANIFEST.in'
            writing manifest file 'maturin.egg-info/SOURCES.txt'
            running build_ext
            running build_rust
            error: rustup could not choose a version of rustc to run, because one wasn't specified explicitly, and no default is configured.

Have already installed the Rust and Cargo packages, so I’m at a loss here.

Did you install rustup? I had that issue too on termux (sandboxed Linux app for Android), rustup doesn’t support termux based builds. I think I’d installed rust with my package manager, and then installed rustup on top of it (not good lol). Try doing rustup self uninstall and then install rust (if you haven’t already) through your normal package manager, then try again.

1 Like