homeassistant-docker-venv icon indicating copy to clipboard operation
homeassistant-docker-venv copied to clipboard

run script changes ownership to root

Open bdr99 opened this issue 5 years ago • 3 comments

I noticed that whenever I start the HA container, the run script changes ownership to root. Even if I change it to be owned by my user, when I restart the container again, it changes back to root. Is there a way to keep this file owned by my user?

$ ls -l data/docker/run
-rwxr-xr-x 1 root root 2089 Jun 22 21:32 data/docker/run
$ sudo chown brandon:brandon data/docker/run
$ ls -l data/docker/run
-rwxr-xr-x 1 brandon brandon 2089 Jun 22 21:32 data/docker/run
$ docker-compose restart
Restarting home-assistant ... done
$ ls -l data/docker/run
-rwxr-xr-x 1 root root 2089 Jun 22 21:32 data/docker/run

bdr99 avatar Jun 23 '20 02:06 bdr99

Thanks for getting in touch. This seems to be something that s6 (the new init system used by the home-assistant docker image) does, I'll see if I can do anything about it.

tribut avatar Jun 23 '20 06:06 tribut

Thanks @tribut! By the way, I tried changing the volume mount to be read-only, like this:

    volumes:
      - ./data:/config
      - ./data/docker/run:/etc/services.d/home-assistant/run:ro

It seemed to work. I did see this in the logs:

s6-chown: fatal: unable to chown /var/run/s6/etc/services.d/home-assistant/run: Read-only file system
s6-chmod: fatal: unable to change mode of /var/run/s6/etc/services.d/home-assistant/run: Read-only file system

Despite these log entries though, everything seemed to work fine. The ownership of the run script didn't change, and the app did run as my user instead of root. So maybe this is the easiest fix.

bdr99 avatar Jun 23 '20 17:06 bdr99

volumes:
  - ./data:/config
  - ./data/docker/run:/etc/services.d/home-assistant/run:ro

Hi! I tried changing it too, and it doesn't work for me. data/docker/run run as root

nikc547 avatar Mar 18 '21 19:03 nikc547