[lxc-users] Access /dev/mem in lxc

Ganesh Sathyanarayanan ganesh.sathyanarayanan at gmail.com
Thu Apr 27 07:49:22 UTC 2017


Hi All,

This is similar to a post by a John sometime in Aug-2010. He was trying to
run Xorg in an lxc which required access to /dev/mem. Am trying to run a
custom/proprietary application that needs the same (access to /dev/mem).

I have a privileged container - as in I've created the container as root on
my device and start it as root. (root is the usually only user on embedded
devices, unlike PC)
I have been trying to ‘expose’ the /dev/mem device to my container because
the application I run there needs it.
However, am unable to do so - I always end up with a “Operation not
permitted” error when I try to open /dev/mem. The following are the
different things I tried
1) lxc-cgroup.devices.allow = c 1 1 in the conf file (and doing a "mknod
/dev/mem c 1 1" on the container)
2) lxc-device -n <name> -- add /dev/mem to a running container (this causes
/dev/mem to appear in the container without having to run any extra
commands such as mknod. But opening it still fails)
3) lxc.aa_profile = unconfined (along with steps 1 & 2)

Please advise what I can do to make /dev/mem accessible in lxc. A simple
test am doing prior to running my actual application, is something like
"head /dev/mem" in the container and check that it displays anything (other
than Operation not permitted error).

Thank you very much.

Ganesh S.
ps: Since this is my first mail to this group, please excuse if something
is not right
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170427/969d7b4d/attachment.html>


More information about the lxc-users mailing list