linuxserver / docker-emulatorjs

Web based retro emulation frontend with rom scanning and automated art ingestion.
GNU General Public License v3.0
512 stars 51 forks source link

GID/UID not used everywhere, causing permission errors #15

Closed XanderStrike closed 2 years ago

XanderStrike commented 2 years ago

Expected Behavior

I should be able to specify GID and UID and have those be recognized and respected

Current Behavior

Console directories are sometimes created as root, sometimes as the specified user:

~/configs/emulatorjs $ ls -lh data/
total 48K
drwxr-xr-x 4 xander xander 4.0K Jan 24 12:16 atari7800
drwxr-xr-x 3 root   root   4.0K Jan 24 12:15 gb
drwxr-xr-x 3 root   root   4.0K Jan 24 12:15 gba
drwxr-xr-x 3 root   root   4.0K Jan 24 12:15 gbc
drwxr-xr-x 6 xander xander 4.0K Jan 24 12:16 main
drwxr-xr-x 3 root   root   4.0K Jan 24 12:15 n64
drwxr-xr-x 3 root   root   4.0K Jan 24 12:15 nds
drwxr-xr-x 3 root   root   4.0K Jan 24 12:15 nes
drwxr-xr-x 3 root   root   4.0K Jan 24 12:15 psx
drwxr-xr-x 4 xander xander 4.0K Jan 24 12:16 segaCD
drwxr-xr-x 3 root   root   4.0K Jan 24 12:15 snes
drwxr-xr-x 4 xander xander 4.0K Jan 24 12:16 vb

This causes the default file downloads to hang due to the following error in the console:

emulatorjs    | node:internal/process/promises:246
emulatorjs    |           triggerUncaughtException(err, true /* fromPromise */);
emulatorjs    |           ^
emulatorjs    |
emulatorjs    | [Error: EACCES: permission denied, mkdir '/data/gb/backgrounds'] {
emulatorjs    |   errno: -13,
emulatorjs    |   code: 'EACCES',
emulatorjs    |   syscall: 'mkdir',
emulatorjs    |   path: '/data/gb/backgrounds'
emulatorjs    | }

Steps to Reproduce

  1. Run with a specified GID/UID
  2. Click the button to download default files
  3. Observe modal never completes
  4. Observe error in console
  5. Observe incorrect ownership

As a workaround, you I have been able to chown -R xander:xander data and have the default files complete downloading. Other tasks (scanning roms, downloading art) work properly after this workaround.

Environment

OS: Ubuntu 20.04 LTS CPU architecture: x86_64 How docker service was installed: apt install docker-ce I think, it's 20.10.7

Command used to create docker container (run/create/compose/screenshot)

---
version: "2.1"
services:
  emulatorjs:
    image: lscr.io/linuxserver/emulatorjs
    container_name: emulatorjs
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - SUBFOLDER=/ #optional
    volumes:
      - /home/xander/configs/emulatorjs/config:/config
      - /home/xander/configs/emulatorjs/data:/data
      # - /home/xander/configs/emulatorjs/emulatorjs/has_files.sh:/emulatorjs/has_files.sh
      - /mnt/tank/roms/Nintendo DS/roms:/data/nds/roms:ro
      - /mnt/tank/roms/Nintendo Game Boy/roms:/data/gb/roms:ro
      - /mnt/tank/roms/Nintendo Game Boy Advance/roms:/data/gba/roms:ro
      - /mnt/tank/roms/Nintendo Game Boy Color/roms:/data/gbc/roms:ro
      - /mnt/tank/roms/Nintendo Entertainment System/roms:/data/nes/roms:ro
      - /mnt/tank/roms/Super Nintendo Entertainment System/roms:/data/snes/roms:ro
      - /mnt/tank/roms/Nintendo 64/roms:/data/n64/roms:ro
      - /mnt/tank/roms/Sony Playstation/roms:/data/psx/roms:ro
    ports:
      - 3000:3000
      - 80:80
      - 4001:4001 #optional
    restart: unless-stopped

Docker logs

Click to expand! ``` [s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 01-envfile: executing... [cont-init.d] 01-envfile: exited 0. [cont-init.d] 01-migrations: executing... [migrations] started [migrations] no migrations found [cont-init.d] 01-migrations: exited 0. [cont-init.d] 10-adduser: executing... usermod: no changes ------------------------------------- _ () | | ___ _ __ | | / __| | | / \ | | \__ \ | | | () | |_| |___/ |_| \__/ Brought to you by linuxserver.io ------------------------------------- To support LSIO projects visit: https://www.linuxserver.io/donate/ ------------------------------------- GID/UID ------------------------------------- User uid: 1000 User gid: 1000 ------------------------------------- [cont-init.d] 10-adduser: exited 0. [cont-init.d] 20-config: executing... generating ED25519 keypair...done peer identity: 12D3KooWQt7vbZGtGdsJ1ynrT32upDP8NYnhkDeAuidCx9JDxD3y initializing IPFS node at /data/.ipfs to get started, enter: ipfs cat /ipfs/QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc/readme [cont-init.d] 20-config: exited 0. [cont-init.d] 90-custom-folders: executing... [cont-init.d] 90-custom-folders: exited 0. [cont-init.d] 99-custom-files: executing... [custom-init] no custom files found exiting... [cont-init.d] 99-custom-files: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. Initializing daemon... go-ipfs version: 0.10.0-975d73f4e3 Repo version: 11 System version: amd64/linux Golang version: go1.17.2 Swarm listening on /ip4/127.0.0.1/tcp/4001 Swarm listening on /ip4/127.0.0.1/udp/4001/quic Swarm listening on /ip4/192.168.16.2/tcp/4001 Swarm listening on /ip4/192.168.16.2/udp/4001/quic Swarm listening on /p2p-circuit Swarm announcing /ip4/104.174.148.35/udp/4001/quic Swarm announcing /ip4/127.0.0.1/tcp/4001 Swarm announcing /ip4/127.0.0.1/udp/4001/quic Swarm announcing /ip4/192.168.16.2/tcp/4001 Swarm announcing /ip4/192.168.16.2/udp/4001/quic API server listening on /ip4/127.0.0.1/tcp/5001 WebUI: http://127.0.0.1:5001/webui Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080 Daemon is ready node:internal/process/promises:246 triggerUncaughtException(err, true /* fromPromise */); ^ [Error: EACCES: permission denied, mkdir '/data/gb/backgrounds'] { errno: -13, code: 'EACCES', syscall: 'mkdir', path: '/data/gb/backgrounds' } ```
github-actions[bot] commented 2 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

thelamer commented 2 years ago

When docker mounts volumes like this in a tree it will be root owned on the parents. You can chown -R inside the container using exec to get the perms you need, but it won't survive upgrades.