[libvirt-users] Connection from host to lxc container dbus

Piotr Bartosiewicz p.bartosiewi at partner.samsung.com
Wed Feb 12 11:30:06 UTC 2014


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




More information about the libvirt-users mailing list