Piotr Bartosiewicz
2014-Feb-12 10:33 UTC
[libvirt-users] Connection from host to lxc container dbus
Hi, I am unsuccessfully trying to connect from host to containers dbus. Inside container dbus socket file is visible as /run/dbus/system_bus_socket. The problem is that /run is mounted as tmpfs in container (by systemd on container) and thus the directory content is not visible outside the container. Is there any way to make this file visible also outside the container? Regards, Piotrek
Daniel P. Berrange
2014-Feb-12 10:37 UTC
Re: [libvirt-users] Connection from host to lxc container dbus
On Wed, Feb 12, 2014 at 11:33:07AM +0100, Piotr Bartosiewicz wrote:> Hi, > > I am unsuccessfully trying to connect from host to containers dbus. > Inside container dbus socket file is visible as /run/dbus/system_bus_socket. > The problem is that /run is mounted as tmpfs in container (by > systemd on container) and thus the directory content is not visible > outside the container. > Is there any way to make this file visible also outside the container?Is systemd itself setting up the /run tmpfs or have you got libvirt doing that ? If the former, you can can switch to making libvirt do it and then add in the dbus mount too eg something like this: <filesystem type="ram"> <source usage="1024"/> <target dir="/run"/> </filesystem> <filesystem type="mount"> <source dir="/run/dbus"/> <target dir="/run/dbus"/> </filesystem> Alternatively just use a single mount <filesystem type="mount"> <source dir="/run/dbus"/> <target dir="/some/where/else"/> </filesystem> and then inside the container startup do 'mount --bind /some/where/else /run/dbus" Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Piotr Bartosiewicz
2014-Feb-12 11:30 UTC
Re: [libvirt-users] Connection from host to lxc container dbus
On 12.02.2014 11:37, Daniel P. Berrange wrote:> On Wed, Feb 12, 2014 at 11:33:07AM +0100, Piotr Bartosiewicz wrote: >> Hi, >> >> I am unsuccessfully trying to connect from host to containers dbus. >> Inside container dbus socket file is visible as /run/dbus/system_bus_socket. >> The problem is that /run is mounted as tmpfs in container (by >> systemd on container) and thus the directory content is not visible >> outside the container. >> Is there any way to make this file visible also outside the container? > Is systemd itself setting up the /run tmpfs or have you got libvirt > doing that ? If the former, you can can switch to making libvirt do > it and then add in the dbus mount too eg something like this: > > <filesystem type="ram"> > <source usage="1024"/> > <target dir="/run"/> > </filesystem> > <filesystem type="mount"> > <source dir="/run/dbus"/> > <target dir="/run/dbus"/> > </filesystem> > > > Alternatively just use a single mount > > <filesystem type="mount"> > <source dir="/run/dbus"/> > <target dir="/some/where/else"/> > </filesystem> > > and then inside the container startup do 'mount --bind /some/where/else /run/dbus"I am not trying to connect hosts dbus to container dbus but program on host to dbus on container. Systemd is setting up /run by itself, but only if /run does not exist, so your trick works, thanks a lot! mkdir /container1_run mount tmpfs /container1_run -t tmpfs <filesystem type='mount'> <source dir='/container1_run'/> <target dir='/run'/> </filesystem> Piotrek