Discussion:
Ubuntu 12.04 linux-container package and init modifications
(too old to reply)
thaddeus
2012-03-06 19:17:50 UTC
Permalink
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20120306/40859438/attachment.html>
Fajar A. Nugraha
2012-03-06 19:30:24 UTC
Permalink
I have been preparing to move a bunch of dev VMs running Ubuntu 10.04 on KVM
to 12.04 on LXC after the release next month.
Do you mean you'll be using 10.04 or 12.04 inside the container?
I am currently testing with the 12.04 beta build and have had good luck
getting everything up and running. However I am still making numerous
changes to the upstart scripts to make everything start fine.
True. But you SHOULD be able to create them as additional .conf files
instead of editing existing ones.
Does anyone here have any experience with the new linux-container package in
12.04? It appears to have made many changes in an attempt to configure the
guest to start properly in LXC, however the only reason everything worked
was because the upstart failsafe-boot event was eventually emitted. It still
took a bit of work to get the system to go through the usual boot process
without failsafe needing to kick in.
My guest is a Ubuntu 12.04 rootfs generated with debootstrap. Then the
linux-container package was added. The network configuration done via that
package didn't seem to work right: the default gateway wasn't set and the
static-network-up event never fired.
Is anyone familiar with the new package in 12.04, and if it is going to be
updated before release to work out of the box? Or am I just doing it wrong?
:)
I don't know about that, sorry.

What I DO know is that my 11.04 container, with lxcguest package, that
used to work fine in 11.04 and 11.10 host, stopped working in 12.04.

Initially I tried different hacks (like editing rc-sysinit.conf,
probably what you did as well), and even try creating a conf file that
basically does "init 2". After some testing, turns out the event for
loopback interface up (which is needed by rc-sysinit) was never
emmited. In the end adding this file works:


# cat /etc/init/lxc-lo.conf
start on startup
env container

pre-start script
if [ "x$container" != "xlxc" -a "x$container" != "xlibvirt" ];
then
stop;
fi
initctl start network-interface INTERFACE=lo
exit 0;
end script


So now the modifications (both from lxcguest and my local addition)
are all new .conf files, which would be ignored if it's not started in
lxc environment. Might try 12.04 container later.
--
Fajar
Fajar A. Nugraha
2012-03-06 21:46:24 UTC
Permalink
Forwarding to the list, plus some comments.
Post by Fajar A. Nugraha
Do you mean you'll be using 10.04 or 12.04 inside the container?
I am testing 12.04 guests on a 12.04 host. Thankfully with the help of a
very complete chef installation, it won't take long to rebuild all of the
guests instead of trying to migrate them.
The issue I ran into with the linux-container package was that
networking.conf would not emit static-network-up, and also udev was still
loading. The package corrected the behavior of umountroot running on
shutdown, but an apt-get upgrade caused that script to be re-added to the
shutdown sequence.
/etc/init/networking.conf: change to just setup the gateway and emit
static-network-up
You could add /etc/init/networking.override, so further changes to
networking.conf will not affect you.
/etc/init.d/umountroot: remove body of do_stop()
Not sure about this one.
/etc/init/udev*.conf: comment out start on lines
You mean disable udev? udev.override with a single line "manual"
should do the trick.
With this done, everything seems to be working, and apt-get upgrade dosen't
break any of the changes.
Can you share your changes?

I'm creating LXC recipes on http://wiki.1tux.org/wiki/Lxc/Installation
, so far only Centos5 container is almost complete. I'll use what
you've done so far for
http://wiki.1tux.org/wiki/Lxc/Installation/Guest/Ubuntu

Thanks.

Fajar
Serge Hallyn
2012-03-07 03:45:48 UTC
Permalink
Post by Fajar A. Nugraha
# cat /etc/init/lxc-lo.conf
start on startup
env container
pre-start script
if [ "x$container" != "xlxc" -a "x$container" != "xlibvirt" ];
then
stop;
fi
initctl start network-interface INTERFACE=lo
exit 0;
end script
So now the modifications (both from lxcguest and my local addition)
are all new .conf files, which would be ignored if it's not started in
lxc environment. Might try 12.04 container later.
If your guest is uptodate 12.04, you should have

/etc/init/network-interface-container.conf

from ifupdownpackage which emits that signal for you. You shouldn't need
your own lxc-lo.conf any more.

-serge
Thaddeus Hogan
2012-03-07 03:59:06 UTC
Permalink
Post by Serge Hallyn
Post by Fajar A. Nugraha
# cat /etc/init/lxc-lo.conf
start on startup
env container
pre-start script
if [ "x$container" != "xlxc" -a "x$container" != "xlibvirt" ];
then
stop;
fi
initctl start network-interface INTERFACE=lo
exit 0;
end script
So now the modifications (both from lxcguest and my local addition)
are all new .conf files, which would be ignored if it's not started in
lxc environment. Might try 12.04 container later.
If your guest is uptodate 12.04, you should have
/etc/init/network-interface-container.conf
from ifupdownpackage which emits that signal for you. You shouldn't need
your own lxc-lo.conf any more.
-serge
Failsafe was still kicking in on an out of the box installation. I will
grab the latest daily and run through it again to verify there is a
problem and that it wasn't me.

-- Thaddeus
Fajar A. Nugraha
2012-03-07 04:03:07 UTC
Permalink
On Wed, Mar 7, 2012 at 10:45 AM, Serge Hallyn
Post by Serge Hallyn
Post by Fajar A. Nugraha
# cat /etc/init/lxc-lo.conf
start on startup
env container
pre-start script
? ? ? ? if [ "x$container" != "xlxc" -a "x$container" != "xlibvirt" ];
then
? ? ? ? ? ? ? ? stop;
? ? ? ? fi
? ? ? ? initctl start network-interface INTERFACE=lo
? ? ? ? exit 0;
end script
So now the modifications (both from lxcguest and my local addition)
are all new .conf files, which would be ignored if it's not started in
lxc environment. Might try 12.04 container later.
If your guest is uptodate 12.04, you should have
/etc/init/network-interface-container.conf
from ifupdownpackage which emits that signal for you. ?You shouldn't need
your own lxc-lo.conf any more.
What is Canonical's plan for older guests? Will
network-interface-container.conf be backported to lxc-guest, or will
manual configuration still necessary?
--
Fajar
Stéphane Graber
2012-03-07 18:16:39 UTC
Permalink
Post by Fajar A. Nugraha
On Wed, Mar 7, 2012 at 10:45 AM, Serge Hallyn
Post by Serge Hallyn
# cat /etc/init/lxc-lo.conf start on startup env container
pre-start script if [ "x$container" != "xlxc" -a "x$container"
!= "xlibvirt" ]; then stop; fi initctl start network-interface
INTERFACE=lo exit 0; end script
So now the modifications (both from lxcguest and my local
addition) are all new .conf files, which would be ignored if
it's not started in lxc environment. Might try 12.04 container
later.
If your guest is uptodate 12.04, you should have
/etc/init/network-interface-container.conf
from ifupdownpackage which emits that signal for you. You
shouldn't need your own lxc-lo.conf any more.
What is Canonical's plan for older guests? Will
network-interface-container.conf be backported to lxc-guest, or
will manual configuration still necessary?
Starting in 12.04 we did the necessary changes to upstart, udev,
mountall, ifupdown, ... to be container aware. For older releases our
template still installs lxcguest that does a similar job though a bit
more hackish :)

As Serge said, if anything doesn't start for you with a clean 12.04
container running on 12.04, it's a bug and we want to fix it.

My goal for 12.04 was to make a perfectly clean and standard Ubuntu
system work in a container without any change whatsoever and I think
we achieved this:
http://www.stgraber.org/2012/03/04/booting-an-ubuntu-12-04-virtual-machine-in-an-lxc-container/


If you're writing custom upstart jobs or other scripts, you may be
interested by the new events and tools we introduced on all Ubuntu
systems since 12.04:
- The upstart "container" event giving you CONTAINER=technology
- The upstart "not-container" event
- /bin/running-in-container that will exit 0 in a container and exit
1 otherwise, even it exits 0 it'll also print the technology.

I added code to upstart to detect (referred above as "technology"):
- lxc
- lxc-libvirt
- openvz
- vserver

Though we only really support lxc and lxc-libvirt, the rest is best
effort and we expect people to give us patches or access to a machine.

This means the upstart job below is now possible:
start on container CONTAINER=lxc
exec /usr/sbin/my-lxc-monitoring-service


I hope this helped explain what we're doing in 12.04.
I'm planning on a generic "what's new in LXC for 12.04" blog post in
the next few days, once we've turned apparmor back on and have
somewhat secure containers again (hopefully later today).

Again, please try an up to date Ubuntu 12.04 system and report any bug
that you see, we're trying to closely look at LXC bugs and fix them as
soon as possible.

Cheers

- --
St?phane Graber
Ubuntu developer
http://www.ubuntu.com
Thaddeus Hogan
2012-03-08 03:27:30 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Post by Fajar A. Nugraha
On Wed, Mar 7, 2012 at 10:45 AM, Serge Hallyn
Post by Serge Hallyn
# cat /etc/init/lxc-lo.conf start on startup env container
pre-start script if [ "x$container" != "xlxc" -a "x$container"
!= "xlibvirt" ]; then stop; fi initctl start network-interface
INTERFACE=lo exit 0; end script
So now the modifications (both from lxcguest and my local
addition) are all new .conf files, which would be ignored if
it's not started in lxc environment. Might try 12.04 container
later.
If your guest is uptodate 12.04, you should have
/etc/init/network-interface-container.conf
from ifupdownpackage which emits that signal for you. You
shouldn't need your own lxc-lo.conf any more.
What is Canonical's plan for older guests? Will
network-interface-container.conf be backported to lxc-guest, or
will manual configuration still necessary?
Starting in 12.04 we did the necessary changes to upstart, udev,
mountall, ifupdown, ... to be container aware. For older releases our
template still installs lxcguest that does a similar job though a bit
more hackish :)
As Serge said, if anything doesn't start for you with a clean 12.04
container running on 12.04, it's a bug and we want to fix it.
My goal for 12.04 was to make a perfectly clean and standard Ubuntu
system work in a container without any change whatsoever and I think
http://www.stgraber.org/2012/03/04/booting-an-ubuntu-12-04-virtual-machine-in-an-lxc-container/
If you're writing custom upstart jobs or other scripts, you may be
interested by the new events and tools we introduced on all Ubuntu
- The upstart "container" event giving you CONTAINER=technology
- The upstart "not-container" event
- /bin/running-in-container that will exit 0 in a container and exit
1 otherwise, even it exits 0 it'll also print the technology.
- lxc
- lxc-libvirt
- openvz
- vserver
Though we only really support lxc and lxc-libvirt, the rest is best
effort and we expect people to give us patches or access to a machine.
start on container CONTAINER=lxc
exec /usr/sbin/my-lxc-monitoring-service
I hope this helped explain what we're doing in 12.04.
I'm planning on a generic "what's new in LXC for 12.04" blog post in
the next few days, once we've turned apparmor back on and have
somewhat secure containers again (hopefully later today).
Again, please try an up to date Ubuntu 12.04 system and report any bug
that you see, we're trying to closely look at LXC bugs and fix them as
soon as possible.
Cheers
- --
St?phane Graber
Ubuntu developer
http://www.ubuntu.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBCgAGBQJPV6YHAAoJEMY4l01keS1n5icP/3UfPJcrPOA1M79z+hUZT/QT
eDCZTe/6nCEsjPXn/Jt7agkXAI8S4RcK1qjYKm7IbgsvOT0IpR4OXEX3NdJDQuGo
dHHEhgQfUuRQ9ndWID0bSubum4iBMJLbzSEtZUBZ3ejmtsPX/L2qWxmT1tX+xOtd
ZJG/HmcVj78dXRXXc7rHQagljd0YZs16ZvPnO8wO6jFJlT1DsqNtATu5hUhCXNXa
X/f7c3cTZq6Ig9HGawJRjIAjlbpoww+YgqfoduKEjEuOrLDDrBexm3AwwSRFOAMn
RauTAveug0kFx3SHIRGw7EHZ5w9TOBHtXyfYAek3Sna8N5CEPozZ2V6gQocGQiuX
Q6Qq8mB9xZMAekB2xnmYeBVf3DcjkNOb1h7wg6u6WunEGDHGR+jwOM25g+c2EEW8
1mNFc61TMfp+4GFh3djnI8i9CqMNJX7olPCgDcULuglqYx4eFYJGN8p5P1G4DhLk
0VETCuJywEYoLa/5xlCveqPg6nMfddgLX3bo3ELD3zKmyNifjwuh9j7Xx1RCmNIO
D1Ga8l9MPKv0x0dI6bnbQRbq1v0kH84ZZXZrdZb+P2XYnIGZk2fXIzedj7CUDoZ9
dMmcAaJRG3znHBckL/1I4RjZgxyUB6CdtPPn4naMeWcdkX5zpumFEc8T/jn+xsOj
DBjf6BATJV595nPVzAF0
=kV4d
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
Virtualization& Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Lxc-users mailing list
Lxc-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-users
I used the ubuntu template with lxc-create instead of running
debootstrap myself. Now everything works as expected when I start the
guest. Thanks!

-- Thaddeus
Kaj Wiik
2012-03-15 16:37:16 UTC
Permalink
Hi!
Post by Stéphane Graber
My goal for 12.04 was to make a perfectly clean and standard Ubuntu
system work in a container without any change whatsoever and I think
http://www.stgraber.org/2012/03/04/booting-an-ubuntu-12-04-virtual-machine-in-an-lxc-container/
I built a container by following the instructions in St?phane's page
and everything seemed to work very well (well, I had to remove & pin
kernel packages and friendly-recovery) but now I am stuck with
installation of cups.

Here's the error message:
"A package failed to install. Trying to recover:
Setting up cups (1.5.2-8) ...
apparmor_parser: Unable to replace "/usr/lib/cups/backend/cups-pdf".
Permission denied; attempted to load a profile while confined?
Warning failed to create cache: usr.sbin.cupsd
start: Job failed to start
invoke-rc.d: initscript cups, action "start" failed."

Any ideas? Has anyone managed to run cups in a container built using lxc-create?

Thanks,
Kaj
Kaj Wiik
2012-03-15 19:29:28 UTC
Permalink
Post by Kaj Wiik
Any ideas? Has anyone managed to run cups in a container built using lxc-create?
I confirm that cups works without any problem in an Ubuntu 12.04
container created using lxc-create.
(sorry to reply to myself...)

Cheers,
Kaj

Fajar A. Nugraha
2012-03-07 04:31:27 UTC
Permalink
On Wed, Mar 7, 2012 at 10:45 AM, Serge Hallyn
Post by Serge Hallyn
If your guest is uptodate 12.04, you should have
/etc/init/network-interface-container.conf
from ifupdownpackage which emits that signal for you. ?You shouldn't need
your own lxc-lo.conf any more.
Just tried it btw. Awesome.

"lxc-create -n precise -t ubuntu -- -r precise" create a container
that just works, with default user/pass ubuntu/ubuntu. And it's not
even using linux-container package, all the needed lxc-specific init
files are part of regular packages (upstart, ifupdown)
--
Fajar
Thaddeus Hogan
2012-03-07 05:06:37 UTC
Permalink
Post by Fajar A. Nugraha
On Wed, Mar 7, 2012 at 10:45 AM, Serge Hallyn
Post by Serge Hallyn
If your guest is uptodate 12.04, you should have
/etc/init/network-interface-container.conf
from ifupdownpackage which emits that signal for you. You shouldn't need
your own lxc-lo.conf any more.
Just tried it btw. Awesome.
"lxc-create -n precise -t ubuntu -- -r precise" create a container
that just works, with default user/pass ubuntu/ubuntu. And it's not
even using linux-container package, all the needed lxc-specific init
files are part of regular packages (upstart, ifupdown)
Maybe my issue was starting with a debootstrap created rootfs and not
lxc-create, which I have not tried before. I will attempt to use that
script.

-- Thaddeus
Serge Hallyn
2012-03-07 03:38:04 UTC
Permalink
I have been preparing to move a bunch of dev VMs running Ubuntu 10.04 on KVM to 12.04 on LXC after the release next month.<br />
<br />
I am currently testing with the 12.04 beta build and have had good luck getting everything up and running. However I am still making numerous changes to the upstart scripts to make everything start fine.<br />
If they are 12.04 guests, you shouldn't have to. Please file bugs
(at pad.lv/u/lxc).

thanks,
-serge
Continue reading on narkive:
Loading...