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 !" on a binary that has permission ! #5103

Closed
medyagh opened this issue Feb 6, 2020 · 9 comments
Closed

"Permission denied !" on a binary that has permission ! #5103

medyagh opened this issue Feb 6, 2020 · 9 comments
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@medyagh
Copy link

medyagh commented Feb 6, 2020

while doing this PR to add podman as a driver to minikube (which will run a systemd inside a container using podman)
kubernetes/minikube#6515

I noticed the binary files that minikube copies into the podman container, are not executable.

root@minikube:/var/lib/minikube/binaries/v1.17.2# ./kubectl
bash: ./kubectl: Permission denied
# ls -lah kubectl
-rwxrwxrwx 1 root root 42M Jan 21 18:07 kubectl

because I had other issues with podman cp command
I decided to go into the container myself and use wget to download them and then chmod +x manually but I still get permission denied !!!

this seems to be the only blocker to add run minikube in podman and I would appreciate any help on this

sudo podman exec -it minikube /bin/bash

root@minikube:/var/lib/minikube/binaries/v1.17.2# wget https://storage.googleapis.com/kubernetes-release/release/v1.17.2/bin/linux/amd64/kubectl
 41.48M   223MB/s    in 0.2s
2020-02-06 07:53:03 (223 MB/s) - 'kubectl' saved [43491328/43491328]

root@minikube:/var/lib/minikube/binaries/v1.17.2# chmod +x kubectl
root@minikube:/var/lib/minikube/binaries/v1.17.2# ./kubectl
bash: ./kubectl: Permission denied
root@minikube:/var/lib/minikube/binaries/v1.17.2# chmod a+x kubectl
root@minikube:/var/lib/minikube/binaries/v1.17.2# ./kubectl
bash: ./kubectl: Permission denied

it worth noting that minikube creates the container with --cgroup-manager cgroupfs
and --privileged and with sudo
(unlike docker it doesn't let me create my container without sudo)

versions :
$ podman version
Version: 1.7.0
RemoteAPI Version: 1
Go Version: go1.12.10
OS/Arch: linux/amd64

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.10
Release: 19.10

@medyagh medyagh changed the title can't run a binary I download into container "Permission denied !" "Permission denied !" on a binary that has permission ! Feb 6, 2020
@rhatdan
Copy link
Member

rhatdan commented Feb 6, 2020

Could you check if this is an SELinux issue? setenforce 0?
Could this be seccomp blocking it?

@mheon
Copy link
Member

mheon commented Feb 6, 2020

Does minikube have file capabilities? That could conflict with no new privileges

@medyagh
Copy link
Author

medyagh commented Feb 7, 2020

interestingly it only has this issue in /var/lib folder but if I move it to /usr/local/bin I can execute it !

@rhatdan
Copy link
Member

rhatdan commented Feb 7, 2020

Is /var/lib directory mounted with the noexec option?

@mheon
Copy link
Member

mheon commented Feb 7, 2020

Can you run mount in the container and provide the output?

@mheon
Copy link
Member

mheon commented Feb 7, 2020

I think this is probably a volume mount of /var or /var/lib - you may need to add the exec option onto the volume mount

@medyagh
Copy link
Author

medyagh commented Feb 7, 2020

@mheon you are right ! for anyone having same issue
this fixed my problem

 mount -o remount,exec /var

I am just curious why same image and same container doesnt act same way on docker and podman

@mheon
Copy link
Member

mheon commented Feb 8, 2020

Our volume mounts are, by default, mounted noexec,nodev,nosuid for security; Docker does not do this. You can append the exec option to mounts if you need it; podman run -v /var:/var:exec for example.

@medyagh
Copy link
Author

medyagh commented Feb 8, 2020

@mheon thank you very much for clarifying it ! it makes sense now ! I consider this issue closed for me, but I also recommend adding this to your website documentation for others

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

4 participants