[lxc-devel] Reg: Using an ISO image as rootfs for a LXC

Daniel Lezcano daniel.lezcano at free.fr
Mon Jul 25 20:32:40 UTC 2011


On 07/25/2011 10:24 PM, Alphonse Hansel Anthony wrote:
> Hi Daniel,
>
>   I am using lxc utils (0.7.4.2).
>   In my case, I am trying to mount the rootfs.iso as "/" within the
> Container and it fails with "No such file or directory".
>
> I am just wondering if any additional options are required to make the
> mounted ISO visible across pivot_root boundaries, similar to "MS_BIND" mount
> option for files/directories.
>
> Can you copy-paste your lxc.conf file? I would like to cross verify with
> options that I had specified.

lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.utsname = lucid2

lxc.tty = 4
lxc.pts = 1024
lxc.rootfs = /var/lib/lxc/lucid2/rootfs.iso
lxc.mount  = /var/lib/lxc/lucid2/fstab

lxc.cgroup.devices.deny = a
# /dev/null and zero
lxc.cgroup.devices.allow = c 1:3 rwm
lxc.cgroup.devices.allow = c 1:5 rwm
# consoles
lxc.cgroup.devices.allow = c 5:1 rwm
lxc.cgroup.devices.allow = c 5:0 rwm
lxc.cgroup.devices.allow = c 4:0 rwm
lxc.cgroup.devices.allow = c 4:1 rwm
# /dev/{,u}random
lxc.cgroup.devices.allow = c 1:9 rwm
lxc.cgroup.devices.allow = c 1:8 rwm
lxc.cgroup.devices.allow = c 136:* rwm
lxc.cgroup.devices.allow = c 5:2 rwm
# rtc
lxc.cgroup.devices.allow = c 254:0 rwm

>     The second case that you had mentioned works for me.
>   My rootfs is a directory on the host ( /root/lxcOne )
>   Mount point for iso with rootfs (/root/lxcOne/mnt)
>   After I add the mount options in fstab, I am able to view the content in
> </root/lxcOne>/mnt
>   directory.
>
>   -Alphonse
>
>
>
> On Mon, Jul 25, 2011 at 4:04 PM, Daniel Lezcano <daniel.lezcano at free.fr>wrote:
>
>> On 07/25/2011 08:17 PM, Alphonse Hansel Anthony wrote:
>>>  Hi,
>>>   I am trying to start a LXC, with a ISO image as the rootfs.
>>>
>>> the excerpt of the mount options that I use in lxc.conf
>>>
>>> lxc.rootfs = rootfs.iso
>>> lxc.rootfs.mount = /lxc/rootfs
>>>
>>> The error that I get while I start the LXC
>>>
>>> -----
>>> lxc-start: No such file or directory - failed to exec /sbin/init
>>> lxc-start: invalid sequence number 1. expected 2
>>> lxc-start: failed to spawn 'raven'
>>> lxc-start: Device or resource busy - failed to remove cgroup
>> '/cgroup/raven'
>>> ------
>>>
>>> on closer look at the lxc-start , I found the following
>>>
>>> 1) the iso image is mounted at the specified location
>>> 2) I am also able to stat the /sbin/init file.
>>>
>>> I instrumented the code in file ${SRC_FOLDER}/src/lxc/start.c:: static
>>> int start(struct lxc_handler *handler, void* data)
>>> and I am able to stat the file /sbin/init just before execvp, but exec
>>> fails with "No such file or directory".
>>>
>>> Any help in this regard would be useful.
>> I created a ISO image and started the container. The container starts as
>> expected (but the mountall fails because the rootfs is RO.)
>> Is it possible the iso image contains an extra directory where the
>> rootfs belongs ? I mean, if you mount the iso image on a directory
>> 'mnt', you should see '/mnt/usr, /mnt/lib, ...' is it the case ?
>>
>>





More information about the lxc-devel mailing list