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

latest podman injects nodev for / by default, breaking e.g. mock #1303

Closed
cgwalters opened this issue Aug 20, 2018 · 18 comments
Closed

latest podman injects nodev for / by default, breaking e.g. mock #1303

cgwalters opened this issue Aug 20, 2018 · 18 comments
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@cgwalters
Copy link
Contributor

cgwalters commented Aug 20, 2018

# rpm-ostree status -b
State: idle
AutomaticUpdates: ex-stage; rpm-ostreed-automatic.timer: last run 19h ago
Deployments:
● ostree://fedora-atomic:fedora/28/x86_64/workstation
                   Version: 28.20180818.0 (2018-08-19 00:37:14)
                BaseCommit: 779dfb76fbec73853917d4259ada8f9657a9cb8ab5642880cc7386e5ca4b0d87
           LayeredPackages: emacs ffmpeg-libs fuse-sshfs git-evtag keepassx krb5-workstation libvirt-client mozilla-openh264 oci-kvm-hook opensc origin-clients pcsc-lite-ccid strace stratisd tmux virt-manager
                            xsel ykclient ykpers
# rpm -q podman
podman-0.8.2.1-1.gitf38eb4f.fc28.x86_64
# podman run --rm -ti registry.fedoraproject.org/fedora:28 /bin/sh -c 'mknod mynull c 1 3; echo foo > mynull'
/bin/sh: mynull: Permission denied
# rpm -q docker
docker-1.13.1-61.git9cb56fd.fc28.x86_64
# docker run --rm -ti registry.fedoraproject.org/fedora:28 /bin/sh -c 'mknod mynull c 1 3; echo foo > mynull'
# 

(In a quick test I failed to downgrade to https://koji.fedoraproject.org/koji/buildinfo?buildID=1133743 due to conmon, but trying the latest version in FAH28...)

# rpm -q podman
podman-0.7.2-2.git4ca4c5f.fc28.x86_64

The above works fine.

This specifically breaks running mock inside podman.

@mheon
Copy link
Member

mheon commented Aug 20, 2018

Can you add --cgroup-manager=cgroupfs to the 0.8.2.1 command line and see if it works with that?

@mheon
Copy link
Member

mheon commented Aug 20, 2018

This is probably a result of our swap to systemd cgroup management in 0.8.2.1. Will need to look into why this is prohibiting this.

@mheon
Copy link
Member

mheon commented Aug 20, 2018

While attempting to reproduce, I caused conmon to dump core. So that's also not good.

@mheon mheon added the bug label Aug 20, 2018
@mheon
Copy link
Member

mheon commented Aug 20, 2018

conmon coredump is just on one VM, so that's probably just my environment. Can repro locally on my laptop.

@mheon
Copy link
Member

mheon commented Aug 20, 2018

It's not cgroupfs, it's not SELinux. Hm.

@mheon
Copy link
Member

mheon commented Aug 20, 2018

Has to be the devices cgroup. We don't deliberately set anything related to said CGroup, though.

@cgwalters
Copy link
Contributor Author

The mystery deepens. To avoid mutating my desktop too much I've been doing some testing in a FAH28 VM, and 20180804.0 works, but 20180820.0 fails.

[root@localhost ~]# rpm-ostree status
State: idle; auto updates disabled
Deployments:
● ostree://fedora-atomic:fedora/28/x86_64/atomic-host
                   Version: 28.20180804.0 (2018-08-04 19:52:51)
                    Commit: 5633f5b369b166d104720a4da31da1ac6b5e3c0de5c5bae70cb40a850dede502
              GPGSignature: Valid signature by 128CF232A9371991C8A65695E08E7E629DB62FB1

  ostree://fedora-atomic:fedora/28/x86_64/updates/atomic-host
                   Version: 28.20180820.0 (2018-08-20 15:01:12)
                    Commit: df00137bba689acca6240667475eab9e6fbf539ccfa03ad55022faaf10e71433
              GPGSignature: Valid signature by 128CF232A9371991C8A65695E08E7E629DB62FB1

Now here's the thing...if I ostree admin unlock starting from 04 and then install rpm -Uvh podman-0.8.2.1-1.gitf38eb4f.fc28.x86_64.rpm - it works.

Other notable changes:

  runc 2:1.0.0-36.gitad0f525.fc28 -> 2:1.0.0-46.dev.gitb4e2ecb.fc28
  kernel 4.17.11-200.fc28 -> 4.17.14-202.fc28
  kernel-core 4.17.11-200.fc28 -> 4.17.14-202.fc28
  kernel-modules 4.17.11-200.fc28 -> 4.17.14-202.fc28

I just tried updating runc and it works too. I wonder if it's actually the kernel...testing that theory now.

@cgwalters
Copy link
Contributor Author

cgwalters commented Aug 20, 2018

Ah hah 🔍.

[root@localhost ~]# rpm -q podman
podman-0.7.4-4.git80612fb.fc28.x86_64
[root@localhost ~]# podman run --rm -ti registry.fedoraproject.org/fedora:28 findmnt -o OPTIONS /
OPTIONS
rw,relatime,context="system_u:object_r:container_file_t:s0:c588,c594",lowerdir=/var/lib/containers/storage/overlay/l/QLZYS6RMMTBNCA5MKINHFG5ZU2,upperdir=/var/lib/containers/storage/overlay/2534e74abbc639850f02b7
[root@localhost ~]# 

...

[root@localhost ~]# rpm -q podman
podman-0.8.2.1-1.gitf38eb4f.fc28.x86_64
[root@localhost ~]# podman run --rm -ti registry.fedoraproject.org/fedora:28 findmnt -o OPTIONS /
OPTIONS
rw,nodev,relatime,context="system_u:object_r:container_file_t:s0:c120,c503",lowerdir=/var/lib/containers/storage/overlay/l/QLZYS6RMMTBNCA5MKINHFG5ZU2,upperdir=/var/lib/containers/storage/overlay/b873c28ab4a7d1e8

@cgwalters
Copy link
Contributor Author

Note the nodev.

@cgwalters cgwalters changed the title regression in device cgroup latest podman injects nodev for / by default, breaking e.g. mock Aug 20, 2018
@mheon
Copy link
Member

mheon commented Aug 20, 2018

...But why are we allowed to mknod then? I would expect that mknod would be the command to break, not subsequent accesses to said node. I suppose that's a kernel semantics problem, though.

@mheon
Copy link
Member

mheon commented Aug 20, 2018

This looks like https://github.com/containers/storage/blob/956a1971694f18fd602b1203c0a2d192e2cc88a1/storage.conf#L35-L36 - added by @rhatdan a month ago.

@cgwalters Can you change storage.conf to remove the nodev and see if that fixes matters?

@rhatdan Can we make this toggle-able per-container?

@cgwalters
Copy link
Contributor Author

I briefly tried to find out which git commit in podman started injecting nodev but I don't know the code well enough.

However, now that I know the root cause, since today practically speaking recursive containers need --privileged, it's a simple matter of mount -o remount,dev / in my dev container.

@cgwalters
Copy link
Contributor Author

I think probably the storage conf shouldn't have default mount flags. Rather, podman could inject nodev if the container isn't --privileged?

@cgwalters
Copy link
Contributor Author

containers/storage#208

@cgwalters
Copy link
Contributor Author

Also a side note, now that I understand the root cause, my failure to bisect it comes down to not noticing that containers-common changed, and that's the thing that has the storage config.

@jlebon
Copy link
Contributor

jlebon commented Oct 26, 2018

Somehow only hit this now myself and took me some time to figure it out. I would definitely expect podman --privileged to not have this restriction here.

@rhatdan
Copy link
Member

rhatdan commented Oct 26, 2018

Slowly working my way back to this. We really need to be able to disable some options for containers/storage at container create time. I have been distracted by other tasks though.

owtaylor added a commit to owtaylor/fedora-packager-container that referenced this issue Dec 3, 2018
F29 podman ends up with nodev in the mount options for a --privileged
container, which keeps mock from working properly.

See containers/podman#1303
@rhatdan
Copy link
Member

rhatdan commented Dec 22, 2018

This should be fixed in latest podman.

@rhatdan rhatdan closed this as completed Dec 22, 2018
@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 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 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