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

Permission denied - /usr/share/opensearch/ #97

Closed
lindeberg25 opened this issue Feb 10, 2022 · 9 comments
Closed

Permission denied - /usr/share/opensearch/ #97

lindeberg25 opened this issue Feb 10, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@lindeberg25
Copy link

Hello...

I'm deploying an opensearch cluster on Openshift and I'm getting the permission denied error: ./opensearch-docker-entrypoint.sh: permission denied"

I've created an opensearch-sa service account and added it to master.yaml:

     serviceAccountName: "opensearch-sa"

I've set opensearch-sa to privileged.

I believe the user created in the opensearch image doesn't have permission on /usr/share/opensearch/opensearch-docker-entrypoint.sh, which is a little weird. (I think the image user should already have permission to access that folder)

Could someone tell me what I'm missing?

Thanks in advance

@lindeberg25 lindeberg25 added bug Something isn't working untriaged Issues that have not yet been triaged labels Feb 10, 2022
@CEHENKLE CEHENKLE transferred this issue from opensearch-project/OpenSearch Feb 15, 2022
@bbarani
Copy link
Member

bbarani commented Feb 17, 2022

@lindeberg25 Can you please pull in updated Docker image and let us know if you are still facing this issue? You can find more info tracked in the below issues

Issue 1
Issue 2

@zelinh zelinh removed the untriaged Issues that have not yet been triaged label Feb 17, 2022
@bbarani
Copy link
Member

bbarani commented Mar 1, 2022

@lindeberg25 Closing this issue as we couldn't replicate it on the latest Docker image. Please feel free to re-open in if you are still facing this issue.

@bbarani bbarani closed this as completed Mar 1, 2022
@ElhamAhmadlou
Copy link

Hi
I also have same error . i have also changed the image version to the latest one , but it did't help.

level=error msg="container_linux.go:367: starting container process caused: exec: \"./opensearch-docker-entrypoint.sh\": stat ./opensearch-docker-entrypoint.sh: permission denied"

@dion-dodgen
Copy link

+1 error persists on :latest

@dblock
Copy link
Member

dblock commented Dec 6, 2022

I'll reopen and move this to opensearch-devops.

@dblock dblock reopened this Dec 6, 2022
@dblock dblock transferred this issue from opensearch-project/opensearch-build Dec 6, 2022
@Ismo900123213
Copy link

Had the same issue. Fix: at the container level, define the securityContext of runAsUser and runAsGroup to:
securityContext:
runAsUser: 1000
runAsGroup: 1000

@peterzhuamazon
Copy link
Member

Echo @Ismo900123213, In our docker the user we user to run is having 1000 id.
And the default user should be them as well.

If you are having another user trying to access the folder then it will error out. Thanks.

@marcosox
Copy link

as reported by another user in opensearch-project/docker-images#35:

Since the script itself is set with these permissions: -rwxr-xr-x (allow other to read and execute) it would be logical for the previous directories to have the same permissions

I have user namespace remapping enabled, and when starting the container the opensearch-owned files become owned by root:

bash-5.2# ls -al /usr/share/opensearch/opensearch-docker-entrypoint.sh 
-rwxr-xr-x 1 root opensearch 4876 Oct 13 03:45 /usr/share/opensearch/opensearch-docker-entrypoint.sh

the parent folder (/usr/share/opensearch) is not group readable:

bash-5.2$ ls -al /usr/share/
total 192
drwxr-xr-x  1 root root       4096 Oct 13 03:45 .
drwxr-xr-x  1 root root       4096 Oct 10 22:51 ..
drwxr-xr-x  2 root root       4096 Jan 30  2023 X11
drwxr-xr-x  2 root root       4096 Jan 30  2023 aclocal
drwxr-xr-x  2 root root       4096 Jan 30  2023 appdata
drwxr-xr-x  2 root root       4096 Jan 30  2023 applications
drwxr-xr-x  3 root root       4096 Oct 10 22:51 augeas
drwxr-xr-x  2 root root       4096 Oct 10 22:51 awk
drwxr-xr-x  2 root root       4096 Jan 30  2023 backgrounds
drwxr-xr-x  4 root root       4096 Jan 31  2023 bash-completion
drwxr-xr-x 11 root root       4096 Oct 10 22:51 crypto-policies
drwxr-xr-x  2 root root       4096 Jan 30  2023 desktop-directories
drwxr-xr-x  2 root root       4096 Jan 30  2023 dict
drwxr-xr-x  1 root root       4096 Oct 13 03:45 doc
dr-xr-xr-x  2 root root       4096 Jan 30  2023 empty
drwxr-xr-x  2 root root       4096 Oct 10 22:51 file
drwxr-xr-x  2 root root       4096 Jan 30  2023 games
lrwxrwxrwx  1 root root         14 Aug 14 20:55 gawk -> /usr/share/awk
drwxr-xr-x  3 root root       4096 Oct 10 22:51 gcc-11
drwxr-xr-x  3 root root       4096 Oct 10 22:51 gdb
drwxr-xr-x  3 root root       4096 Oct 10 22:51 glib-2.0
drwxr-xr-x  2 root root       4096 Jan 30  2023 gnome
drwxr-xr-x  2 root root       4096 Jan 30  2023 help
drwxr-xr-x  4 root root       4096 Oct 10 22:51 i18n
drwxr-xr-x  2 root root       4096 Jan 30  2023 icons
drwxr-xr-x  2 root root       4096 Jan 30  2023 idl
drwxr-xr-x  1 root root       4096 Oct 13 03:45 info
drwxr-xr-x  2 root root       4096 Oct 10 22:51 libgpg-error
drwxr-xr-x  5 root root       4096 Oct 10 22:51 libreport
drwxr-xr-x  1 root root       4096 Oct 13 03:45 licenses
drwxr-xr-x  1 root root       4096 Oct 13 03:45 locale
drwxr-xr-x  4 root root       4096 Oct 10 22:51 lua
lrwxrwxrwx  1 root root         10 Aug 30 20:17 magic -> misc/magic
drwxr-xr-x  1 root root       4096 Oct 13 03:45 man
drwxr-xr-x  2 root root       4096 Jan 30  2023 metainfo
drwxr-xr-x  2 root root       4096 Jan 30  2023 mime-info
drwxr-xr-x  2 root root       4096 Oct 10 22:51 misc
drwxr-xr-x  2 root root       4096 Jan 30  2023 omf
drwx------  1 root opensearch 4096 Oct 13 03:45 opensearch
drwxr-xr-x  3 root root       4096 Oct 10 22:51 p11-kit
drwxr-xr-x  2 root root       4096 Jan 30  2023 pixmaps
drwxr-xr-x  4 root root       4096 Oct 10 22:51 pki
lrwxrwxrwx  1 root root         25 Jan 29  2023 python-wheels -> /usr/share/python3-wheels
drwxr-xr-x  2 root root       4096 Oct 10 22:51 python3-wheels
drwxr-xr-x  2 root root       4096 Jan 30  2023 sounds
drwxr-xr-x  2 root root       4096 Oct 10 22:51 tabset
drwxr-xr-x 23 root root       4096 Oct 10 22:51 terminfo
drwxr-xr-x  2 root root       4096 Jan 30  2023 themes
drwxr-xr-x  2 root root       4096 Jan 30  2023 wayland-sessions
drwxr-xr-x  2 root root       4096 Jan 30  2023 xsessions
drwxr-xr-x 20 root root       4096 Oct 10 22:51 zoneinfo

So I end up with permission denied and can't use the image.

Is the rwx------ permission crucial for /usr/share/opensearch/? could it be rwxr-xr-x like the files it contains? This would allow the image to be compatible with the typical setup for users which have namespace remapping enabled.

yrodiere added a commit to yrodiere/search.quarkus.io that referenced this issue Nov 3, 2023
This reverts commit e4dcd09.

It appears OpenSearch needs to run with UID 1000
because the entrypoint script is only accessible with that user:
opensearch-project/opensearch-devops#97

But our OpenShift cluster only allows containers to run with wildly high
UIDs, like 100000000. The security context constraints do not allow
anything else.

The entrypoint script is not accessible to groups, either,
so OpenShift's fsGroup config
(https://docs.openshift.com/container-platform/3.11/install_config/persistent_storage/pod_security_context.html#fsgroup)
is no use.

And finally, user namespace mapping is not supported in OpenShift yet:

https://access.redhat.com/solutions/6977863
@midprasanta
Copy link

Is there any plan to fix the issue. Error happens in openshift only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants