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

Unable to run at DSM 7.1 (Permission Error) #99

Open
hoho97 opened this issue Jun 8, 2024 · 32 comments
Open

Unable to run at DSM 7.1 (Permission Error) #99

hoho97 opened this issue Jun 8, 2024 · 32 comments

Comments

@hoho97
Copy link

hoho97 commented Jun 8, 2024

Hi guys, trying to deploy on my synology NAS yet suwayomi refuses to start up. Seems some permission issues but have no idea how to fix it.

the log was very short and raises following error

Suwayomi data location inside the container: /home/suwayomi/.local/share/Tachidesk
error: cannot create /home/suwayomi/startup/server-reference.conf
Permission denied
mv: cannot stat '/home/suwayomi/startup/server-reference.conf': Permission denied

command used was docker run -p 127.0.0.1:4567:4567 ghcr.io/suwayomi/tachidesk:preview

actually tried docker run -p 127.0.0.1:4567:4567 ghcr.io/suwayomi/tachidesk:latest as well but also the same error raised.

@1Megabyte
Copy link

1Megabyte commented Jun 16, 2024

Hi,

Did you find a solution for this issue?

I have the same issue and I'm running it on ubuntu server (vps). I only managed to start the container by changing the container volume path to /home/suwayomi/data, but that won't bind the downloads to the selected host path.

@hoho97
Copy link
Author

hoho97 commented Jun 16, 2024

Hi,

Did you find a solution for this issue?

I have the same issue and I'm running it on ubuntu server (vps). I only managed to start the container by changing the container volume path to /home/suwayomi/data, but that won't bind the downloads to the selected host path.

unfortunately no

@1Megabyte
Copy link

I fixed my problem, but this might not work for you since you're using Synology. The folder created on the host path by the container has root:root permissions. All I had to do was change the folder permission to my user (1000:1000), and then it worked.

Although I first tried to use my mounted CIFS path, that didn't work.

I'm not sure if you checked other resolved issues, but there is a solution for Synology as per this discussion.

  • You have to use the develop branch instead of preview.
  • Set the user permission for the container as 99:100.

Hope that fixes your problem.

@Misaka-Aki
Copy link

I am very pleased to have found a solution. You need to right-click on the mounted folder in the Synology system, select "Properties," and then choose "Permissions" to grant the "Tachidesk" user write permissions.

@hoho97
Copy link
Author

hoho97 commented Jun 21, 2024

I am very pleased to have found a solution. You need to right-click on the mounted folder in the Synology system, select "Properties," and then choose "Permissions" to grant the "Tachidesk" user write permissions.

Would you mind share some screenshots? Actually I granted full control permission to "Everyone" user group but still complaining the permission issue.

image

@Misaka-Aki
Copy link

I am very pleased to have found a solution. You need to right-click on the mounted folder in the Synology system, select "Properties," and then choose "Permissions" to grant the "Tachidesk" user write permissions.

Would you mind share some screenshots? Actually I granted full control permission to "Everyone" user group but still complaining the permission issue.

image

image
先使用项目创建docker-compose文件,并运行一次,系统会创建“Tachidesk”用户
image

@hoho97
Copy link
Author

hoho97 commented Jun 21, 2024

docker-compose

呃,我用的還是老版本的Docker而不是Container Manager
我過幾天試試把DSM升上7.2換Container Manager看看 謝謝大佬

@caoyulotus
Copy link

I am very pleased to have found a solution. You need to right-click on the mounted folder in the Synology system, select "Properties," and then choose "Permissions" to grant the "Tachidesk" user write permissions.

Would you mind share some screenshots? Actually I granted full control permission to "Everyone" user group but still complaining the permission issue.
image

image 先使用项目创建docker-compose文件,并运行一次,系统会创建“Tachidesk”用户 image

我也遇到这个问题了,但是在权限设置里没有找到Tachidesk用户,可以帮我看看我的docker-compose文件吗?

version: '3.7'
services:
  suwayomi:
    image: ghcr.io/suwayomi/tachidesk:latest
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Asia/Shanghai 
    volumes:
      - ./data:/home/suwayomi/.local/share/Tachidesk
    ports:
      - "4567:4567"
    restart: unless-stopped

@hackgrid
Copy link

Can't get it to work also with Synology DSM 7.2.1 + Container Manager.

I don't really know Docker, but I do not understand why this problems happens - sure, the Dockerfile creates a new "suwayomi" user inside the Docker VM and uses it to create other stuff?

I mounted some local folder from my NAS to the "/home/suwayomi/.local/share/Tachidesk" path inside the Docker VM with all permissions, so it should not matter which user account the Docker VM uses to create files and stuff, no?

Of course uid 1000:1000 does not exist on my DSM, but that should not matter at all I think?

Why does it not work? :-(

@daleahmad
Copy link

daleahmad commented Aug 19, 2024

i dont know is it a safe action or not and may complicated things later on. But i am able to resolve the issue by adding id of root of my server instance. try to check your id from the shell and then add accordingly on docker compose. For me it was (0) and i add:

version: '3.7'
services:
  suwayomi:
    image: ghcr.io/suwayomi/tachidesk:preview
    user: 0:0

or before you start docker compose, make a server.conf file to your mounted volume, the script will skip the mv of server.conf. i dont know if you can success on downloading mangas later on tho. the problem is still the incorrect permission.

@Vanhelsin21
Copy link

Vanhelsin21 commented Sep 1, 2024

my solution is changing the binding folder ,the default is - ./data:/home/suwayomi/.local/share/Tachidesk, I changed the folder /home/suwayomi/.local/share/Tachidesk to /root/.local/share/Tachidesk ,and the docker works normally.

@hackgrid
Copy link

hackgrid commented Sep 1, 2024

my solution is changing the binding folder ,the default is - ./data:/home/suwayomi/.local/share/Tachidesk, I changed the folder /home/suwayomi/.local/share/Tachidesk to /root/.local/share/Tachidesk ,and the docker works normally.

How did you manage that? Do you use a local GIT repo?

If I use the upstream file

https://github.com/Suwayomi/docker-tachidesk/blob/main/docker-compose.yml

and change

- ./data:/home/suwayomi/.local/share/Tachidesk

to

    volumes:
      - /volume1/docker/suwayomi:/root/.local/share/Tachidesk

(and then putty/ssh to my Synology NAS and install my custom .yml-file with
sudo docker-compose -f /volume1/share/docker-compose.yml up -d
)

for example, all the scripts inside

https://github.com/Suwayomi/docker-tachidesk/tree/main/scripts

still try to use /home/suwayomi/.local/share/Tachidesk (which does not exist of course).

Did you replace all string-occurences of that inside this project with /root/.local/share/Tachidesk ?
And somehow use a local docker repo?

Could you please provide me with all steps you took, I am not familiar with Docker and really would like to get this working :)

Thanks!

@Vanhelsin21
Copy link

Vanhelsin21 commented Sep 2, 2024


version: '3.7'
services:
suwayomi:
image: ghcr.io/suwayomi/tachidesk:latest
environment:
- TZ=Etc/UTC # Use TZ database name from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# Comment these out if you do not use the flaresolverr container at the bottom of this file
- FLARESOLVERR_ENABLED=true
- FLARESOLVERR_URL=http://flaresolverr:8191
volumes:
- /volume1/docker/tachidesk-docker/config:/root/.local/share/Tachidesk
ports:
- "4567:4567"
restart: on-failure:3

here's my docker-compose yaml

@hackgrid
Copy link

hackgrid commented Sep 2, 2024

Thx! But it still points to the offical repo with the unmodified scripts, yes? Did you use an already pre-existing server config file in your path?

If not, not sure how that could have worked...?

@Vanhelsin21
Copy link

I didn't add any server server.conf to the binding path. the first docker of tachidesk I installed was this one: https://registry.hub.docker.com/r/dezhao/tachidesk_cn/, which is a old and chinese version.‌Its path in the docker is /root/.local/share/Tachidesk,so I modified the binding path,and the docker works just normal.

@hackgrid
Copy link

hackgrid commented Sep 3, 2024

Thanks, but I do not get how this could work for you, since the scripts still reference the /home/suwayomi/.local/share/Tachidesk path. Pretty sure your /volume1/docker/tachidesk-docker/config path must contain an existing config file - if you use an empty folder (like me), i think it does not work.

@arkhangof
Copy link

For folder permission setting on synology DSm for container, you could refer to this document. https://kb.synology.com/en-us/DSM/tutorial/Docker_container_cant_access_the_folder_or_file#x_anchor_idcd3f1170a3

@lostanother
Copy link

this error happened to me toooo, I tried to install the dezhao/tachidesk_cn first to make the /home/suwayomi/startup/server-reference.conf can be created, and then suwayomi works well on my DSM 7.1

@Syer10
Copy link
Contributor

Syer10 commented Oct 22, 2024

That Tachidesk_cn is old and unsupported. The latest ghcr.io/suwayomi/tachidesk:preview should have a good enough Chinese translation.
Please use supported versions of Suwayomi. If you are still running into errors, please pass the gid and uid to the docker user parameter when running the container.

@Vanhelsin21
Copy link

i guess before setting up the docker, it's necessary to give folder read and write permission to suwayomi.

@lostanother
Copy link

That Tachidesk_cn is old and unsupported. The latest ghcr.io/suwayomi/tachidesk:preview should have a good enough Chinese translation. Please use supported versions of Suwayomi. If you are still running into errors, please pass the gid and uid to the docker user parameter when running the container.

yes I'm using suwayomi, tachidesk-cn was just used to avoid the permission error on DSM 7.1.

@Syer10
Copy link
Contributor

Syer10 commented Oct 22, 2024

Oh I see, misread your message. tachidesk-cn is based on the old Suwayomi container we had when this error was more common. Great that your using the latest Suwayomi

@hackgrid
Copy link

Please use supported versions of Suwayomi. If you are still running into errors, please pass the gid and uid to the docker user parameter when running the container.

"please pass the gid and uid to the [docker user parameter]"

which gid / uid should we pass to the docker container?

From the docker user (user which runs docker) on Synology NAS?

@Syer10
Copy link
Contributor

Syer10 commented Oct 24, 2024

From the docker user (user which runs docker) on Synology NAS?

It needs the uid and gid of the user who owns the folder that the volume is inside

@hackgrid
Copy link

That is the same user who runs Docker. I gave on this now and simply installed a full VM on my NAS which runs Suwayomi on first try without any problems. I don't get why you can't provide a proper Docker container which does not require root, hardcoded users, external users or other stuff - all other Docker containers on DSM do not have this problem.

@Syer10
Copy link
Contributor

Syer10 commented Oct 24, 2024

From what I know, Suwayomi does not require root. Files will be created with the uid or gid given to the container, or 1000:1000 if none is passed. This is normal docker behaviour, if you look at LinuxServer containers, you will see UID and GID environment variables, which are the same type of thing.

@ExcaliburVT
Copy link

I'm having the exact same issue. I'm running several other containers with service accounts just fine but something with this image is failing trying to create the files.

Scenarios:

No mounted folder
This "works" since the files are created in memory within the container but of course any configuration is lost after the container restart

Mount to folder while using service account
I created a folder at /volume1/docker/tachidesk/files which is mounted to /home/suwayomi/.local/share/Tachidesk
(Synology convention is that the docker compose file is written to /volume1/docker/tachidesk/compose.yml, so created the /files to hold the actual config)

Created a service account named svc.tachidesk and gave it full control of the folder
image
image

Determined the UID/PID of the newly created service account and added it to the docker-compose:
image

When I run the container the log shows failures trying to create the config:
image

The fact that its asking if it should replace the file seems odd to me, as that should only occur in a command line scenario. There must be something unique with the way that this code works while its trying to create the files.

ADDITIONAL INFO:
I changed the container to run in privileged mode with the "privileged: true" flag and received the same errors in the log.

@ExcaliburVT
Copy link

ExcaliburVT commented Jan 9, 2025

I un-mounted the local drive and ran the container, which launched successfully. I then used the docker cp command to copy the contents of the /home/suwayomi/.local/share/Tachidesk folder to my local /volume1/docker/tachidesk/files folder.

Re-mounting the folder results in the EXACT same log errors even though the files should all exist now. The only thing I can think of is there is something odd in the path or the way the code is attempting to resolve the file path.

@hackgrid
Copy link

hackgrid commented Jan 9, 2025

I don't know why that fails, maybe you need to change the "mv" to "mv -f" there:

mv /home/suwayomi/startup/server-reference.conf /home/suwayomi/.local/share/Tachidesk/server.conf

But all that does is copying the server-reference.conf file from the .jar to the shared folder as "server.conf" file.

You can do this by hand and try again.

@ExcaliburVT
Copy link

Yeah but isn't that effectively the same thing I already did by copying the files directly out of the container to the local file system?

@hackgrid
Copy link

hackgrid commented Jan 9, 2025

I did not understand what you meant to be honest, sorry :D
If the file already exists, the script should quit and never try again to move this file.

See

if [ -f /home/suwayomi/.local/share/Tachidesk/server.conf ]; then

You could remove this line and test if it launches then:

/home/suwayomi/create_server_conf.sh

@ExcaliburVT
Copy link

SOLVED

In my docker-compose file I had in the environment section:
- PUID=1037
- GUID=100

Tried the version that I found above but had the same result:

    environment:
      - PUID=1037
      - PGID=100

Finally asked AI how to properly set the PUID and got this example as it apparently the "new" way to properly set a user...

version: "3.9"

services:
  web:
    image: nginx:latest
    ports:
      - "80:80"
    volumes:
      - type: bind
        source: /home/myuser/nginx/conf/ 
        target: /etc/nginx/conf.d/
        bind-options:
          bind-non-root: true
    user: "${UID}:${GID}"
    environment:
      UID: "1001"
      GID: "1001"

So after I updated my docker-compose using this format:

---
version: '3.7'
services:
  suwayomi:
    image: ghcr.io/suwayomi/tachidesk:latest
    user: "${UID}:${GID}"
    environment:
      - TZ=America/New_York # Use TZ database name from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
      # Comment these out if you do not use the flaresolverr container at the bottom of this file
      - FLARESOLVERR_ENABLED=true
      - FLARESOLVERR_URL=http://flaresolverr:8191
      - UID=1037
      - GID=100

It worked!

ROOT CAUSE PROBLEM: Container not running under service account credentials

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests