]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
10 years agoMerge pull request #342 from tukiyo/patch-2
hallyn [Wed, 21 Jan 2015 15:40:25 +0000 (09:40 -0600)] 
Merge pull request #342 from tukiyo/patch-2

big big login delays in CentOS 7 systemd

10 years agoEnable seccomp by default for unprivileged users.
Serge Hallyn [Fri, 19 Dec 2014 18:23:52 +0000 (18:23 +0000)] 
Enable seccomp by default for unprivileged users.

In contrast to what the comment above the line disabling it said,
it seems to work just fine.  It also is needed on current kernels
(until Eric's patch hits upstream) to prevent unprivileged containers
from hosing fuse filesystems they inherit.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoseccomp: add rule to reject umount -f
Serge Hallyn [Fri, 19 Dec 2014 18:22:55 +0000 (18:22 +0000)] 
seccomp: add rule to reject umount -f

If a container has a bind mount from a host nfs or fuse
filesystem, and does 'umount -f', it will disconnect the
host's filesystem.  This patch adds a seccomp rule to
block umount -f from a container.  It also adds that rule
to the default seccomp profile.

Thanks stgraber for the idea :)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-opensuse: Disable building openSUSE containers on 13.2/Tumbleweed only if wrong...
Johannes Kastl [Wed, 17 Dec 2014 20:08:21 +0000 (21:08 +0100)] 
lxc-opensuse: Disable building openSUSE containers on 13.2/Tumbleweed only if wrong version of build package is installed

Signed-off-by: Johannes Kastl <git@ojkastl.de>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-opensuse: default release changed to 13.1, as 12.3 reaches end-of-life soon
Johannes Kastl [Fri, 12 Dec 2014 20:58:59 +0000 (21:58 +0100)] 
lxc-opensuse: default release changed to 13.1, as 12.3 reaches  end-of-life soon

Signed-off-by: Johannes Kastl <git@ojkastl.de>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agochange version to 1.0.7 in configure.ac lxc-1.0.7
Stéphane Graber [Fri, 5 Dec 2014 18:37:33 +0000 (13:37 -0500)] 
change version to 1.0.7 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotypofixes - https://github.com/vlajos/misspell_fixer
Veres Lajos [Thu, 4 Dec 2014 21:57:38 +0000 (21:57 +0000)] 
typofixes - https://github.com/vlajos/misspell_fixer

Signed-off-by: Veres Lajos <vlajos@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agormdir and lxc_unpriv returns non-negative error codes
S.Çağlar Onur [Thu, 4 Dec 2014 17:59:47 +0000 (12:59 -0500)] 
rmdir and lxc_unpriv returns non-negative error codes

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoaudit: added capacity and reserve() to nlmsg
Shuai Zhang [Sun, 30 Nov 2014 13:03:37 +0000 (21:03 +0800)] 
audit: added capacity and reserve() to nlmsg

There are now two (permitted) ways to add data to netlink message:

 1. put_xxx()
 2. call nlmsg_reserve() to get a pointer to newly reserved room within the
    original netlink message, then write or memcpy data to that area.

Both of them guarantee adding requested length data do not overflow the
pre-allocated message buffer by checking against its cap field first.

And there may be no need to access nlmsg_len outside nl module, because both
put_xxx() and nlmsg_reserve() have alread did that for us.

Signed-off-by: Shuai Zhang <zs.broccoli@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotests: try again when waitpid() sets errno as EINTR
Arjun Sreedharan [Thu, 4 Dec 2014 08:56:04 +0000 (14:26 +0530)] 
tests: try again when waitpid() sets errno as EINTR

when waitpid() is interrupted, errno is not set to the negative
value -EINTR. It is set to EINTR. check against EINTR.

Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agofixed typo in comment
Shuai Zhang [Wed, 3 Dec 2014 06:13:20 +0000 (14:13 +0800)] 
fixed typo in comment

Signed-off-by: Shuai Zhang <zs.broccoli@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoImprove veth error cases logging
Stéphane Graber [Wed, 3 Dec 2014 16:01:45 +0000 (11:01 -0500)] 
Improve veth error cases logging

The previous error message made it look like the host interface name was
the concatenation of both the host and guest interface names.

Closes #374

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix clone issues
KATOH Yasufumi [Wed, 5 Nov 2014 07:03:34 +0000 (16:03 +0900)] 
Fix clone issues

This commit fixes two issues at the time of clone:
* unnecessary directory is created when clone between overlayfs/aufs
* clone failed when the end of rootfs path is not "/rootfs"

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agooverlayfs: overlayfs.v22 or higher needs workdir option
KATOH Yasufumi [Thu, 30 Oct 2014 11:31:20 +0000 (20:31 +0900)] 
overlayfs: overlayfs.v22 or higher needs workdir option

This patch creates workdir as "olwork", and retry mount with workdir
option when mount is failed.
It is used to prepare files before atomically swithing with
destination, and needs to be on the same filesystem as upperdir. It's
OK for it to be empty.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agooverlay and aufs clone_paths: be more robust
Serge Hallyn [Thu, 16 Oct 2014 15:10:21 +0000 (15:10 +0000)] 
overlay and aufs clone_paths: be more robust

Currently when we clone a container, bdev_copy passes NULL as dst argument
of bdev_init, then sees bdev->dest (as a result) is NULL, and sets
bdev->dest to $lxcpath/$name/rootfs.  so $ops->clone_paths() can
assume that "/rootfs" is at the end of the path.  The overlayfs and
aufs clonepaths do assume that and index to endofstring-6 and append
delta0.  Let's be more robust by actually finding the last / in
the path.

Then, instead of always setting oldbdev->dest to $lxcpath/$name/rootfs,
set it to oldbdev->src.  Else dir_clonepaths fails when mounting src
onto dest bc dest does not exist.  We could also fix that by creating
bdev->dest if needed, but that addes an empty directory to the old
container.

This fixes 'lxc-clone -o x1 -n x2' if x1 has lxc.rootfs = /var/lib/lxc/x1/x
and makes the overlayfs and aufs paths less fragile should something else
change.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoAllow lxc_clear_config_item to clear idmaps.
Casey Marshall [Fri, 28 Nov 2014 07:11:06 +0000 (01:11 -0600)] 
Allow lxc_clear_config_item to clear idmaps.

Ran into this when trying to automate stgraber's "GUI in containers"
post.

Signed-off-by: Casey Marshall <casey.marshall@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-opensuse: Disabling builds on openSUSE Tumbleweed, detection improved.
Johannes Kastl [Sat, 29 Nov 2014 20:43:26 +0000 (21:43 +0100)] 
lxc-opensuse: Disabling builds on openSUSE Tumbleweed, detection improved.

Signed-off-by: Johannes Kastl <git@ojkastl.de>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-debian: mask both Wheezy and Jessie udev services
Cameron Norman [Mon, 1 Dec 2014 21:35:52 +0000 (13:35 -0800)] 
lxc-debian: mask both Wheezy and Jessie udev services

Signed-off-by: Cameron Norman <camerontnorman@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-debian: adjust init system configurations
Cameron Norman [Mon, 1 Dec 2014 21:29:26 +0000 (13:29 -0800)] 
lxc-debian: adjust init system configurations

Do as much as possible to allow containers switching from non-systemd to
systemd to work as intended (but nothing that will cause side effects).
Use update-rc.d disable instead of remove so the init scripts are not
re-enabled when the package is updated

Signed-off-by: Cameron Norman <camerontnorman@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-debian: support systemd as PID 1
Antonio Terceiro [Mon, 24 Nov 2014 01:51:06 +0000 (23:51 -0200)] 
lxc-debian: support systemd as PID 1

Containers with systemd need a somewhat special setup, which I borrowed
and adapted from lxc-fedora. These changes are required so that Debian 8
(jessie) containers work properly, and are a no-op for previous Debian
versions.

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-debian: Fix default mirrors
Gu1 [Tue, 28 Oct 2014 01:14:28 +0000 (02:14 +0100)] 
lxc-debian: Fix default mirrors

Fix a typo in the lines inserted in the default sources.list.
Change the default mirror to http.debian.net which is (supposedly) more
accurate and better than cdn.debian.net for a generic configuration.
Use security.debian.org directly for the {release}/updates repository.

Signed-off-by: Gu1 <gu1@aeroxteam.fr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-debian: added support for package installation
Alexander Dreweke [Tue, 8 Jul 2014 05:17:37 +0000 (07:17 +0200)] 
lxc-debian: added support for package installation

- added --mirror, --security-mirror and --package parameters
- generate source.list
- install packages into final lxc instance

Update by Stéphane Graber for stable-1.0:
 - Drop the addition of --packages (new feature)

Signed-off-by: Alexander Dreweke <alexander@dreweke.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotabs/spaces consistency
Stéphane Graber [Wed, 26 Nov 2014 19:23:05 +0000 (14:23 -0500)] 
tabs/spaces consistency

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoRemounts bind mounts if read-only flag is provided
Abin Shahab [Wed, 12 Nov 2014 00:06:52 +0000 (00:06 +0000)] 
Remounts bind mounts if read-only flag is provided

Bind mounts do not honor filesystem mount options. This change will
remount filesystems that are bind mounted if there are changes to
filesystem mount options, specifically if the mount is readonly.

Signed-off-by: Abin Shahab <ashahab@altiscale.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-alpine: create a default tty for console
Natanael Copa [Thu, 27 Nov 2014 14:21:21 +0000 (15:21 +0100)] 
lxc-alpine: create a default tty for console

Create a tty so we get login prompt on console by default

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-alpine: make sure /dev/shm is world writeable
Natanael Copa [Thu, 27 Nov 2014 14:20:50 +0000 (15:20 +0100)] 
lxc-alpine: make sure /dev/shm is world writeable

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agofix wrong nlmsg_len
Shuai Zhang [Thu, 27 Nov 2014 12:38:01 +0000 (20:38 +0800)] 
fix wrong nlmsg_len

nlmsg_len is the length of message including header.

Signed-off-by: Shuai Zhang <zs.broccoli@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-opensuse: Disable on 13.2
Johannes Kastl [Wed, 26 Nov 2014 19:26:08 +0000 (20:26 +0100)] 
lxc-opensuse: Disable on 13.2

Disabled building openSUSE containers on openSUSE 13.2 and openSUSE
Tumbleweed due to faulty behaviour with newer versions of
init_buildsystem.

Signed-off-by: Johannes Kastl <git@ojkastl.de>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: Update kernel and cgroup info in Japanese lxc(7)
KATOH Yasufumi [Tue, 25 Nov 2014 08:16:08 +0000 (17:16 +0900)] 
doc: Update kernel and cgroup info in Japanese lxc(7)

Update for commit 0dcbd62

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-create -t option is not optional
Silvio Fricke [Wed, 12 Nov 2014 09:45:06 +0000 (10:45 +0100)] 
lxc-create -t option is not optional

Closes: #355
Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix lxc-centos.in typo.
謝致邦 [Thu, 6 Nov 2014 10:38:08 +0000 (18:38 +0800)] 
Fix lxc-centos.in typo.

Signed-off-by: 謝致邦 <Yeking@Red54.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix lxc-openmandriva.in typo.
謝致邦 [Thu, 6 Nov 2014 10:43:31 +0000 (18:43 +0800)] 
Fix lxc-openmandriva.in typo.

Signed-off-by: 謝致邦 <Yeking@Red54.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-cirros: support creating+running unprivileged
Serge Hallyn [Fri, 31 Oct 2014 02:42:31 +0000 (02:42 +0000)] 
lxc-cirros: support creating+running unprivileged

Support creation and use of lxc-cirros by unprivileged users.

If we detect we are an unprivileged user, then insist that we
be in a userns with a id mapping.

If we are in a userns, then don't extract /dev when extracting
the rootfs.

If we are not root, then save the tarball to ~/.cache/lxc/cirros
instead of /var/cache/lxc/cirros.

If we are not roo, then include entries to auto-mount proc and sys,
as well as bind-mount devices.

Cc: Scott Moser <smoser@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoconf.c: change 'instanciate' to 'instantiate'
Joel Nider [Sun, 9 Nov 2014 16:41:12 +0000 (18:41 +0200)] 
conf.c: change 'instanciate' to 'instantiate'

This is a multipart message in MIME format.

Fixes a small (but consistent) spelling mistake in conf.c

Signed-off-by: Joel Nider <joeln@il.ibm.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc_info: flush stdout before calling routines which may fork
Serge Hallyn [Wed, 12 Nov 2014 03:51:04 +0000 (03:51 +0000)] 
lxc_info: flush stdout before calling routines which may fork

Otherwise both resulting takss will print what they had flushed when they
exit.

This fixes https://bugs.launchpad.net/bugs/1389244

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Tested-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix the lxc manpage a bit
Stéphane Graber [Fri, 14 Nov 2014 17:26:12 +0000 (12:26 -0500)] 
Fix the lxc manpage a bit

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-plamo: mount tmpfs on /dev/shm
TAMUKI Shoichi [Wed, 19 Nov 2014 08:23:36 +0000 (17:23 +0900)] 
lxc-plamo: mount tmpfs on /dev/shm

Do mkdir $rootfs/dev/shm and then mount tmpfs on /dev/shm.

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc/utils: bugfix freed pointer return value
Silvio Fricke [Fri, 14 Nov 2014 19:56:12 +0000 (20:56 +0100)] 
lxc/utils: bugfix freed pointer return value

We allocate a pointer and save this address in a static variable. After
this we freed this pointer and return.

Here a cuttout of a valgrind report:

[...]
==11568== Invalid read of size 1
==11568==    at 0x4C2D524: strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11568==    by 0x5961C9B: puts (in /usr/lib/libc-2.20.so)
==11568==    by 0x400890: main (lxc_config.c:73)
==11568==  Address 0x6933e21 is 1 bytes inside a block of size 32 free'd
==11568==    at 0x4C2B200: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11568==    by 0x4E654F2: lxc_global_config_value (utils.c:415)
==11568==    by 0x4E92177: lxc_get_global_config_item (lxccontainer.c:2287)
==11568==    by 0x400883: main (lxc_config.c:71)
[...]

Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
10 years agocgmanager: fix 'attach' with "all" controller support
Serge Hallyn [Sun, 2 Nov 2014 14:01:18 +0000 (14:01 +0000)] 
cgmanager: fix 'attach' with "all" controller support

"all" is not a supported keyword for cgmanager's get_pid_cgroup.
Pass the first mounted cgroup subsystem instead of passing "all" when
getting the container's cgorup to attach to.

Also, make sure that the target cgroup is in fact in all identical
cgroups before attaching with 'all".  If not, then we must attach to
each cgroup separately, or else we will not be in all the same cgroups
as the target container.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoattach: don't ignore sigint/sigkill if stdin is redirected
Serge Hallyn [Wed, 29 Oct 2014 15:03:14 +0000 (15:03 +0000)] 
attach: don't ignore sigint/sigkill if stdin is redirected

If attach is being done over passed-in fds, then we shouldn't
mess with the caller's signal table to ignore ctrl-c over the
fd.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFixed mismatch on ipvX gateway
Sergio Jimenez [Sat, 4 Oct 2014 18:51:27 +0000 (20:51 +0200)] 
Fixed mismatch on ipvX gateway

Signed-off-by: Sergio Jimenez <tripledes@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoCreate the apt proxy in the cache instead of the 1st container
Simon Deziel [Sun, 19 Oct 2014 02:20:23 +0000 (22:20 -0400)] 
Create the apt proxy in the cache instead of the 1st container

This addresses https://github.com/lxc/lxc/issues/280.

Signed-off-by: Simon Deziel <simon@sdeziel.info>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoattach: don't use confstr(_CS_PATH)
Serge Hallyn [Thu, 23 Oct 2014 04:34:05 +0000 (04:34 +0000)] 
attach: don't use confstr(_CS_PATH)

It is not system-definable, rather glibc sets that to bin:/usr/bin, which is
simply too restrictive.  So just always set our preferred path.

This was reported at:
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1384327

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc_global_config_value: simplify the theme
Serge Hallyn [Mon, 27 Oct 2014 14:23:10 +0000 (14:23 +0000)] 
lxc_global_config_value: simplify the theme

Rather than try to free all the not-being-returned items at
each if clause where we assign one to return value, just NULL
the one we are returning so we can safely free all the
values.  This should fix the newly reported coverity memory
leak

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-start: don't re-try to mount rootfs if we already did so
Serge Hallyn [Tue, 14 Oct 2014 11:04:35 +0000 (11:04 +0000)] 
lxc-start: don't re-try to mount rootfs if we already did so

If we are root using a user namespace and are mounting a blockdev as rootfs,
then we do this before unsharing the userns, because we are not allowed to
do it in a userns.  But after unsharing the userns, we unconditionally
retried mounting the rootfs, resulting in failure.  stop that.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoMake legacy lxc-ls more robust
Dark Templar [Mon, 27 Oct 2014 13:33:04 +0000 (08:33 -0500)] 
Make legacy lxc-ls more robust

Behave well when /etc/lxc/${name} is a symlink to directory

Signed-off-by: Dark Templar <dark_templar@hotbox.ru>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agodo_rootfs_setup: fix return bugs
Serge Hallyn [Mon, 27 Oct 2014 03:01:30 +0000 (22:01 -0500)] 
do_rootfs_setup: fix return bugs

Fix return value on bind mount failure.

If we've already mounted the rootfs, exit after the bind mount
rather than re-trying the rootfs mount.  The only case where
this happens is when root is starting a container in a user
namespace and with a block device backing store.

In that case, pre-mount hooks will be executed in the initial
user namespace.  That may be worth fixing.  Or it may be what
we want.  We should think about it and fix it.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-start: return 0 rather than error if container is already running
Serge Hallyn [Wed, 22 Oct 2014 15:54:36 +0000 (10:54 -0500)] 
lxc-start: return 0 rather than error if container is already running

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix another gentoo template typo
Dark Templar [Wed, 22 Oct 2014 14:35:08 +0000 (09:35 -0500)] 
Fix another gentoo template typo

I've found one more typo in the gentoo template, configuration in the
generated file /etc/conf.d/hostname was not valid, but it didn't impact
me due to "lxc.utsname" being set in the configuration file of container
and hostname service being not used. Anyway, I've made a patch and
sending it with this mail.

Signed-off-by: Dark Templar <dark_templar@hotbox.ru>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agobusybox template: mount fstab when available
Bogdan Purcareata [Mon, 20 Oct 2014 19:56:54 +0000 (15:56 -0400)] 
busybox template: mount fstab when available

When running unprivileged, lxc-create will touch a fstab file, with bind-mounts
for the ttys and other devices. Add this entry in the container config.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agobusybox template: support for unprivileged containers
Bogdan Purcareata [Mon, 20 Oct 2014 19:56:53 +0000 (15:56 -0400)] 
busybox template: support for unprivileged containers

Apply the changes found in templates/lxc-download to the busybox template as
well. Change ownership of the config and fstab files to the unprivileged user,
and the ownership of the rootfs to root in the new user namespace.

Eliminate the "unsupported for userns" flag.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc_global_config_value can return the default lxc.cgroup.pattern whether root or...
KATOH Yasufumi [Thu, 2 Oct 2014 09:01:06 +0000 (18:01 +0900)] 
lxc_global_config_value can return the default lxc.cgroup.pattern whether root or non-root

>>> On Tue, 30 Sep 2014 19:48:09 +0000
    in message   "Re: [lxc-devel] [PATCH] lxc-config can show lxc.cgroup.(use|pattern)"
                  Serge Hallyn-san wrote:

> I think it would be worth also augmenting
> lxc_global_config_value() to return a default lxc.cgroup.use
> for 'all', and a default lxc.cgroup.pattern ("/lxc/%n" for root
> or "%n" for non-root).

lxc.cgroup.pattern is like this? (^_^;)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix typo in lxc-gentoo template
Dark Templar [Mon, 20 Oct 2014 21:38:32 +0000 (16:38 -0500)] 
Fix typo in lxc-gentoo template

Signed-off-by: Dark Templar <dark_templar@hotbox.ru>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxccontainer.c: rename enter_to_ns to enter_net_ns
Serge Hallyn [Wed, 15 Oct 2014 09:55:51 +0000 (11:55 +0200)] 
lxccontainer.c: rename enter_to_ns to enter_net_ns

because that's what it does

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agonetwork: introduce a interface named lxc_netdev_isup().
Dongsheng Yang [Tue, 16 Sep 2014 05:09:59 +0000 (13:09 +0800)] 
network: introduce a interface named lxc_netdev_isup().

When we need to know some info about a netdev, such as is_up or not,
we need to read the flag for the netdev.

This patch introduce a interface function named lxc_netdev_isup()
to check is a netdev up or down.

And introduce a network private function named netdev_get_flag()
to get flag for netdev by netlink.

Changelog: 10/15/2015: Return failure if name==NULL to avoid later strlen fun

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agonetwork: allow lxc_network_move_by_index() rename netdev in moving.
Dongsheng Yang [Tue, 16 Sep 2014 04:58:55 +0000 (12:58 +0800)] 
network: allow lxc_network_move_by_index() rename netdev in moving.

In netlink, we can set the dest_name of netdev when move netdev
between namespaces in one netlink request. And moving a netdev of
a src_name to a netdev with a dest_name is a common usecase.

So this patch add a parametaer to lxc_network_move_by_index() to
indicate the dest_name for the movement. NULL means same with
the src_name.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc_start: ERROR if container is already running.
Dongsheng Yang [Fri, 12 Sep 2014 13:49:09 +0000 (21:49 +0800)] 
lxc_start: ERROR if container is already running.

We should exit with a error when starting a running container.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agonetwork: check result of if_nametoindex().
Dongsheng Yang [Thu, 11 Sep 2014 13:51:35 +0000 (21:51 +0800)] 
network: check result of if_nametoindex().

When we want to get index of a ifname which does not
exist, we should return a -EINVAL in this case.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agonetwork: convert param ifname to const.
Dongsheng Yang [Thu, 11 Sep 2014 12:43:57 +0000 (20:43 +0800)] 
network: convert param ifname to const.

We should not modify ifname in lxc_netdev_move_by_name(),
making it as const in param list will make our code more
robust.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoconf.c: Define MS_PRIVATE for Android
Stéphane Graber [Mon, 13 Oct 2014 10:50:20 +0000 (12:50 +0200)] 
conf.c: Define MS_PRIVATE for Android

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agofix lxc.mount.auto clearing
Serge Hallyn [Thu, 9 Oct 2014 15:54:51 +0000 (10:54 -0500)] 
fix lxc.mount.auto clearing

the way config_mount was structured, sending 'lxc.mount.auto = '
ended up actually clearing all lxc.mount.entrys.  Fix that by
moving the check for an empty value to after the subkey checks.
Then, actually do the clearing of auto_mounts in config_mount_auto.

The 'strlen(subkey)' check being removed was bogus - the subkey
either known to be 'lxc.mount.entry', else subkey would have been
NULL (and forced a return in the block above).

This would have been clearer if the config_mount() and helper
fns were structured like the rest of confile.c.  It's tempting
to switch it over, but there are subtleties in there so it's
not something to do without a lot of thought and testing.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-test-unpriv: test for different cgroups per subsystem
Serge Hallyn [Thu, 9 Oct 2014 16:24:37 +0000 (11:24 -0500)] 
lxc-test-unpriv: test for different cgroups per subsystem

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-test-unpriv: don't clear out /etc/lxc/lxc-usernet
Serge Hallyn [Wed, 8 Oct 2014 16:31:52 +0000 (11:31 -0500)] 
lxc-test-unpriv: don't clear out /etc/lxc/lxc-usernet

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc: don't call pivot_root if / is on a ramfs
Andrey Vagin [Sat, 4 Oct 2014 21:49:16 +0000 (01:49 +0400)] 
lxc: don't call pivot_root if / is on a ramfs

pivot_root can't be called if / is on a ramfs. Currently chroot is
called before pivot_root. In this case the standard well-known
'chroot escape' technique allows to escape a container.

I think the best way to handle this situation is to make following actions:
* clean all mounts, which should not be visible in CT
* move CT's rootfs into /
* make chroot into /

I don't have a host, where / is on a ramfs, so I can't test this patch.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgmanager: several fixes
Serge Hallyn [Wed, 8 Oct 2014 05:14:26 +0000 (00:14 -0500)] 
cgmanager: several fixes

These all fix various ways that cgroup actions could fail if an
unprivileged user's cgroup paths were not all the same for all
controllers.

1. in cgm_{g,s}et, use the right controller, not the first in the list,
   to get the cgroup path.

2. when we pass 'all' to cgmanager for a ${METHOD}_abs, make sure that all
   cgroup paths are the same.  That isn't necessary for methods not
   taking an absolute path, so split up the former
   cgm_supports_multiple_controllers() function into two booleans, one
   telling whether cgm supports it, and another telling us whether
   cgm supports it AND all controller cgroup paths are the same.

3. separately, do_cgm_enter with abs=true couldn't work if all
   cgroup paths were not the same.  So just ditch that helper and
   call lxc_cgmanager_enter() where needed, because the special
   cases would be more complicated.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Fix unpriv test
Stéphane Graber [Thu, 2 Oct 2014 18:59:35 +0000 (14:59 -0400)] 
tests: Fix unpriv test

Don't use $TUSER as it's not defined. Also don't include
lxc-test-usernic in extra_DIST.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoapparmor: restrict signal and ptrace for processes
Jamie Strandboge [Mon, 29 Sep 2014 16:40:52 +0000 (12:40 -0400)] 
apparmor: restrict signal and ptrace for processes

Restrict signal and ptrace for processes running under the container
profile. Rules based on AppArmor base abstraction. Add unix rules for
processes running under the container profile.

Signed-off-by: Jamie Strandboge <jamie@canonical.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoadd file/func/line to debug info
Serge Hallyn [Mon, 29 Sep 2014 16:14:28 +0000 (16:14 +0000)] 
add file/func/line to debug info

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoapparmor: silence 'silent' mount denials
Serge Hallyn [Thu, 25 Sep 2014 14:45:53 +0000 (14:45 +0000)] 
apparmor: silence 'silent' mount denials

newer lxc uses 'silent' when remounting on shutdown.  Silence that denial too

Author: Jamie Strandboge <jamie@canonical.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agobig big login delays in CentOS 7 systemd 342/head
tukiyo [Thu, 9 Oct 2014 21:44:45 +0000 (06:44 +0900)] 
big big login delays in CentOS 7 systemd

10 years agoInclude network prefix when ipv4/ipv6 keys are queried
Sergio Jimenez [Wed, 24 Sep 2014 21:55:14 +0000 (23:55 +0200)] 
Include network prefix when ipv4/ipv6 keys are queried

Signed-off-by: Sergio Jimenez <tripledes@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoadd src/python-lxc/setup.py into .gitignore
S.Çağlar Onur [Wed, 24 Sep 2014 21:28:24 +0000 (17:28 -0400)] 
add src/python-lxc/setup.py into .gitignore

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agochange version to 1.0.6 in configure.ac lxc-1.0.6
Stéphane Graber [Wed, 24 Sep 2014 19:58:40 +0000 (15:58 -0400)] 
change version to 1.0.6 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix presentation of IPv6 addresses and gateway
Andre Nathan [Wed, 24 Sep 2014 13:08:50 +0000 (10:08 -0300)] 
Fix presentation of IPv6 addresses and gateway

Signed-off-by: Andre Nathan <andre@digirati.com.br>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodownload: Make --keyserver actually work
Stéphane Graber [Tue, 23 Sep 2014 14:23:27 +0000 (10:23 -0400)] 
download: Make --keyserver actually work

Reported-by: NeilGreenwood <neil.greenwood@gmail.com>
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix the unprivileged tests cgroup management
Stéphane Graber [Mon, 22 Sep 2014 22:08:49 +0000 (18:08 -0400)] 
Fix the unprivileged tests cgroup management

To cover all the cases we have around, we need to:
 - Attempt to use cgm if present (preferred)
 - Attempt to use cgmanager directly over dbus otherwise
 - Fallback to cgroupfs

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agodoc: Add description about ignoring lxc.cgroup.use when using cgmanager
KATOH Yasufumi [Tue, 23 Sep 2014 13:36:03 +0000 (22:36 +0900)] 
doc: Add description about ignoring lxc.cgroup.use when using cgmanager

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix build failure due to slightly different rmdir
Stéphane Graber [Mon, 22 Sep 2014 22:21:47 +0000 (18:21 -0400)] 
Fix build failure due to slightly different rmdir

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-archlinux: Properly set default locale in /etc/locale.conf
Bill Kolokithas [Thu, 21 Aug 2014 12:52:50 +0000 (15:52 +0300)] 
lxc-archlinux: Properly set default locale in /etc/locale.conf

Signed-off-by: Bill Kolokithas <kolokithas.b@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoAs discussed on ML, do not clean autodev dir on reboot
Jean-Tiare LE BIGOT [Wed, 13 Aug 2014 08:30:56 +0000 (10:30 +0200)] 
As discussed on ML, do not clean autodev dir on reboot

Signed-off-by: Jean-Tiare LE BIGOT <jean-tiare.le-bigot@ovh.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoclean autodev dir on container exit
Jean-Tiare LE BIGOT [Wed, 13 Aug 2014 08:30:04 +0000 (10:30 +0200)] 
clean autodev dir on container exit

When "lxc.autodev = 1", LXC creates automatically a "/dev/.lxc/<name>.<hash>"
folder to put container's devices in so that they are visible from both
the host and the container itself.

On container exit (ne it normal or not), this folder was not cleaned
which made "/dev" folder grow continuously.

We fix this by adding a new `int lxc_delete_autodev(struct lxc_handler
*handler)` called from `static void lxc_fini(const char *name, struct
lxc_handler *handler)`.

Signed-off-by: Jean-Tiare LE BIGOT <jean-tiare.le-bigot@ovh.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc_map_ids: add a comment
Serge Hallyn [Mon, 15 Sep 2014 00:35:02 +0000 (00:35 +0000)] 
lxc_map_ids: add a comment

Explain why we insist that root use newuidmap if it is available.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc_map_ids: don't do bogus chekc for newgidmap
Serge Hallyn [Fri, 22 Aug 2014 03:50:36 +0000 (22:50 -0500)] 
lxc_map_ids: don't do bogus chekc for newgidmap

If we didn't find newuidmap, then simply require the caller to be
root and write to /proc/self/uidmap manually.  Checking for
newgidmap to exist is bogus.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix build error(ISO C90 specs violation) in lxc.c
Masami Ichikawa [Mon, 22 Sep 2014 14:32:46 +0000 (23:32 +0900)] 
Fix build error(ISO C90 specs violation) in lxc.c

This patch fixes following build errors.

running build_ext
building '_lxc' extension
creating build/temp.linux-x86_64-3.4
gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -I../../src -I../../src -I/usr/include/python3.4m -c lxc.c -o ./build/temp.linux-x86_64-3.4/lxc.o
lxc.c: In function ‘convert_tuple_to_char_pointer_array’:
lxc.c:49:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
     char **result = (char**) calloc(argc + 1, sizeof(char*));
     ^
lxc.c:60:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
         char *str = NULL;
         ^
lxc.c: In function ‘Container_get_cgroup_item’:
lxc.c:822:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
     char* value = (char*) malloc(sizeof(char)*len + 1);
     ^
lxc.c: In function ‘Container_get_config_item’:
lxc.c:861:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
     char* value = (char*) malloc(sizeof(char)*len + 1);
     ^
lxc.c: In function ‘Container_get_keys’:
lxc.c:903:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
     char* value = (char*) malloc(sizeof(char)*len + 1);
     ^
cc1: some warnings being treated as errors
error: command 'gcc' failed with exit status 1
Makefile:472: recipe for target 'all' failed
make[3]: *** [all] Error 1
make[3]: Leaving directory '/home/masami/codes/lxc/src/python-lxc'
Makefile:394: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/masami/codes/lxc/src'
Makefile:338: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/masami/codes/lxc/src'
Makefile:484: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

build env:
distribution: Arch Linux
gcc version 4.9.1 20140903 (prerelease) (GCC)

Signed-off-by: Masami Ichikawa <masami256@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolog: fix quiet mode
William Dauchy [Thu, 18 Sep 2014 15:18:55 +0000 (17:18 +0200)] 
log: fix quiet mode

quiet mode was overriden by the double call of lxc_log_init
see lxc_container_new

use lxc_log_options_no_override in order to fix this

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: William Dauchy <william@gandi.net>
10 years agosupport use of 'all' containers when cgmanager supports it
Serge Hallyn [Thu, 18 Sep 2014 21:20:02 +0000 (21:20 +0000)] 
support use of 'all' containers when cgmanager supports it

Introduce a new list of controllers just containing "all".

Make the lists of controllers null-terminated.

If the cgmanager api version is high enough, use the 'all' controller
rather than walking all controllers, which should greatly reduce the
amount of dbus overhead.  This will be especially important for
those going through a cgproxy.

Also remove the call to cleanup cgroups when a cgroup existed.  That
usually fails (and failure is ignored) since the to-be-cleaned-up
cgroup is busy, but we shouldn't even be trying.  Note this can
create for extra un-cleanedup cgroups, however it's better than us
accidentally removing a cgroup that someone else had created and was
about to use.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-gentoo: keep original uid/gid of files/dirs when installing
TAMUKI Shoichi [Thu, 11 Sep 2014 08:33:00 +0000 (17:33 +0900)] 
lxc-gentoo: keep original uid/gid of files/dirs when installing

Call tar with --numeric-owner option to use numbers for user/group
names because the whole uid/gid in rootfs should be consistently
unchanged as in original stage3 tarball and private portage.

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-plamo: keep original uid/gid of files/dirs when installing
TAMUKI Shoichi [Thu, 4 Sep 2014 22:29:29 +0000 (07:29 +0900)] 
lxc-plamo: keep original uid/gid of files/dirs when installing

Regardless of whether "installpkg" command exists or not, install the
command temporarily with static linked tar command into the lxc cache
directory to keep the original uid/gid of files/directories.  Also,
use sed command instead of ed command for simplicity.

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoReport container exit status to monitord
Jean-Tiare LE BIGOT [Thu, 28 Aug 2014 09:32:49 +0000 (11:32 +0200)] 
Report container exit status to monitord

When managing containers, I need to take action based on container
exit status. For instance, if it exited abnormally (status!=0), I
sometime want to respawn it automatically. Or, when invoking
`lxc-stop` I want to know if it terminated gracefully (ie on `SIGTERM`)
or on `SIGKILL` after a timeout.

This patch adds a new message type `lxc_msg_exit_code,` to preserve
ABI. It sends the raw status code as returned by `waitpid` so that
listening application may want to apply `WEXITSTATUS` before. This is
what `lxc-monitor` does.

Signed-off-by: Jean-Tiare LE BIGOT <jean-tiare.le-bigot@ovh.net>
10 years agolxc-cgm: fix issue with nested chowning
Serge Hallyn [Fri, 29 Aug 2014 14:20:44 +0000 (14:20 +0000)] 
lxc-cgm: fix issue with nested chowning

To ask cgmanager to chown files as an unpriv user, we must send the
request from the container's namespace (with our own userid also
mapped in).  However when we create a new namespace then we must
open a new dbus connection, so that our credential and the credential
on the dbus socket match.  Otherwise the proxy will refuse the request.

Because we were warning about this failure but not exiting, the failure
was not noticed until the unprivileged container went on to try to
administer its cgroups, i.e. creating a container inside itself.

Fix this by having the do_chown_cgroup create a new cgmanager connection.
In order to reduce the number of connections, since the list of subsystems
is global anyway, don't call do_chown_cgroup once for each controller,
just call it once and have it run over all controllers.

(This patch does not change the fact that we don't fail if the
chown failed.  I think we should change that, but let's do it in a
later patch)

Reported-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agohandle hashed command socket names (v2)
S.Çağlar Onur [Mon, 25 Aug 2014 23:54:51 +0000 (19:54 -0400)] 
handle hashed command socket names (v2)

With the new hashed command socket names (e85898415c), it's possible to
have something like below;

[caglar@qop:~/go/src/github.com/lxc/go-lxc(master)] cat /proc/net/unix | grep lxc
000000000000000000000002 00000000 00010000 0001 01 53465 @lxc/d086e835c86f4b8d/command
[...]

list_active_containers reads /proc/net/unix to find all running
containers but this new format no longer includes the container name or
its lxcpath.

This patch introduces two new commands (LXC_CMD_GET_NAME and
LXC_CMD_GET_LXCPATH) and starts to use those in list_active_containers
call.

changes since v1:
 - added sanity check proposed by Serge

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agobuild: Make setup.py run from srcdir to avoid distutils errors
Daniel Miranda [Mon, 25 Aug 2014 21:16:43 +0000 (18:16 -0300)] 
build: Make setup.py run from srcdir to avoid distutils errors

distutils can't handle paths to source files containing '..'. It will
try to navigate away from the build directory and fail. To fix that,
before building the python module, transform all the path variables then
cd to the srcdir, and set the build directory manually.

This is hopefully the last needed fix to use separate build and
source diretories.

Signed-off-by: Daniel Miranda <danielkza2@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agobuild: don't remove configuration template on clean
Daniel Miranda [Mon, 25 Aug 2014 21:16:42 +0000 (18:16 -0300)] 
build: don't remove configuration template on clean

Now that default.conf is generated/linked during the configuration
phase, it should not longer be removed in the 'clean' stage, or
subsequent builds will fail. Only remove it during 'dist-clean'.

Signed-off-by: Daniel Miranda <danielkza2@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agotests: Copy the download cache when available [v2]
Stéphane Graber [Mon, 25 Aug 2014 13:56:50 +0000 (09:56 -0400)] 
tests: Copy the download cache when available [v2]

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoPrevent compiler warning by initializing ifindex
Stéphane Graber [Mon, 25 Aug 2014 19:47:35 +0000 (15:47 -0400)] 
Prevent compiler warning by initializing ifindex

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdditional checks in ALTLinux template
Denis Pynkin [Tue, 19 Aug 2014 15:31:03 +0000 (18:31 +0300)] 
Additional checks in ALTLinux template

Added check of services in container before start or stop.
Added check of syslog config existence prior changing.

Signed-off-by: Denis Pynkin <dans@altlinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agostatvfs: do nothing if statvfs does not exist (android/bionic)
Serge Hallyn [Fri, 22 Aug 2014 21:23:56 +0000 (16:23 -0500)] 
statvfs: do nothing if statvfs does not exist (android/bionic)

If statvfs does not exist, then don't recalculate mount flags
at remount.

If someone does need this, they could replace the code (only
if !HAVE_STATVFS) with code parsing /proc/self/mountinfo (which
exists in the recent git history)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc_mount_auto_mounts: honor existing nodev etc at remounts
Serge Hallyn [Wed, 20 Aug 2014 23:18:40 +0000 (23:18 +0000)] 
lxc_mount_auto_mounts: honor existing nodev etc at remounts

Same problem as we had with mount_entry().  lxc_mount_auto_mounts()
sometimes does bind mount followed by remount to change options.
With recent kernels it must pass any preexisting NODEV/NOSUID/etc
flags.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agomount_entry: use statvfs
Serge Hallyn [Wed, 20 Aug 2014 22:51:43 +0000 (22:51 +0000)] 
mount_entry: use statvfs

Use statvfs instead of parsing /proc/self/mountinfo to check for the
flags we need to and into the msbind mount flags.  This will be faster
and the code is cleaner.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agobuild: Fix support for split build and source dirs
Daniel Miranda [Thu, 21 Aug 2014 10:56:39 +0000 (07:56 -0300)] 
build: Fix support for split build and source dirs

Building LXC in a separate target directory, by running configure from
outside the source tree, failed with multiple errors, mostly in the
Python and Lua extensions, due to assuming the source dir and build dir
are the same in a few places. To fix that:

- Pre-process setup.py with the appropriate directories at configure
  time
- Introduce the build dir as an include path in the Lua Makefile
- Link the default container configuration file from the alternatives
  in the configure stage, instead of setting a variable and using it
  in the Makefile

Signed-off-by: Daniel Miranda <danielkza2@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>