Bug 1730773 - podman with privileged doesn't provide access to /dev/kvm
Summary: podman with privileged doesn't provide access to /dev/kvm
Alias: None
Product: Fedora
Classification: Fedora
Component: podman
Version: 30
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Giuseppe Scrivano
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2019-07-17 15:05 UTC by Bruno Goncalves
Modified: 2020-05-26 18:06 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-05-26 18:06:34 UTC
Type: Bug

Attachments (Terms of Use)

Description Bruno Goncalves 2019-07-17 15:05:43 UTC
Description of problem:
As regular user running a Fedora container in privileged mode doesn't provide access to /dev/kvm.

If I run podman as root I can access /dev/kvm in the container.

I don't know if this behaviour is expected or not, but I couldn't find this information in the man page.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. As regular user start a privileged container and check if /dev/kvm exists
$ podman run --rm -t -i --privileged fedora:latest
[root@468d59237c82 /]# ls /dev/kvm
ls: cannot access '/dev/kvm': No such file or directory

2. As root run the same command
# podman run --rm -t -i --privileged fedora:latest
[root@c2e4cad85191 /]# ls /dev/kvm

Actual results:
ls: cannot access '/dev/kvm': No such file or directory

Expected results:
I'm not sure if this is expected or not, if it is maybe this information should be added to the man pages, otherwise I'd expect /dev/kvm to exist in the container.

Comment 1 Matthew Heon 2019-07-17 15:30:17 UTC
Running Podman as a normal user runs with no privileges that the user running does not have. Even --privileged does not change this - it simply restores more of the privileges the user normally has, loosening restrictions on accessing the host system (but still with the privileges of the user running Podman).

If the user running Podman does not have access to /dev/kvm, Podman can't do anything about that - the privileges for the device node will still prevent us from accessing it. I suspect that's what's happening here.

You're correct that this is poorly documented, though. We need to work on that.

Comment 2 Daniel Walsh 2019-07-17 23:58:50 UTC
I actually think this is a bug in podman.

 podman run --privileged fedora ls /dev

Shows just the limited devices, while as root shows all of the devices.

Rootless Podman should basically bind mount all of the devices from /dev into the container.

 ls -l /dev/kvm
crw-rw-rw-. 1 root kvm 10, 232 Jul 17 11:09 /dev/kvm

Is accessible by the user.

Comment 3 Daniel Walsh 2019-07-17 23:59:19 UTC
Giuseppe could you look at this?

Comment 4 Giuseppe Scrivano 2019-07-18 09:42:13 UTC
PR opened here: https://github.com/containers/libpod/pull/3593

Comment 5 Ben Cotton 2020-04-30 20:35:11 UTC
This message is a reminder that Fedora 30 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '30'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 30 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 6 Ben Cotton 2020-05-26 18:06:34 UTC
Fedora 30 changed to end-of-life (EOL) status on 2020-05-26. Fedora 30 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.