[lxc-users] Can we run a container from ramfs?

Qiang Huang h.huangqiang at huawei.com
Mon Dec 16 02:12:32 UTC 2013


I'll give it a try.
Thanks all!

Best wishes~

On 2013/12/15 1:16, Stéphane Graber wrote:
> Hi,
> 
> There are also two scripts I'm using for the Android port that can be useful:
> http://bazaar.launchpad.net/~ubuntu-lxc/lxc/android-build-scripts/files
> 
> On Android (ramfs), I'd start a container by using that run-lxc wrapper
> which will then source prepare.sh which will in turn prepare a "fake"
> environment that we can pivot_root to.
> 
> The trick is basically to create a new directory on a non-ramfs mount
> point, then bind-mount all the bits you need, then chroot to that
> directory and run LXC from it.
> 
> On Sat, Dec 14, 2013 at 01:08:09PM +0000, Cal Leeming [Simplicity Media Ltd] wrote:
>> Seems there's a few discussions about ramfs and pivot [1], and apparently
>> it's unsupported [2].
>>
>> As a workaround you could try to place overlayfs on top of your ramfs [3],
>> you'd then place both your lower and upper dir on ramfs - YMMV.
>>
>> Others may chime in with a different workaround, as I'm not sure if this
>> would be the best way.
>>
>> Hope this helps
>>
>> Cal
>>
>> [1] https://www.google.co.uk/search?q=pivot_root+tmpfs
>> [2] http://www.slax.org/blog/18438-initramfs-pivot-root-solution.html
>> [3] http://askubuntu.com/questions/109413/how-do-i-use-overlayfs
>>
>>
>>
>>
>>
>> On Sat, Dec 14, 2013 at 7:18 AM, Qiang Huang <h.huangqiang at huawei.com>wrote:
>>
>>> Hi guys,
>>>
>>> I was trying to run a container from ramfs, to root filesystem is
>>> rootfs(ramfs), the template is put onto a mounted disk whose fs is
>>> ext3, and I got this error(I'll skip my config and version and os
>>> and so on, I think they are not keys):
>>> ...
>>> lxc-start 1386999058.944 DEBUG    lxc_conf - mountpoint for old rootfs is
>>> '/usr/local/lib/lxc/rootfs/lxc_putold'
>>> lxc-start 1386999058.944 ERROR    lxc_conf - Invalid argument - pivot_root
>>> syscall failed
>>> lxc-start 1386999058.944 ERROR    lxc_conf - failed to setup pivot root
>>> lxc-start 1386999058.944 ERROR    lxc_conf - failed to set rootfs for
>>> 'hq91'
>>> lxc-start 1386999058.944 ERROR    lxc_start - failed to setup the container
>>> lxc-start 1386999058.944 ERROR    lxc_sync - invalid sequence number 1.
>>> expected 2
>>> lxc-start 1386999058.952 ERROR    lxc_start - failed to spawn 'hq91'
>>>
>>> I dug and figured out that pivot_root has some limitations with ramfs,
>>> So is it possible to run a container from ramfs? And how can we do that?
>>>
>>> Any comments are appreciated.
>>>
>>>
>>>





More information about the lxc-users mailing list