Closed tnk4on closed 9 months ago
Did you try to add :Z
to the volume? The machine has selinux enabled so it needs the right labels.
Thanks for the advice! The results are as follows.
In qemu I get an error with :Z
and the file is not created.
% podman run --rm -v $PWD:$PWD:Z -w $PWD ubi9/ubi touch test.txt;ls -ld test.txt
Error: preparing container 54b3a4934d05ead16381bd9957af9efe1666ae09ee0194074d579caa07b605da for attach: lsetxattr /Users/shtanaka/tmp/test: operation not supported
ls: test.txt: No such file or directory
% podman machine ssh
$ ls -lZd /Users/shtanaka/tmp/test
drwxr-xr-x. 2 core games system_u:object_r:nfs_t:s0 64 Jan 4 00:23 /Users/shtanaka/tmp/test
Also, in applehv, I get a Permission denied
error, but the file is successfully created.
% podman run --rm -v $PWD:$PWD:Z -w $PWD ubi9/ubi touch test.txt;ls -ld test.txt
touch: cannot touch 'test.txt': Permission denied
-rw-r--r-- 1 shtanaka staff 0 1 4 00:26 test.txt
% podman machine ssh
$ ls -ldZ /Users/shtanaka/tmp/test
drwxr-xr-x. 3 core core system_u:object_r:container_file_t:s0:c517,c931 96 Jan 4 00:26 /Users/shtanaka/tmp/test
In applehv, there is no consistency between the error message and the actual behavior. However, I was surprised because I thought relabeling was not available on macOS !
relabelling is not available with 9p which is used with qemu, for applehv we switched to the much better performing virtiofs which apparently supports xattrs so labelling works correctly.
https://github.com/containers/podman/pull/20746 changed the code to no longer report an error when :Z
is given for file systems that do not support selinux labelling. So going forward it should be safe to always use :Z
as with qemu it would juts be ignored. This change would land in 5.0 or maybe even 4.9.
Reach here with same issue. I tried the Z option but the permission error stills. That prevented my VSCode from working in created containers.
My .config/containers/containers.conf content:
[containers]
[engine]
[machine]
volumes = ["/Users:/Users:Z", "/private:/private:Z", "/var/folders:/var/folders:Z"]
provider="applehv"
[network]
[secrets]
[configmaps]
[farms]
The machine started with vfkit also suffered unresponsive trouble when try to stop or remove it. I need to kill the vfkit process from MacOS monitor. There have been issues tracking this.
the :Z
or :z
must be set one the podman run
command not for machine init
A friendly reminder that this issue had no activity for 30 days.
Issue Description
When creating a machine with
CONTAINERS_MACHINE_PROVIDER=applehv
on a macOS's Podman machine, the bind mounted directory is not available due to permission error.Steps to reproduce the issue
Describe the results you received
Describe the results you expected
podman info output
Podman in a container
No
Privileged Or Rootless
None
Upstream Latest Release
Yes
Additional environment details
Additional information
Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting