NoMore201 / playmaker

Fdroid repository manager fetching apps from Play Store
284 stars 37 forks source link

permission issue #43

Open Findus23 opened 5 years ago

Findus23 commented 5 years ago

see also https://github.com/NoMore201/playmaker/issues/42#issuecomment-460735077

Since https://github.com/NoMore201/playmaker/commit/f3828fdfd92ad1971802adfaa967b908d1ac9e2a the container doesn't start anymore.

After deleting the container and /srv/fdroid on every start I only get the following error:

➜  ~ docker logs playmaker
error initializing fdroid repository CRITICAL: Android SDK path "/opt/android-sdk-linux" does not contain "platform-tools/"!
CRITICAL: Unknown exception found!
Traceback (most recent call last):
  File "/usr/bin/fdroid", line 147, in <module>
    main()
  File "/usr/bin/fdroid", line 124, in main
    mod.main()
  File "/usr/lib/python3/dist-packages/fdroidserver/init.py", line 125, in main
    os.mkdir('repo')
PermissionError: [Errno 13] Permission denied: 'repo'

I think this has something to do that /srv/fdroid (outside of the container) is only readable by root, and I think this line only runs on container creation and not when starting the container. https://github.com/NoMore201/playmaker/blob/a97fd9e77ccfabc5f37af1ca93b7b9a3f2048503/Dockerfile#L45

But I know too little about how docker works correctly to suggest a solution.

Jonny007-MKD commented 5 years ago

Did build the container yourself?

Findus23 commented 5 years ago

No, I pulled it from the repository.

Jonny007-MKD commented 5 years ago

Well, that worked for me. But when building it on my own I had the same error and I could fix it by modifying the Dockerfile: RUN echo 'y' | tools/bin/sdkmanager --sdk_root=/opt/android-sdk-linux --verbose "platforms;android-26" "build-tools;26.0.1" "platform-tools" \ You can also check the existance of the platform-tools directory in /opt/android-sdk-linux in the container by running docker exec -i CONTAINER bash

Findus23 commented 5 years ago

I found the "solution" (not really what I wished for):

The user inside of docker has the id 999, so I had to chown -R 999:999 the /srv/fdroid directory outside of docker so that it can read it.

Exist2Resist commented 5 years ago

I run my container with UID=99 and GID=100 Is there no way to enable that again, was working well before, what changed?

While this is a workaround the host OS will have trouble accessing those files.

dogabone commented 5 years ago

@Exist2Resist currently, to change that you can edit the Dockerfile and rebuild the image.

@Findus23 there are some docker images that do this automatically by using a shellscript as the entrypoint (e.g. postgres and fireflyIII). In my RPi I created a shellscript to do the pre-checks (path exists and is owned by 999:999) and start the container.