On Wed, Nov 20, 2013 at 05:28:29PM +0530, Aarti Sawant wrote:
Hello,
I am starting the system container without "/" directory So that it can
share the host /bin /sbin /lib and /lib64 and i have sepeartely mounted
/var, /etc and /usr directory for the container
Below is xml file
<domain type='lxc'>
<name>test6</name>
<memory>102400</memory>
<os>
<type>exe</type>
<init>/sbin/init</init>
Ok, so you're starting a real "init" process. By default this
won't respond to any input on the console. You need to make
sure that your init system is setup to start a mingtty process
on the console.
Typically if you're trying to share the '/' diretory between
the host & container though, you don't want to run a full
"init" system. Instead you'd want to just run a specific
application binary instead. In fact I'd go as far to
recommend against running 'init' if you're sharing '/'.
That said, I see you're setting up private /etc & /var
so you should be mostly OK from a writable file clash
POV.
If you want a full OS container installed to a new location
though, I've got a guide for this
https://www.berrange.com/posts/2013/08/12/running-a-full-fedora-os-inside...
</os>
<vcpu>1</vcpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<console type='pty'/>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<filesystem type='mount' accessmode='passthrough'>
<source dir='/lxc/test6/etc'/>
<target dir='/etc'/>
</filesystem>
<filesystem type='mount' accessmode='passthrough'>
<source dir='/lxc/test6/var'/>
<target dir='/var'/>
</filesystem>
<filesystem type='mount' accessmode='passthrough'>
<source dir='/lxc/test6/usr'/>
<target dir='/usr'/>
</filesystem>
<filesystem type='mount' accessmode='passthrough'>
<source dir='/pg_data/'/>
<target dir='/pg_data'/>
</filesystem>
<filesystem type='ram' accessmode='passthrough'>
<source usage='0' units='KiB'/>
<target dir='/dev/shm'/>
</filesystem>
<interface type='bridge'>
<source bridge='br0' />
</interface>
</devices>
</domain>
when i start the container it get start , but when i try to access console
it get stuck
Basically you need to see why the mingetty processes aren't being
started. On F19 with systemd, it should all 'just work' from a
console POV, aside from needing to edit /etc/securetty to allow
root login per my blog above.
virsh # list
Id Name State
----------------------------------------------------
18238 test4 running
20435 test6 running
virsh #
virsh # start test6
Domain test6 started
virsh # console test6
Connected to domain test6
Escape character is ^]
But when i mount the "/" in xml it works, i have also share host
/bin,/sbin, /lib and /lib64.
That should not make any difference, at least with a fairly
recent libvirt. If you don't have any <filesystem> listed
with a target of '/', then libvirt will secretly add one
using source=/ and target=/.
You don't mention what version of libvirt / kernel, or host
OS you have here btw. That would be generally useful info
for troubleshooting this.
Regards,
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 :|