Donkie / Spoolman

Keep track of your inventory of 3D-printer filament spools.
MIT License
757 stars 77 forks source link

Permissions error after upgrading to 0.18.1 #412

Open Tam-Lin opened 2 weeks ago

Tam-Lin commented 2 weeks ago

Describe the bug A clear and concise description of what the bug is.

I'm using the docker image from ghcr.io/donkie/spoolman:latest. I rebooted the docker host, and upon restart, I'm getting (this may be similar to #382, but I believe I have version 0.18.1 that is supposed to fix the permissions error, which was for different files anyway):


INFO:     Started server process [1]
INFO:     Waiting for application startup.
spoolman.env               WARNING  Data directory is not writable, trying to fix it...
chown: /home/app/.local/share/spoolman/cache/materials.json: Operation not permitted
chown: /home/app/.local/share/spoolman/cache/filaments.json: Operation not permitted
chown: /home/app/.local/share/spoolman/cache/hishel/.gitignore: Operation not permitted
chown: /home/app/.local/share/spoolman/cache/hishel/7092233f1b6dfd51f4c1d26c6e64c49a: Operation not permitted
chown: /home/app/.local/share/spoolman/cache/hishel/4203b6c338b99a0428310bad4f723b5d: Operation not permitted
chown: /home/app/.local/share/spoolman/cache/hishel: Operation not permitted
chown: /home/app/.local/share/spoolman/cache/hishel: Operation not permitted
chown: /home/app/.local/share/spoolman/cache: Operation not permitted
chown: /home/app/.local/share/spoolman/cache: Operation not permitted
chown: /home/app/.local/share/spoolman/spoolman.db: Operation not permitted
chown: /home/app/.local/share/spoolman/backups/spoolman.db.5: Operation not permitted
chown: /home/app/.local/share/spoolman/backups/spoolman.db: Operation not permitted
chown: /home/app/.local/share/spoolman/backups/spoolman.db.1: Operation not permitted
chown: /home/app/.local/share/spoolman/backups/spoolman.db.4: Operation not permitted
chown: /home/app/.local/share/spoolman/backups/spoolman.db.2: Operation not permitted
chown: /home/app/.local/share/spoolman/backups/spoolman.db.3: Operation not permitted
chown: /home/app/.local/share/spoolman/backups: Operation not permitted
chown: /home/app/.local/share/spoolman/backups: Operation not permitted
chown: /home/app/.local/share/spoolman/spoolman.log.2024-06-04: Operation not permitted
chown: /home/app/.local/share/spoolman/spoolman.log.2024-06-03: Operation not permitted
chown: /home/app/.local/share/spoolman/spoolman.log: Operation not permitted
chown: /home/app/.local/share/spoolman/spoolman.log.2024-06-02: Operation not permitted
chown: /home/app/.local/share/spoolman/spoolman.log.2024-06-06: Operation not permitted
chown: /home/app/.local/share/spoolman/spoolman.log.2024-06-05: Operation not permitted
chown: /home/app/.local/share/spoolman: Operation not permitted
chown: /home/app/.local/share/spoolman: Operation not permitted
spoolman.env               ERROR    Data directory is not writable. Please run "sudo chown -R 1000:1001 /path/to/spoolman/datadir" on the host OS.
ERROR:    Traceback (most recent call last):
  File "/home/app/spoolman/.venv/lib/python3.11/site-packages/starlette/routing.py", line 677, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/home/app/spoolman/.venv/lib/python3.11/site-packages/starlette/routing.py", line 566, in __aenter__
    await self._router.startup()
  File "/home/app/spoolman/.venv/lib/python3.11/site-packages/starlette/routing.py", line 654, in startup
    await handler()
  File "/home/app/spoolman/spoolman/main.py", line 117, in startup
    env.check_write_permissions()
  File "/home/app/spoolman/spoolman/env.py", line 374, in check_write_permissions
    sys.exit(1)
SystemExit: 1
ERROR:    Application startup failed. Exiting.

In the host, the files are owned by userid docker, group docker, which is UID 1001, GID 1002. In the docker environment, I've specified

PUID=1001
PGID=1002

Running chown -R 1000:1001 * in the host data directory does fix things, but shouldn't be necessary I don't believe.

To Reproduce

I'm not sure; I'm not sure why I'm seeing this now as opposed to with version 0.18.0.

Expected behavior

Specifying PUID and PGID in the environmental variables should allow it to access the files.

Spoolman Host (please complete the following information):

Desktop (please complete the following information):

Additional context Add any other context about the problem here.