G-Two / homeassistant-subaru

Subaru STARLINK custom component for Home Assistant.
Apache License 2.0
54 stars 6 forks source link

With Docker, integration installation is trying to write /.local and can't #118

Open wz2b opened 2 months ago

wz2b commented 2 months ago

I was unable to initially install this in a docker image.

2024-05-03 07:59:34.175 ERROR (SyncWorker_6) [homeassistant.util.package] Unable to install package subarulink==0.7.11: ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/.local'
Check the permissions.

I worked around the problem as follows:

% sudo docker exec -u root -it homeassistant bash
$ mkdir /.local
$ chown 114 /.local

note that user 114 is the user ID that home assistant runs as in the container; this might be different for anybody else so beware. Also note that in that command 'homeassistant' is the name I gave to the container. YMMV.

My installation process was exactly what's in the README for manual installation - copy into config/custom_components. After doing the above it works fine.

Something is attempting to write to /.local which as you can see from the path is the root directory (within the container). I suspect that whatever is asking to write there is expecting some kind of prefix in an environment variable or elsewhere.

I am PRETTY sure that whatever this problem is relates to how the homelink plugin is installing its dependency, the main subarulink api. The reason I say that is by examining the contents of /.local (see below). I don't know what's causing it to install its dependency there - I have not encountered this with other custom homeassistant plugins (though I don't use many). I don't really control the installation, it's done by home assistant, and it's not giving me any additional information into what it's doing. There is a good chance that what I'm seeing has not to do with this module specifically and is something weird about the official homeassistant docker container, perhaps something I should have configured. But since I saw the error with this integration, I am reporting it here - I will try to figure this out and if I find it has nothing to do with this module I will come back and close this ticket. In the mean time if anybody has any suggestions on how to figure this out please let me know.

.
./lib
./lib/python3.12
./lib/python3.12/site-packages
./lib/python3.12/site-packages/subarulink
./lib/python3.12/site-packages/subarulink/__init__.py
./lib/python3.12/site-packages/subarulink/const.py
./lib/python3.12/site-packages/subarulink/app
./lib/python3.12/site-packages/subarulink/app/__init__.py
./lib/python3.12/site-packages/subarulink/app/cli.py
./lib/python3.12/site-packages/subarulink/app/__pycache__
./lib/python3.12/site-packages/subarulink/app/__pycache__/cli.cpython-312.pyc
./lib/python3.12/site-packages/subarulink/app/__pycache__/__init__.cpython-312.pyc
./lib/python3.12/site-packages/subarulink/__version__.py
./lib/python3.12/site-packages/subarulink/_subaru_api
./lib/python3.12/site-packages/subarulink/_subaru_api/__init__.py
./lib/python3.12/site-packages/subarulink/_subaru_api/const.py
./lib/python3.12/site-packages/subarulink/_subaru_api/__pycache__
./lib/python3.12/site-packages/subarulink/_subaru_api/__pycache__/__init__.cpython-312.pyc
./lib/python3.12/site-packages/subarulink/_subaru_api/__pycache__/const.cpython-312.pyc
./lib/python3.12/site-packages/subarulink/controller.py
./lib/python3.12/site-packages/subarulink/exceptions.py
./lib/python3.12/site-packages/subarulink/__pycache__
./lib/python3.12/site-packages/subarulink/__pycache__/__init__.cpython-312.pyc
./lib/python3.12/site-packages/subarulink/__pycache__/const.cpython-312.pyc
./lib/python3.12/site-packages/subarulink/__pycache__/connection.cpython-312.pyc
./lib/python3.12/site-packages/subarulink/__pycache__/controller.cpython-312.pyc
./lib/python3.12/site-packages/subarulink/__pycache__/exceptions.cpython-312.pyc
./lib/python3.12/site-packages/subarulink/__pycache__/__version__.cpython-312.pyc
./lib/python3.12/site-packages/subarulink/connection.py
./lib/python3.12/site-packages/subarulink-0.7.11.dist-info
./lib/python3.12/site-packages/subarulink-0.7.11.dist-info/RECORD
./lib/python3.12/site-packages/subarulink-0.7.11.dist-info/REQUESTED
./lib/python3.12/site-packages/subarulink-0.7.11.dist-info/METADATA
./lib/python3.12/site-packages/subarulink-0.7.11.dist-info/LICENSE
./lib/python3.12/site-packages/subarulink-0.7.11.dist-info/top_level.txt
./lib/python3.12/site-packages/subarulink-0.7.11.dist-info/INSTALLER
./lib/python3.12/site-packages/subarulink-0.7.11.dist-info/entry_points.txt
./lib/python3.12/site-packages/subarulink-0.7.11.dist-info/AUTHORS.md
./lib/python3.12/site-packages/subarulink-0.7.11.dist-info/WHEEL
./bin
./bin/subarulink
G-Two commented 2 months ago

It's been a couple years since I've tried/documented the a manual installation process. The contents you list in /.local are all the expected files that would be installed with the subarulink package dependency (i.e. if you were to pip install subarulink). AFAIK, the only control this custom-component has is specifying that subarulink needs to be installed (via the manifest.json file). The files associated with that installation are controlled by the subarulink package, but the ultimate path they are installed to is controlled by the system/script that actually performs the installation.