netbrain / zwift

Easily zwift on linux
The Unlicense
238 stars 27 forks source link

Permission issues when trying to start Zwift #56

Closed henningf3 closed 7 months ago

henningf3 commented 8 months ago

Hello there! Today I tried to get Zwift running on my Ubuntu-machine. Therefore, I took the following steps:

  1. Installing docker engine (following instructions provided in https://docs.docker.com/engine/install/ubuntu/ and https://docs.docker.com/engine/install/linux-postinstall/)
  2. Installing the NVIDIA Container Toolkit (https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)
  3. sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/netbrain/zwift/master/bin/install.sh)"
  4. zwift

The execution of the last command resulted in a popup, which told me that Zwift is not able to write the storage. This issue was resolved by performing sudo chown -R $USER:$USER /var/lib/docker/volumes/zwift-henning which seemed somehow intuitive. Now it works divinely, thanks a lot for this project! Is it possible to prevent this from happening at all (I'm not familiar with Docker)? If not, this workaround might be add to the README.md. Cheers!

netbrain commented 8 months ago

I'm not sure why the permissions is a issue for some. But maybe your user is not a part of the docker group? Or you ran all docker commands with sudo? Not sure, in any case podman which is user level as opposed to root level, would probably fare better.

I'll guess I'll use this issue as a metric for how many people this is happening to, and take it from there.

On Wed, Jan 3, 2024, 14:26 Henning Dierks @.***> wrote:

Hello there! Today I tried to get Zwift running on my Ubuntu-machine. Therefore, I took the following steps:

  1. Installing docker engine (following instructions provided in https://docs.docker.com/engine/install/ubuntu/ and https://docs.docker.com/engine/install/linux-postinstall/)
  2. Installing the NVIDIA Container Toolkit ( https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html )
  3. sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/netbrain/zwift/master/bin/install.sh )"
  4. zwift

The execution of the last command resulted in a popup, which told me that Zwift is not able to write the storage. This issue was resolved by performing sudo chown -R $USER:$USER /var/lib/docker/volumes/zwift-henning which seemed somehow intuitive. Now it works divinely, thanks a lot for this project! Is it possible to prevent this from happening at all (I'm not familiar with Docker)? If not, this workaround might be add to the README.md. Cheers!

— Reply to this email directly, view it on GitHub https://github.com/netbrain/zwift/issues/56, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACTNCYYQVW33YY2C5JGWRDYMVMAHAVCNFSM6AAAAABBLNZRNWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DIMBTGY4DONY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

henningf3 commented 8 months ago

Thanks for your answer! I just double-checked to be sure that my user is part of docker-group, it is. Since docker was a fresh installation, I can also preclude that running former commands with sudo broke something. After reading a bit about podman, I would agree that this is the option of choice here. Probably the issues would not have emerged.

quietvoid commented 8 months ago

I ran into the same thing with a fresh image and Docker volume, because the volume is mounted as root by default. So before installing Zwift I run sudo chown user:user "$HOME/Zwift" now, in the entrypoint.

netbrain commented 8 months ago

The container used to mount to $HOME/.zwift-$USER (or something along those lines), i think this fashion of mounting is called a bind mount , but due to people having permission issues on the host file system i changed this to a named volume instead which should be handled within the container itself. The reasoning behind this would be that it should prevent these kind of permission issues, but it seems it hasn't removed them completely.

Im also not sure if a VOLUME directive in the dockerfile would do anything to force such a named volume to be created with the proper user and group as set through the USER directive.

I'm already spending way too much time on this sideproject, so i'm not going to actively pursue this issue myself, but ill follow along and help if i can.

nabadger commented 8 months ago

I have this issue too and worked around it by not using the named volume.

docker run --privileged -e DISPLAY=:0 \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -v /run/user/1000/pulse:/run/user/1000/pulse \
  -v /home/$USER/Zwift:/home/user/Zwift \               # <--- this line here 
  --device /dev/dri:/dev/dri docker.io/netbrain/zwift:latest

Prior to this I noticed that if you set the entrypoint --entrypoint=wineconsole and attempt to create a dir in the Zwift folder you get a permissions issue, so I suspect it's the permissions on the volume.

zwift-perm-issue

Ubuntu 22.04.2 LTS / Docker version 23.0.1, build a5ee5b1
netbrain commented 7 months ago

@nabadger can you create a reproducible recipe for this permission error? In that case I can try to reproduce it locally.

KPLauritzen commented 7 months ago

I had the same issue as @henningf3, running on fresh install of Debian 12. Solved with

sudo chown -R $USER:$USER /var/lib/docker/volumes/zwift-$USER
SvenGrandcentrix commented 7 months ago

For the statistics: I had this very issue on Ubuntu 23.10. My solution was to remove the existing swift image from docker, than

sudo chown -R $USER:$USER /var/lib/docker/volumes/zwift-$USER

followed by the usual

zwift

created the file system with the correct rights and Zwift started.

FlorMaye commented 7 months ago

I had the same permission error when starting zwift, and the "sudo chown -R $USER:$USER /var/lib/docker/volumes/zwift-$USER" command at beginning of installation did not really change anything.

I could solve the problem by changing the permission of /var/run/docker.sock to ‘666‘

Follow this instruction here https://www.baeldung.com/linux/docker-permission-denied-daemon-socket-error

Not sure if this is a good way but at least it works ad I can start zwift from the docker image.

nlavalle commented 7 months ago

Adding onto this, I think my situation might be slightly different since my version is opting to use podman instead of docker, here's the message if this helps:

Copying config 9ef1b18912 done  
Writing manifest to image destination
Storing signatures
9ef1b18912735a62b0d371c7a2cad4e41a4d31df545f0782b346ed81a364a7c1
+ [[ -f /proc/driver/nvidia/version ]]
+ VGA_DEVICE_FLAG='--gpus all'
+++ '[' podman = podman ']'
+++ echo --userns=keep-id
++ podman run -d --rm --privileged -e DISPLAY=:1 -v /tmp/.X11-unix:/tmp/.X11-unix -v /run/user/1000/pulse:/run/user/1000/pulse -v zwift-gloom_tenacity:/home/user/Zwift --userns=keep-id --gpus all docker.io/netbrain/zwift:latest
Error: make `/home/gloom_tenacity/.local/share/containers/storage/overlay/c6b3aeca7712505516df67dd40026347a2eccd28732795931934bbb209e519de/merged` private: Permission denied: OCI permission denied
+ CONTAINER=
+ [[ -z '' ]]
++ podman inspect '--format={{ .Config.Hostname  }}'
Error: no names or ids specified
+ xhost +local:
non-network local connections being added to access control list

first time using this I did the install.sh bash command from the readme then tried to run zwift.

edit: sudo zwift didn't work either, but copying the podman run command and running that as sudo did start up the app, fwiw.