]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
14 years agolxc-start can output the console to a file lxc-0.7.4-rc1
Daniel Lezcano [Tue, 1 Feb 2011 13:49:40 +0000 (14:49 +0100)] 
lxc-start can output the console to a file

Add the ability to specify a file to output the console.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agolxc-0.7.4-rc1
Daniel Lezcano [Tue, 1 Feb 2011 11:55:39 +0000 (12:55 +0100)] 
lxc-0.7.4-rc1

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agotake into account new configure option --with-linuxdir
Cedric Le Goater [Fri, 21 Jan 2011 10:01:43 +0000 (11:01 +0100)] 
take into account new configure option --with-linuxdir

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
14 years agogenerate setns syscall number
Clement Calmels [Thu, 20 Jan 2011 09:59:33 +0000 (10:59 +0100)] 
generate setns syscall number

Signed-off-by: Clement Calmels <clement.calmels@fr.ibm.com>
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
14 years agolxc-attach gives a better error message
Daniel Lezcano [Tue, 1 Feb 2011 10:42:29 +0000 (11:42 +0100)] 
lxc-attach gives a better error message

Don't assume the user knows the kernel internals :)

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoFix paths in the lxc-busybox template
Daniel Lezcano [Thu, 27 Jan 2011 23:24:54 +0000 (00:24 +0100)] 
Fix paths in the lxc-busybox template

Author of the patch : Jonathan Liu <???> posted as a bug fix on the lxc
sourceforge website.

OS: Arch Linux 32-bit

/etc/init.d/rcS do not use full path to syslogd, mount and udhcpc executables.
As busybox requires /proc mounted if CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
to run these commands without full path, the full path should be used in the
startup script as /proc is mounted later in the script.

It also fails to start the machine if /lib64 does not exist on the host system
as there is a mount entry for /lib64 in the config.

The attached patch changes commands in /etc/init.d/rcS to use full path and
adds a check for /lib64 on host before adding lib64 mount entries to config.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoexport env variable in lxc_start
Daniel Lezcano [Thu, 27 Jan 2011 23:14:51 +0000 (00:14 +0100)] 
export env variable in lxc_start

Let's export the 'container' variable and let init receive it
as a kernel command line option.

In the upstart init scripts, we can distinguish if we are in a
container context or not.

===============================================================================

# /dev/console - getty
#
# This service maintains a getty on /dev/console from the point the
# system is started until it is shut down again.
# It only runs in lxc containers.

start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

env container
pre-start script
[ "x$container" != "xlxc" ] && { stop; exit 0; }
exit 0;
end script

respawn

exec /sbin/getty -8 38400 /dev/console

===============================================================================

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agosuppress udev log output
Daniel Lezcano [Sun, 23 Jan 2011 20:47:12 +0000 (21:47 +0100)] 
suppress udev log output

We use udev within these containers and we prevent the /dev files
to be created with the cgroup whitelist. So when the udevd receives
the event from the kernel, it will fail to create some nodes in /dev
and will spit error on the console.

We set the log level to zero, so udev will silently fail.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoUpdate ubuntu templates
Serge Hallyn [Sat, 22 Jan 2011 20:59:40 +0000 (21:59 +0100)] 
Update ubuntu templates

Rename 'ubuntu' template to 'lucid'

Add new maverick and natty templates, which do much less tweaking
of the environment.  These should only be used on a kernel which
supports sysfs tagging for /sys/class/net, as udev will be running
in the container.

The natty template needed to slightly change the installed packages
for dhclient to be correclty installed.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoAdds correct file capa detection for >2.6.32 The kernel compile parameter was removed...
Reto Gantenbein [Mon, 17 Jan 2011 23:45:17 +0000 (00:45 +0100)] 
Adds correct file capa detection for >2.6.32 The kernel compile parameter was removed with kernel release 2.6.33 Since then file capabilities are enabled by default kernel commit: b3a222e52e4d4be77cc4520a57af1a4a0d8222d1

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoOnly bring up network interface if IFF_UP is set
David Ward [Mon, 17 Jan 2011 09:18:50 +0000 (10:18 +0100)] 
Only bring up network interface if IFF_UP is set

Each network interface was brought up regardless of the configuration,
as the wrong boolean operator was being used to test the IFF_UP flag.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoset veth host's side always up
Daniel Lezcano [Mon, 17 Jan 2011 09:18:50 +0000 (10:18 +0100)] 
set veth host's side always up

We should always have the veth host's side up, otherwise if we omit
the up flag in the configurationn, letting the container to configure
its interface, the network will be never enabled as the host's side
is not up.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoFix mntflags initialization
Joerg Gollnick [Sun, 16 Jan 2011 18:40:46 +0000 (19:40 +0100)] 
Fix mntflags initialization

Dear all,
while setting up a container on x86_64 (archlinux host/guest) I had trouble
with mounting dev/pts and others from container.fstab and a ssh login does not
work (only ssh container bash -i gives you a shell)
The cause is that conf.c does not initialize mntflags.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd lxc-lenny template
Daniel Lezcano [Fri, 14 Jan 2011 08:51:13 +0000 (09:51 +0100)] 
add lxc-lenny template

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix clone_children path
Daniel Lezcano [Thu, 13 Jan 2011 22:45:22 +0000 (23:45 +0100)] 
fix clone_children path

This line is at the wrong place ...

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd missing template in Makefile
Daniel Lezcano [Thu, 13 Jan 2011 15:25:14 +0000 (16:25 +0100)] 
add missing template in Makefile

Missed to add lxc-lenny to the template.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix busybox inittab template
Daniel Lezcano [Thu, 13 Jan 2011 15:25:14 +0000 (16:25 +0100)] 
fix busybox inittab template

The inittab file format is wrong regarding how behaves busybox with
this syntax.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agosubstitute the absolute rootfs mount path
Daniel Lezcano [Thu, 13 Jan 2011 15:25:14 +0000 (16:25 +0100)] 
substitute the absolute rootfs mount path

Change the mount point in the rootfs because we mount the rootfs
in ROOTFSDIR for the pivot. We have to substitute the real mount
path to the new path located in ROOTFSDIR.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoencapsulate mount point code
Daniel Lezcano [Thu, 13 Jan 2011 15:25:14 +0000 (16:25 +0100)] 
encapsulate mount point code

Change the code to encapsulate the different mounts point.

 * mount on the host fs
 * mount relatively to the rootfs
 * mount absolutely to the rootfs (broken)

That will make the code cleaner to fix the latter.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agomindless changes to conform indentation
Daniel Lezcano [Thu, 13 Jan 2011 15:15:15 +0000 (16:15 +0100)] 
mindless changes to conform indentation

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoset function static
Daniel Lezcano [Thu, 13 Jan 2011 15:15:15 +0000 (16:15 +0100)] 
set function static

Set the function prototype to static as it is not exported and used
somewhere else in the code than this file.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix cgroup directory removal
Daniel Lezcano [Mon, 10 Jan 2011 16:58:32 +0000 (17:58 +0100)] 
fix cgroup directory removal

Fix the name of the directory to remove.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix the ns_cgroup vs clone_children
Daniel Lezcano [Sun, 9 Jan 2011 22:53:19 +0000 (23:53 +0100)] 
fix the ns_cgroup vs clone_children

The following patch fixes the bug where the clone_children compatibility
flag is available with the ns_cgroup subsystem. The 2.6.37 kernel version
should be the only one which is concerned by this modification, please
refer to Documentation/feature-removal-schedule.txt and look for ns_cgroup.

The problem is coming from we check for clone_children and we set it
automatically and then we try to create a new cgroup. As the
ns_cgroup is present the cgroup already exists and we are not allowed
to attach our pid to a new cgroup. The next error will be when we try
to create a new container because we enabled the clone_children flag
and the ns_cgroup is present, it is not allowed by the kernel.

The patch fix this by checking the mount options.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoCorrecting charset argument when calling locale-gen.
Daniel Baumann [Tue, 28 Dec 2010 20:32:51 +0000 (21:32 +0100)] 
Correcting charset argument when calling locale-gen.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoCorrecting include argument when calling debootstrap.
Daniel Baumann [Tue, 28 Dec 2010 20:32:51 +0000 (21:32 +0100)] 
Correcting include argument when calling debootstrap.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoDisabling unneeded checkroot.sh initscript in debian template.
Daniel Baumann [Tue, 28 Dec 2010 20:32:51 +0000 (21:32 +0100)] 
Disabling unneeded checkroot.sh initscript in debian template.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoCreating missing tty device nodes for squeeze in debian template.
Daniel Baumann [Tue, 28 Dec 2010 20:32:51 +0000 (21:32 +0100)] 
Creating missing tty device nodes for squeeze in debian template.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoSetting default mirror to cdn.debian.net in debian template.
Daniel Baumann [Tue, 28 Dec 2010 20:32:51 +0000 (21:32 +0100)] 
Setting default mirror to cdn.debian.net in debian template.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoSetting default suite to squeeze in debian template.
Daniel Baumann [Tue, 28 Dec 2010 20:32:51 +0000 (21:32 +0100)] 
Setting default suite to squeeze in debian template.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoDuplicate lxc-debian to lxc-lenny
Daniel Lezcano [Tue, 28 Dec 2010 20:32:50 +0000 (21:32 +0100)] 
Duplicate lxc-debian to lxc-lenny

Duplicate the lxc-debian template to use it as a fine grained
template.

Subject: Daniel Lezcano <dlezcano@fr.ibm.com>

14 years agouse clone_children cgroup's flag
Daniel Lezcano [Fri, 17 Dec 2010 10:43:37 +0000 (11:43 +0100)] 
use clone_children cgroup's flag

If the ns_cgroup does not exist, we use the clone_children feature.
Everytime a cgroup is created, we set this compatibility flag and we create
the cgroup manually and add the child task to the cgroup.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoMove common code to lxc_cgroup_create
Daniel Lezcano [Fri, 17 Dec 2010 10:43:37 +0000 (11:43 +0100)] 
Move common code to lxc_cgroup_create

For both the ns_cgroup and the usual cgroup creation, we have to
check if a previous does not exist and remove it if it is empty.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoencapsulate the ns_cgroup
Daniel Lezcano [Fri, 17 Dec 2010 10:43:37 +0000 (11:43 +0100)] 
encapsulate the ns_cgroup

Create a single API to create a cgroup which will switch to the old
ns_cgroup automatically.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoChange nscgroup interface
Daniel Lezcano [Fri, 17 Dec 2010 10:43:37 +0000 (11:43 +0100)] 
Change nscgroup interface

Prepare the nscgroup to be converted to the clone_children changes.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoRemove unused nscgroup field
Daniel Lezcano [Fri, 17 Dec 2010 10:43:37 +0000 (11:43 +0100)] 
Remove unused nscgroup field

This field is unused.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoremove duplicate cgroup header
Daniel Lezcano [Fri, 17 Dec 2010 10:43:36 +0000 (11:43 +0100)] 
remove duplicate cgroup header

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoMake mount paths relative to rootfs
Michael Tokarev [Fri, 17 Dec 2010 10:43:36 +0000 (11:43 +0100)] 
Make mount paths relative to rootfs

Why not chdir into the root of container right when
the root filesystem is (bind-)mounted, and let all
mount entries to be relative to the container root?

Even more, to warn if lxc.mount[.entry] contains
absolute path for the destination directory (or a
variation of this, absolute and does not start with
container root mount point)?

This way, all mounts will look much more sane, and
it will be much easier to move/clone containers -
by changing only lxc.rootfs.

I do it this way locally since the beginning, by
chdir'ing to the proper directory (rootfs) before
running lxc-start (in a startup script), but this
is now broken in 0.7.3 which bind-mounts rootfs
somewhere in /usr/lib/lxc.

Signed-off-by: Michael Tokarev<mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd support for dirsync mount option
Sergey S. Kostyliov [Sat, 30 Oct 2010 19:41:19 +0000 (21:41 +0200)] 
add support for dirsync mount option

Add support for `dirsync' mount option. MS_DIRSYNC is on of the
mount(2) mountflags so don't send it as extra mount option to avoid:

  lxc-start: Invalid argument - failed to mount ...

errors.

Signed-off-by: Sergey S. Kostyliov <rathamahata@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoset version to 0.7.3 lxc-0.7.3
Daniel Lezcano [Tue, 26 Oct 2010 16:14:47 +0000 (18:14 +0200)] 
set version to 0.7.3

Version 0.7.3

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
14 years agoupdate the man page with the net script hook
Daniel Lezcano [Tue, 26 Oct 2010 16:14:47 +0000 (18:14 +0200)] 
update the man page with the net script hook

Update the man page wrt the hook script added for the host side
network configuration.

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
14 years agofix multiple console for a container
Daniel Lezcano [Tue, 26 Oct 2010 15:42:38 +0000 (17:42 +0200)] 
fix multiple console for a container

Don't close the socket when we ask for a console, otherwise this will
make the console slot to be freed, so the next console will use the same
slot leading to an erratic behavior.

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
14 years agodon't play with the capabilities when we are root
Daniel Lezcano [Tue, 26 Oct 2010 15:42:37 +0000 (17:42 +0200)] 
don't play with the capabilities when we are root

We don't want to drop the capabilities when we are root because that
leads to some problems. For exemple, sudo lxc-start -n foo -o $(tty) fails with
"permission denied".

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
14 years agoFix compilation error on fc12
Daniel Lezcano [Tue, 12 Oct 2010 13:11:45 +0000 (15:11 +0200)] 
Fix compilation error on fc12

The capability header makes the inclusion of the loop header to
fail. Moving the inclusion of loop.h before capability.h fixes the
problem.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoFix compilation warning
Daniel Lezcano [Tue, 12 Oct 2010 13:11:45 +0000 (15:11 +0200)] 
Fix compilation warning

Fix some compilation warnings:
 * include caps.h in lxc_checkpoint and lxc_restart
 * check the return of the timer notification read

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoreduce function name
Daniel Lezcano [Tue, 12 Oct 2010 12:57:57 +0000 (14:57 +0200)] 
reduce function name

Cosmetic change by reducing the function names.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse popen and redirect script output
Daniel Lezcano [Tue, 12 Oct 2010 08:52:47 +0000 (10:52 +0200)] 
use popen and redirect script output

Change the run_script function to use popen and to redirect
the output of the script to the log file.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agofix Coding Style
Daniel Lezcano [Tue, 12 Oct 2010 08:52:47 +0000 (10:52 +0200)] 
fix Coding Style

Fix the coding style, 80 chars lines, etc ...
Fix indentation blocks if ... then ... else ... fi

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd lxc.network.script.up configuration hook
Stefan Tomanek [Tue, 12 Oct 2010 08:52:47 +0000 (10:52 +0200)] 
add lxc.network.script.up configuration hook

This commit adds an configuration option to specify a script to be
executed after creating and configuring the network used by the
container. The following arguments are passed to the script:

* container name
* config section name (net)

Additional arguments depend on the config section employing a
script hook; the following are used by the network system:

* execution context (up)
* network type (empty/veth/macvlan/phys)

Depending on the network type, other arguments may be passed:

veth/macvlan/phys:
* (host-sided) device name

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoupdate the lxc.conf man page
Daniel Lezcano [Tue, 5 Oct 2010 08:28:31 +0000 (10:28 +0200)] 
update the lxc.conf man page

Update the man page regarding the image or block device
supported as a rootfs.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoallow to specify a image or a device block as rootfs
Daniel Lezcano [Sun, 3 Oct 2010 21:09:36 +0000 (23:09 +0200)] 
allow to specify a image or a device block as rootfs

This patch allows to specify an image or a block device.

The image or the block device is mounted on rootfs->mount.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoadd rootfs mount dir variable to pkg-config
Daniel Lezcano [Sun, 3 Oct 2010 21:09:36 +0000 (23:09 +0200)] 
add rootfs mount dir variable to pkg-config

In the case we use an image for rootfs, if we need to do extra mount
from the host to the rootfs, we have to specify the place where the
image is mounted. This value is configured by the user with the
lxc.rootfs.mount otherwise defaulting to @LXCROOTFSMOUNT@. Let's
export this variable to pkg-config, so the user can use it to build
a correct path to the rootfs.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoDon't display an error in lxc_file_for_each_line
Daniel Lezcano [Sun, 3 Oct 2010 21:09:36 +0000 (23:09 +0200)] 
Don't display an error in lxc_file_for_each_line

Don't display an error when the callback returns an error different
from zero. A value greater than zero may means "stop". Let's the caller
to check the error.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoUse container's proc to setup the utmp watching
Daniel Lezcano [Sun, 3 Oct 2010 21:09:35 +0000 (23:09 +0200)] 
Use container's proc to setup the utmp watching

The <rootfs>/var/run/utmp is located in:

/proc/<containerinit>/root/var/run/utmp, let's use it.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoInitialize default mount point
Daniel Lezcano [Sun, 3 Oct 2010 21:09:35 +0000 (23:09 +0200)] 
Initialize default mount point

Let's initialize rootfs->mount to LXCROOTFSMOUNT. The value
will be overwritten by the configuration in case it is specified.

That will make the code nicer, instead of the ugly rootfs->mount checks.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse the rootfs mount point for the tty's
Daniel Lezcano [Sun, 3 Oct 2010 21:09:35 +0000 (23:09 +0200)] 
use the rootfs mount point for the tty's

The rootfs is always located in rootfs->mount, let's use it for
the tty.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agouse the rootfs mount point for the console
Daniel Lezcano [Sun, 3 Oct 2010 21:09:35 +0000 (23:09 +0200)] 
use the rootfs mount point for the console

The rootfs is always located in the mount point now, let's
use it.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agomount the rootfs to the mount directory first
Daniel Lezcano [Sun, 3 Oct 2010 21:09:35 +0000 (23:09 +0200)] 
mount the rootfs to the mount directory first

Split the rootfs setup by mounting the rootfs to the mount
point. This mount point will be used as the facto place where
the rootfs is placed.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoimprove lxc-debian template to specify the suite
Daniel Lezcano [Fri, 1 Oct 2010 15:07:03 +0000 (17:07 +0200)] 
improve lxc-debian template to specify the suite

The attached patch adds a variable at the top of lxc-debian to change the SUITE.
Currently tested suites are lenny, squeeze, sid.

Also, the patch uses the dhcp3-client package instead of dhcp-client which is
deprecated in lenny and removed in squeeze.

Patch initialy from Mathieu Parent.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoFix linking problems with libcap
Ozan Caglayan [Fri, 1 Oct 2010 15:07:03 +0000 (17:07 +0200)] 
Fix linking problems with libcap

Correctly link to libcap to avoid underlinking and unused direct
dependency problems.

Signed-off-by: Ozan Caglayan <ozan@pardus.org.tr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoinitialize capabilities in checkpoint and restart commands
Cedric Le Goater [Fri, 1 Oct 2010 15:00:45 +0000 (17:00 +0200)] 
initialize capabilities in checkpoint and restart commands

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
14 years agoconfigure container architecture
Daniel Lezcano [Mon, 13 Sep 2010 13:36:20 +0000 (15:36 +0200)] 
configure container architecture

When a container is installed with 32bits binaries while we are
running on a 64bits host, inside the container we are seen as
64bits arch. That leads to some problems for the package updates
because the scripts will download 64bits packages instead of 32bits.

This patch defines a configuration variable to set the architecture
of the container.

lxc.arch = i686 | x86 | x86_64 | amd64

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoversion 0.7.2 lxc-0.7.2
Daniel Lezcano [Mon, 26 Jul 2010 09:01:20 +0000 (11:01 +0200)] 
version 0.7.2

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoavoid compile warning in src/lxc/console.c
Michel Normand [Fri, 23 Jul 2010 15:17:14 +0000 (17:17 +0200)] 
avoid compile warning in src/lxc/console.c

src/lxc/console.c:143: warning : return type defaults to ‘int’

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoFix bad returned value
Daniel Lezcano [Fri, 23 Jul 2010 13:10:38 +0000 (15:10 +0200)] 
Fix bad returned value

In case of error the message will be always truncated.
We check the message was truncated with the total size
received which means the kernel as more info to give.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoDont' try to remove a physical nic on error
Daniel Lezcano [Fri, 23 Jul 2010 13:10:38 +0000 (15:10 +0200)] 
Dont' try to remove a physical nic on error

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agofix core dump when using physical interface
Daniel Lezcano [Fri, 23 Jul 2010 13:10:38 +0000 (15:10 +0200)] 
fix core dump when using physical interface

If the physical link is not specified in the configuration
the check in if_nametoindex(netdev->link) leads to a segfault.

Check the link is specified.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Reported-by: Ferenc Wagner <wferi@niif.hu>
15 years agoset rights to lxc-init
Daniel Lezcano [Fri, 23 Jul 2010 13:10:38 +0000 (15:10 +0200)] 
set rights to lxc-init

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agofix compilation warning
Daniel Lezcano [Fri, 23 Jul 2010 13:10:38 +0000 (15:10 +0200)] 
fix compilation warning

Add missing include

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoinitialize the capabilties for attach and unshare
Daniel Lezcano [Fri, 23 Jul 2010 13:10:38 +0000 (15:10 +0200)] 
initialize the capabilties for attach and unshare

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agofix setuid to attach, create and start
Daniel Lezcano [Fri, 23 Jul 2010 13:10:38 +0000 (15:10 +0200)] 
fix setuid to attach, create and start

Fix the setuid bit root script.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agofix lxc.spec file
Daniel Lezcano [Fri, 23 Jul 2010 13:10:38 +0000 (15:10 +0200)] 
fix lxc.spec file

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agokeep the name of the physical interface
Daniel Lezcano [Thu, 22 Jul 2010 13:59:44 +0000 (15:59 +0200)] 
keep the name of the physical interface

When the interface used in the container is a physical
interface from the host, we keep the initial name.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Reported-by: Sabdar <sabdar@wellspringsys.com>
15 years agofix inverted network interface creation
Daniel Lezcano [Thu, 22 Jul 2010 13:59:44 +0000 (15:59 +0200)] 
fix inverted network interface creation

The list is 'lifo', so when we create the network interfaces, we
do this in the reverse order of the expected one. That is confusing.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoprovide a script to set uid bit on cli
Daniel Lezcano [Tue, 20 Jul 2010 11:45:44 +0000 (13:45 +0200)] 
provide a script to set uid bit on cli

Some file systems do not support the file posix capabilities.
The following script set the setuid bit root on the different
cli.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agofix console overwrite any file
Daniel Lezcano [Tue, 20 Jul 2010 11:45:44 +0000 (13:45 +0200)] 
fix console overwrite any file

Prevent to specify a file not belonging to us as the output for the console

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agofix log appending to any file
Daniel Lezcano [Tue, 20 Jul 2010 11:45:44 +0000 (13:45 +0200)] 
fix log appending to any file

With the capabilities, the open of the log file can be done on any
file, making possible to modifify the content of the file.

Let's drop the privilege when opening the file, so we ensure that is
no longer possible.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agomove the capabilities function to caps.c
Daniel Lezcano [Tue, 20 Jul 2010 11:45:44 +0000 (13:45 +0200)] 
move the capabilities function to caps.c

Move the reset of the capabilities to the caps.c file and
initialize correctly the capabilities for lxc-init.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoinitialize capabilities for lxc-start and lxc-execute
Daniel Lezcano [Tue, 20 Jul 2010 11:45:44 +0000 (13:45 +0200)] 
initialize capabilities for lxc-start and lxc-execute

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoadd a macro to wrap a privilegied function
Daniel Lezcano [Tue, 20 Jul 2010 11:45:44 +0000 (13:45 +0200)] 
add a macro to wrap a privilegied function

This macro is a helper to call a function into a [un]privilegied section.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoremove/restore effective capabilities
Daniel Lezcano [Tue, 20 Jul 2010 11:45:44 +0000 (13:45 +0200)] 
remove/restore effective capabilities

This patch adds the functions to drop the 'effective' capabilities and
restore them from the 'permitted' capabilities.

When the command is run as 'root' we do nothing.
When the command is run as 'lambda' user, we drop the effective capabilities
When the command is run as 'root' but real uid is not root, we keep the capabilies,
switch to real uid, and drop the effective capabilities.

This approach is compatible for root user, lambda + file capabilities
and lambda + setuid.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoRemove dead code
Daniel Lezcano [Mon, 19 Jul 2010 14:04:41 +0000 (16:04 +0200)] 
Remove dead code

This function is no longer used.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agolxc-init finishes the remaining processes with SIGKILL
Daniel Lezcano [Tue, 13 Jul 2010 12:51:45 +0000 (14:51 +0200)] 
lxc-init finishes the remaining processes with SIGKILL

If lxc-init receives a SIGALRM, a timeout, it kills all the processes
of the container with SIGKILL. That will prevent the container to be
stuck when one process ignore the SIGTERM signal.

Each time a process exits, the timeout is resetted.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agolxc-init kills all processes with SIGTERM
Daniel Lezcano [Tue, 13 Jul 2010 12:51:45 +0000 (14:51 +0200)] 
lxc-init kills all processes with SIGTERM

When lxc-init receives a SIGTERM, let's kill all the processes of
the pid namespace with kill -1. So the exit of the container will
happen gracefully with processes death cascade.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agogeneralize the name of the signal handler
Ferenc Wagner [Tue, 13 Jul 2010 12:51:45 +0000 (14:51 +0200)] 
generalize the name of the signal handler

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoforward signals to the container init
Ferenc Wagner [Tue, 13 Jul 2010 12:51:45 +0000 (14:51 +0200)] 
forward signals to the container init

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agofix compilation warning
Daniel Lezcano [Mon, 12 Jul 2010 13:13:18 +0000 (15:13 +0200)] 
fix compilation warning

Add missing include.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoMust unfreeze while stopping container
Sukadev Bhattiprolu [Mon, 12 Jul 2010 13:13:18 +0000 (15:13 +0200)] 
Must unfreeze while stopping container

As pointed out by Dan Smith, when a container is being stopped, it must
also be unfrozen after posting the SIGKILL. Otherwise if the container
is frozen when the SIGKILL is posted, the SIGKILL will remain pending
and the lxc-stop command will block until lxc-unfreeze is explicitly
called).

(lxc-stop waits for the container to exit and close the socket but since
the container is frozen, lxc-stop will block).

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Acked-by: Matt Helsley <matthltc@us.ibm.com>
Acked-by: Dan Smith <danms@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoEnsure frezer state has changed
Sukadev Bhattiprolu [Mon, 12 Jul 2010 13:13:18 +0000 (15:13 +0200)] 
Ensure frezer state has changed

A write to the freezer.state file does not gurantee that the state has
changed. To ensure that the freezer state is either FROZEN or THAWED,
read the freezer state and if it has not changed, repeat the write.

Changelog[v2]:
- Minor reorg of code
- Comments from Daniel Lezcano:
- lseek() before each read/write of freezer.state
- Have lxc_freeze_unfreeze() return -1 on error

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoMinor resource name array fix in src/lxc/namespace.c
Tushar Gohad [Tue, 6 Jul 2010 21:45:52 +0000 (23:45 +0200)] 
Minor resource name array fix in src/lxc/namespace.c

Signed-off-by: Tushar Gohad <tgohad@mvista.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoclose prctl window
Daniel Lezcano [Tue, 6 Jul 2010 19:26:31 +0000 (21:26 +0200)] 
close prctl window

If the pdeath signal is set after the synchro we have a window where
the parent exits with the pdeath signal not set.

In order to avoid that, we have to move the prctl before the synchro with
the parent so if the parent exits before we can set the pdeath signal, the
synchro will fail in any case and the container startup will be aborted.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agolxc-0.7.1 lxc-0.7.1
Daniel Lezcano [Thu, 24 Jun 2010 19:04:09 +0000 (21:04 +0200)] 
lxc-0.7.1

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoremove bad default console option in ubuntu template
Daniel Lezcano [Thu, 24 Jun 2010 07:47:14 +0000 (09:47 +0200)] 
remove bad default console option in ubuntu template

Remove this options as by default container console goes to the tty
or /dev/null if not available.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agolxc to apply mount options for bind mounts
Ciprian Dorin, Craciun [Thu, 24 Jun 2010 07:47:14 +0000 (09:47 +0200)] 
lxc to apply mount options for bind mounts

Hello all!

    This bug stalked me for a while, but only now it bit me quite
badly... (Lost about an hour of work...)

    So the culprit: inside the fstab file for the `lxc.mount` option I
can use options like `ro` together with `bind`. Unfortunately the
kernel just laughs in my face and ignores any options I've put in
there... :) But not any more: I've updated `./src/lxc/conf.c`
(`mount_file_entries` function) so that when it encounters a `bind`
option it executes it twice (one without any extra options, and a
second time with the remount flag set.)

I've marginally (as in my particular case) tested it and it works.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agofix /proc not mounted in debian container
Daniel Lezcano [Tue, 22 Jun 2010 22:44:13 +0000 (00:44 +0200)] 
fix /proc not mounted in debian container

Mount some systemm fs for the container. By default, /proc
is no longer mounted in debian.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agofix default console to /dev/tty
Daniel Lezcano [Tue, 22 Jun 2010 22:44:13 +0000 (00:44 +0200)] 
fix default console to /dev/tty

Fix default console output fall into the current tty.
Otherwise fall to /dev/null if no tty is available.

Fix at the same time, Xorg take 100% cpu.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agofix bad free when reading the configuration file
Daniel Lezcano [Thu, 17 Jun 2010 20:44:23 +0000 (22:44 +0200)] 
fix bad free when reading the configuration file

We change the initial pointer when parsing the line, the address
we are trying to free is modified in case there are blanks before
an option.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agofix sshd template
Daniel Lezcano [Thu, 17 Jun 2010 20:44:23 +0000 (22:44 +0200)] 
fix sshd template

Fixed the sshd template example.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agochange version number to 0.7.0 lxc-0.7.0
Daniel Lezcano [Thu, 17 Jun 2010 12:04:15 +0000 (14:04 +0200)] 
change version number to 0.7.0

Finally, I did it :)

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agofix lxc.spec.in
Daniel Lezcano [Thu, 17 Jun 2010 12:04:15 +0000 (14:04 +0200)] 
fix lxc.spec.in

Changed the directory location for documents.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
15 years agoadd lxc.console documentation
Daniel Lezcano [Thu, 17 Jun 2010 12:04:15 +0000 (14:04 +0200)] 
add lxc.console documentation

Add missing documenation about the console output.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>