Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird permission issues because PUID/PGID is being ignored I think? #787

Closed
mbround18 opened this issue Jan 28, 2024 Discussed in #786 · 2 comments · Fixed by #788
Closed

Weird permission issues because PUID/PGID is being ignored I think? #787

mbround18 opened this issue Jan 28, 2024 Discussed in #786 · 2 comments · Fixed by #788
Labels
awaiting response Waiting for someone or something to respond

Comments

@mbround18
Copy link
Owner

Discussed in #786

Originally posted by wesgould January 28, 2024
I am running into weird permission issues if I try to pass in the PUID and PGID Environment variables to the container. It appears as though the PUID is being passed properly but the PGID might not be.

Here is my compose file:

version: "3"
services:
  valheim:
    image: mbround18/valheim:latest
    restart: always
    container_name: valheim
    stop_signal: SIGINT
    ports:
      - 2456:2456/udp
      - 2457:2457/udp
      - 2458:2458/udp
    environment:
      PORT: 2456
      NAME: ""
      WORLD: ""
      PASSWORD: ""
      TZ: "America/New_York"
      PUBLIC: 1
      AUTO_UPDATE: 1
      AUTO_UPDATE_SCHEDULE: "0 1 * * *"
      AUTO_BACKUP: 1
      AUTO_BACKUP_SCHEDULE: "*/15 * * * *"
      AUTO_BACKUP_REMOVE_OLD: 1
      AUTO_BACKUP_DAYS_TO_LIVE: 3
      AUTO_BACKUP_ON_UPDATE: 1
      AUTO_BACKUP_ON_SHUTDOWN: 1
      UPDATE_ON_STARTUP: 0
      PUID: "1001"
      PGID: "1001"
    volumes:
      - ./valheim/saves:/home/steam/.config/unity3d/IronGate/Valheim
      - ./valheim/server:/home/steam/valheim
      - ./valheim/backups:/home/steam/backups

My server has my personal user at 1000:1000 and this valheim user at 1001:1001

if I do docker-compose up (with or without --build) it starts to launch but I get lots of permission denied errors:

Creating network "new_valheim_default" with the default driver
Creating valheim ... done
Attaching to valheim
valheim    | America/New_York
valheim    | 2024-01-28 11:06:36 - #[INFO]: ###########################################################################
valheim    | 2024-01-28 11:06:36 - [Valheim][INFO]: Valheim Server - Sun Jan 28 11:06:36 AM EST 2024
valheim    | 2024-01-28 11:06:36 - [Valheim][INFO]: Initializing your container...
valheim    | 2024-01-28 11:06:36 - [Valheim][INFO]: Total memory: 31GB
valheim    | 2024-01-28 11:06:36 - #[INFO]: ###########################################################################
valheim    | Configuring Preset Env
valheim    | export DEBUG_MODE=0
valheim    | export ODIN_CONFIG_FILE="/home/steam/valheim/config.json"
valheim    | export ODIN_DISCORD_FILE="/home/steam/valheim/discord.json"
valheim    | export ODIN_WORKING_DIR=""
valheim    | export SAVE_LOCATION="/home/steam/.config/unity3d/IronGate/Valheim"
valheim    | export MODS_LOCATION="/home/steam/staging/mods"
valheim    | export GAME_LOCATION="/home/steam/valheim"
valheim    | export BACKUP_LOCATION="/home/steam/backups"
valheim    | export NAME=""
valheim    | export ADDRESS=""
valheim    | export PORT=2456
valheim    | export PUBLIC=1
valheim    | export ENABLE_CROSSPLAY=0
valheim    | export UPDATE_ON_STARTUP=0
valheim    | export SERVER_EXTRA_LAUNCH_ARGS=""
valheim    | export WEBHOOK_URL=""
valheim    | export WEBHOOK_STATUS_SUCCESSFUL=1
valheim    | export WEBHOOK_STATUS_FAILED=1
valheim    | export WEBHOOK_STATUS_RUNNING=1
valheim    | export WEBHOOK_INCLUDE_PUBLIC_IP=0
valheim    | export AUTO_UPDATE=1
valheim    | export AUTO_BACKUP=1
valheim    | export AUTO_BACKUP_REMOVE_OLD=1
valheim    | export AUTO_BACKUP_DAYS_TO_LIVE=3
valheim    | export AUTO_BACKUP_ON_UPDATE=1
valheim    | export AUTO_BACKUP_ON_SHUTDOWN=1
valheim    | export AUTO_BACKUP_PAUSE_WITH_NO_PLAYERS=0
valheim    | export VALHEIM_PLUS_RELEASES_URL=""
valheim    | export VALHEIM_PLUS_DOWNLOAD_URL=""
valheim    | export BEPINEX_RELEASES_URL="https://valheim.thunderstore.io/api/experimental/package/denikson/BepInExPack_Valheim/"
valheim    | export BEPINEX_DOWNLOAD_URL=""
valheim    | export BEPINEX_FULL_RELEASES_URL=""
valheim    | Preset Env Configured
valheim    | 2024-01-28 11:06:37 - [Valheim][INFO]: Auto Update Enabled...
valheim    | 2024-01-28 11:06:37 - [Valheim][INFO]: Auto Update Schedule: 0 1 * * *
valheim    | mkdir: cannot create directory ‘/home/steam/valheim/logs’: Permission denied
valheim    | 0 1 * * * BASH_ENV=/env.sh /bin/bash /home/steam/scripts/auto_update.sh >> /home/steam/valheim/logs/auto-update.out 2>&1
valheim    | 2024-01-28 11:06:37 - [Valheim][INFO]: Auto Backup Enabled...
valheim    | 2024-01-28 11:06:37 - [Valheim][INFO]: Auto Backup Schedule: */15 * * * *
valheim    | mkdir: cannot create directory ‘/home/steam/valheim/logs’: Permission denied
valheim    | */15 * * * * BASH_ENV=/env.sh /bin/bash /home/steam/scripts/auto_backup.sh >> /home/steam/valheim/logs/auto-backup.out 2>&1
valheim    | 2024-01-28 11:06:37 - [Valheim][INFO]: Setting up file systems
valheim    | mkdir: cannot create directory ‘/home/steam/valheim/logs’: Permission denied
valheim    | usermod: no changes
valheim    | /entrypoint.sh: line 151: cd: /home/steam: Permission denied
valheim    | /entrypoint.sh: line 168: log: command not found
valheim    | /entrypoint.sh: line 177: line: command not found
valheim    | Configuring Preset Env
valheim    | Preset Env Configured
valheim    | /entrypoint.sh: line 187: log: command not found
valheim    | /entrypoint.sh: line 188: log: command not found
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | tee: /home/steam/cron.d//auto-update: Permission denied
valheim    | 0 1 * * * BASH_ENV=/env.sh /bin/bash /home/steam/scripts/auto_update.sh >> /home/steam/valheim/logs/auto-update.out 2>&1
valheim    | tee: /home/steam/cron.d//auto-update: Permission denied
valheim    | chmod: cannot access '/home/steam/cron.d//auto-update': Permission denied
valheim    | /entrypoint.sh: line 198: log: command not found
valheim    | /entrypoint.sh: line 199: log: command not found
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | tee: /home/steam/cron.d//auto-backup: Permission denied
valheim    | */15 * * * * BASH_ENV=/env.sh /bin/bash /home/steam/scripts/auto_backup.sh >> /home/steam/valheim/logs/auto-backup.out 2>&1tee: /home/steam/cron.d//auto-backup: Permission denied
valheim    | 
valheim    | chmod: cannot access '/home/steam/cron.d//auto-backup': Permission denied
valheim    | cat: '/home/steam/cron.d/*': Permission denied
valheim    | /entrypoint.sh: line 125: log: command not found
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | usermod: no changes
valheim    | /entrypoint.sh: line 151: cd: /home/steam: Permission denied
valheim exited with code 1
valheim    | /entrypoint.sh: line 168: log: command not found
valheim    | /entrypoint.sh: line 177: line: command not found
valheim    | Configuring Preset Env
valheim    | Preset Env Configured
valheim    | /entrypoint.sh: line 187: log: command not found
valheim    | /entrypoint.sh: line 188: log: command not found
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | tee: /home/steam/cron.d//auto-update: Permission denied
valheim    | 0 1 * * * BASH_ENV=/env.sh /bin/bash /home/steam/scripts/auto_update.sh >> /home/steam/valheim/logs/auto-update.out 2>&1
valheim    | tee: /home/steam/cron.d//auto-update: Permission denied
valheim    | chmod: cannot access '/home/steam/cron.d//auto-update': Permission denied
valheim    | /entrypoint.sh: line 198: log: command not found
valheim    | /entrypoint.sh: line 199: log: command not found
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | tee: /home/steam/cron.d//auto-backup: Permission denied
valheim    | */15 * * * * BASH_ENV=/env.sh /bin/bash /home/steam/scripts/auto_backup.sh >> /home/steam/valheim/logs/auto-backup.out 2>&1tee: /home/steam/cron.d//auto-backup: Permission denied
valheim    | 
valheim    | chmod: cannot access '/home/steam/cron.d//auto-backup': Permission denied
valheim    | cat: '/home/steam/cron.d/*': Permission denied
valheim    | /entrypoint.sh: line 125: log: command not found
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | mkdir: cannot create directory ‘/home/steam’: Permission denied
valheim    | /entrypoint.sh: line 151: cd: /home/steam: Permission denied
valheim    | usermod: no changes
valheim exited with code 1

If I run this, with my valheim (1001:1001) user without any PUID or PGID args it creates a structure where the directory and files are all 1000:1000 aka my regular user account owns them. BUT IT WORKS*. I just want all of these files/directories and everything to be owned by my valheim 'service' account that I created for additional security.

I think the steam user inside the container is running at 1000:1000 by default and it seems to not like it if you pass the variables.

valheim    | 2024-01-28 11:22:31 - #[INFO]: ###########################################################################
valheim    | 2024-01-28 11:22:31 - [Valheim][INFO]: Valheim Server - Sun Jan 28 11:22:31 AM EST 2024
valheim    | 2024-01-28 11:22:31 - [Valheim][INFO]: STEAM_UID 1000 - STEAM_GUID 1000
valheim    | 2024-01-28 11:22:31 - [Valheim][INFO]: Installing Valheim via odin 2.1.0...
valheim    | 2024-01-28 11:22:31 - #[INFO]: ###########################################################################

What am I doing wrong? I am sure its something super dumb on my end, but maybe its a bug?

For what its worth I search for an answer, saw this #18 and #23 but nothing in there seemed to point me in the right direction other than it seems like it was fixed years ago?

@mbround18 mbround18 mentioned this issue Jan 30, 2024
4 tasks
@mbround18 mbround18 added the awaiting response Waiting for someone or something to respond label Feb 3, 2024
@mbround18
Copy link
Owner Author

@wesgould id like to close this issue out, are you able to test mbround18/valheim:sha-f25b81a for your use case?

@wesgould
Copy link

wesgould commented Feb 3, 2024

Hey @mbround18 yes, I was able to test and it worked. I saw your follow up in the discussion thread as well, so I will be trying that "extend the container" option as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response Waiting for someone or something to respond
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants