]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
10 years agolxc-start-ephemeral: handle the overlayfs workdir option (v2)
Serge Hallyn [Tue, 13 Jan 2015 00:08:37 +0000 (00:08 +0000)] 
lxc-start-ephemeral: handle the overlayfs workdir option (v2)

We fixed this some time ago for basic lxc-start, but never did
lxc-start-ephemeral.

Since the lxc-start patches were pushed, Miklos has given us a
way to detect whether we need the workdir= option.  So the
bdev.c code could be simplified to check for "overlay\n" in
/proc/filesystems just as lxc-start-ephemeral does.  This
patch doesn't do that.

Changelog (v2):
1. use 'overlay' fstype for new overlay upstream module
2. avoid using unneeded readlines().

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodoc: clarify the description of the veth network type in the manpage.
Michael Adam [Tue, 13 Jan 2015 21:27:08 +0000 (22:27 +0100)] 
doc: clarify the description of the veth network type in the  manpage.

Signed-off-by: Michael Adam <obnox@samba.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodecide whether daemonize implies close_all_fds at start
Serge Hallyn [Tue, 13 Jan 2015 05:07:28 +0000 (23:07 -0600)] 
decide whether daemonize implies close_all_fds at start

This isn't the perfect fix.  In fact close_all_fds shouldn't be stored
in the lxc_conf.  But this will fix the tests short-term.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoRevert "set close-all-fds by default"
Serge Hallyn [Tue, 13 Jan 2015 05:06:01 +0000 (23:06 -0600)] 
Revert "set close-all-fds by default"

it has unfortunate reprecussions elsewhere, and the needed fix
can be done another way

This reverts commit 1f76453a74f555e30384591567d87b5b4dac7e21.

10 years agocontainertests: don't expect NULL lxc_conf
Serge Hallyn [Tue, 13 Jan 2015 04:24:26 +0000 (22:24 -0600)] 
containertests: don't expect NULL lxc_conf

Because we never have that any more

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix reversed args in mount call
Serge Hallyn [Fri, 9 Jan 2015 22:00:28 +0000 (22:00 +0000)] 
Fix reversed args in mount call

Riya Khanna reported that with a ramfs rootfs the mount to make
/ rprivate was returning -EFAULT.  NULL was being passed as the
mount target.  Pass "/" instead.

Reported-by: riya khanna <riyakhanna1983@gmail.com>>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoset close-all-fds by default
Serge Hallyn [Fri, 9 Jan 2015 16:33:42 +0000 (16:33 +0000)] 
set close-all-fds by default

When containers request to be daemonized, close-all-fd is
set to true.  But when we switched ot daemonize-by-default we didn't
set close-all-fd by default.

Fix that.  In order to do that we have to always have a lxc_conf
object.  As a consequence, after this patch we can drop a bunch
of checks for c->lxc_conf existing.  We should consider removing
those.  This patch does not do that.

This should close https://github.com/lxc/lxc/issues/354

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-fedora: let help text fit into 80 columns
Michael Adam [Thu, 8 Jan 2015 09:22:18 +0000 (10:22 +0100)] 
lxc-fedora: let help text fit into 80 columns

by breaking and shortening some lines.

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-fedora: protect possibly unset variable with quotes for -z check
Michael Adam [Thu, 8 Jan 2015 09:01:18 +0000 (10:01 +0100)] 
lxc-fedora: protect possibly unset variable with quotes for -z check

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-fedora: fix parsing of option "--clean": it takes no argument
Michael Adam [Thu, 8 Jan 2015 09:00:06 +0000 (10:00 +0100)] 
lxc-fedora: fix parsing of option "--clean": it takes no argument

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-centos: protect possibly unset variable with quotes for -z check
Michael Adam [Thu, 8 Jan 2015 09:03:53 +0000 (10:03 +0100)] 
lxc-centos: protect possibly unset variable with quotes for -z check

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-centos: fix tab/space mixup in help text.
Michael Adam [Thu, 8 Jan 2015 09:03:31 +0000 (10:03 +0100)] 
lxc-centos: fix tab/space mixup in help text.

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-centos: fix parsing of option "--clean": it takes no argument
Michael Adam [Thu, 8 Jan 2015 09:03:05 +0000 (10:03 +0100)] 
lxc-centos: fix parsing of option "--clean": it takes no argument

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-openmandriva: protect possibly unset variable with quotes in -z check
Michael Adam [Thu, 8 Jan 2015 09:49:19 +0000 (10:49 +0100)] 
lxc-openmandriva: protect possibly unset variable with quotes in -z check

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-openmandriva: fix parsing of option "--clean": it takes no argument
Michael Adam [Thu, 8 Jan 2015 09:48:40 +0000 (10:48 +0100)] 
lxc-openmandriva: fix parsing of option "--clean": it takes no argument

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-altlinux: protect possibly unset variable with quotes for -z check
Michael Adam [Thu, 8 Jan 2015 09:43:52 +0000 (10:43 +0100)] 
lxc-altlinux: protect possibly unset variable with quotes for -z check

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-altlinux: fix parsing of option "--clean": it takes no argument
Michael Adam [Thu, 8 Jan 2015 09:43:12 +0000 (10:43 +0100)] 
lxc-altlinux: fix parsing of option "--clean": it takes no argument

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-opensuse: protect possibly unset variable with quotes in -z check
Michael Adam [Thu, 8 Jan 2015 09:36:06 +0000 (10:36 +0100)] 
lxc-opensuse: protect possibly unset variable with quotes in -z check

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-opensuse: fix parsing of option "--clean": it takes no argument
Michael Adam [Thu, 8 Jan 2015 09:35:20 +0000 (10:35 +0100)] 
lxc-opensuse: fix parsing of option "--clean": it takes no argument

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-opensuse: fix tab/whitespace mixup in usage text.
Michael Adam [Thu, 8 Jan 2015 09:34:49 +0000 (10:34 +0100)] 
lxc-opensuse: fix tab/whitespace mixup in usage text.

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-debian: protect possibly unset variable with quotes for -z check
Michael Adam [Thu, 8 Jan 2015 08:58:09 +0000 (09:58 +0100)] 
lxc-debian: protect possibly unset variable with quotes for -z check

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-debian: document "--clean" in the usage.
Michael Adam [Thu, 8 Jan 2015 08:38:48 +0000 (09:38 +0100)] 
lxc-debian: document "--clean" in the usage.

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-debian: fix parsing of option "--clean": it takes no argument.
Michael Adam [Thu, 8 Jan 2015 08:32:39 +0000 (09:32 +0100)] 
lxc-debian: fix parsing of option "--clean": it takes no argument.

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoMerge pull request #393 from martinpitt/master
hallyn [Thu, 8 Jan 2015 16:57:57 +0000 (10:57 -0600)] 
Merge pull request #393 from martinpitt/master

apparmor: Fix slave bind mounts

10 years agoapparmor: Fix slave bind mounts 393/head
Martin Pitt [Thu, 8 Jan 2015 12:09:37 +0000 (13:09 +0100)] 
apparmor: Fix slave bind mounts

The permission to make a mount "slave" is spelt "make-slave", not "slave", see
https://launchpad.net/bugs/1401619. Also, we need to make all mounts slave, not
just the root dir.

https://launchpad.net/bugs/1350947

10 years agoAlso drop caps in unpriv containers
Stéphane Graber [Thu, 25 Dec 2014 23:17:25 +0000 (00:17 +0100)] 
Also drop caps in unpriv containers

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoapparmor: Block access to /proc/kcore
Stéphane Graber [Sun, 28 Dec 2014 17:33:29 +0000 (18:33 +0100)] 
apparmor: Block access to /proc/kcore

Just like we block access to mem and kmem, there's no good reason for
the container to have access to kcore.

Reported-by: Marc Schaefer
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-alpine: use yaml for detection of latest release
Natanael Copa [Wed, 31 Dec 2014 07:31:45 +0000 (08:31 +0100)] 
lxc-alpine: use yaml for detection of latest release

Alpine Linux provides yaml files with latest release instead of the old
approach with .latest.txt.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-fedora: In fedora21, the fedora-repos package is needed.
Michael Adam [Fri, 2 Jan 2015 19:28:59 +0000 (20:28 +0100)] 
lxc-fedora: In fedora21, the fedora-repos package is needed.

fedora-release has been split into fedora-release and fedora-repos.

Signed-off-by: Michael Adam <obnox@samba.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-fedora: when using systemd, set lxc.kmsg = 0 in the config
Michael Adam [Fri, 2 Jan 2015 20:12:21 +0000 (21:12 +0100)] 
lxc-fedora: when using systemd, set lxc.kmsg = 0 in the config

This is to prevent systemd-journald to enter a 100% cpu loop.

Signed-off-by: Michael Adam <obnox@samba.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-opensuse: Disable building openSUSE containers on 13.2/Tumbleweed only if wrong...
Johannes Kastl [Wed, 17 Dec 2014 20:06:34 +0000 (21:06 +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:51:21 +0000 (21:51 +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 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 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 agochange version to 1.1.0.alpha3 in configure.ac lxc-1.1.0.alpha3
Stéphane Graber [Wed, 3 Dec 2014 19:59:15 +0000 (14:59 -0500)] 
change version to 1.1.0.alpha3 in configure.ac

Signed-off-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 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 agodoc: Always include the Japanese lxc-top manpage
KATOH Yasufumi [Tue, 2 Dec 2014 09:20:15 +0000 (18:20 +0900)] 
doc: Always include the Japanese lxc-top manpage

Update for commit e71549f

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoAdd the Japanese translation for the lxc.init_cmd config option
KATOH Yasufumi [Tue, 2 Dec 2014 09:15:34 +0000 (18:15 +0900)] 
Add the Japanese translation for the lxc.init_cmd config option

Update for commit 67c660d

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoRevert "audit: added capacity and reserve() to nlmsg"
Stéphane Graber [Mon, 1 Dec 2014 20:37:42 +0000 (15:37 -0500)] 
Revert "audit: added capacity and reserve() to nlmsg"

This reverts commit 55ae7edb18c503a4b869dd0089f25f03a05a6563.

This change caused hangs in the testsuite, specifically with lxc-user-nic.

Signed-off-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 agoIssue #278: lxc-start-ephemeral: add --cdir option for cow-mounts
overlay fs [Wed, 26 Nov 2014 17:11:43 +0000 (04:11 +1100)] 
Issue #278: lxc-start-ephemeral: add --cdir option for cow-mounts

This is a copy of patch version 3 for issue #278 on the issue-tracker:

 - Allow multiple bind-mounts (--bdir) and multiple cow-mounts (--cdir).

 - Further fixes to permissions throughout lxc-start-ephemeral (annotated
   in the code).

Signed-off by: Oleg Freedholm <overlayfs@gmail.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 agodoc: Always include the lxc-top manpage
Stéphane Graber [Thu, 27 Nov 2014 19:33:30 +0000 (14:33 -0500)] 
doc: Always include the lxc-top manpage

Since it's no longer written in lua.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoDefine a new lxc.init_cmd config option
Stéphane Graber [Wed, 26 Nov 2014 19:33:27 +0000 (14:33 -0500)] 
Define a new lxc.init_cmd config option

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Dwight Engen <dwight.engen@oracle.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 agoAdd missing files to ignore list
Stéphane Graber [Wed, 26 Nov 2014 20:28:38 +0000 (15:28 -0500)] 
Add missing files to ignore list

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Dwight Engen <dwight.engen@oracle.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 agolxc-opensuse: Disable on 13.2
Johannes Kastl [Wed, 26 Nov 2014 19:20:05 +0000 (20:20 +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 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 agoFix nbd partition id test
Stéphane Graber [Wed, 26 Nov 2014 21:40:04 +0000 (16:40 -0500)] 
Fix nbd partition id test

Reported-by: David Binderman
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 agodoc: change "-t" option of lxc-create(1) to being required
KATOH Yasufumi [Wed, 26 Nov 2014 07:20:54 +0000 (16:20 +0900)] 
doc: change "-t" option of lxc-create(1) to being required

* fix "reg" to "req" in English (fix for commit b8683fe)
* change "opt" to "req" in Japanese

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-opensuse: Check if given argument is a valid release
Johannes Kastl [Fri, 14 Nov 2014 20:57:33 +0000 (21:57 +0100)] 
lxc-opensuse: Check if given argument is a valid release

Signed-off-by: Johannes Kastl <git@ojkastl.de>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-opensuse: Added explanation on how to use the template
Johannes Kastl [Thu, 6 Nov 2014 15:29:25 +0000 (16:29 +0100)] 
lxc-opensuse: Added explanation on how to use the template

Signed-off-by: Johannes Kastl <git@ojkastl.de>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-opensuse: template now understands release arguments
Johannes Kastl [Thu, 6 Nov 2014 15:24:40 +0000 (16:24 +0100)] 
lxc-opensuse: template now understands release arguments

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 agoopenwrt: add common configuration file
Petar Koretic [Thu, 30 Oct 2014 12:41:49 +0000 (12:41 +0000)] 
openwrt: add common configuration file

This adds OpenWrt common config file.

Signed-off-by: Petar Koretic <petar.koretic@sartura.hr>
CC: Luka Perkov <luka.perkov@sartura.hr>
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 agolua: fix return value of attach() method
Dwight Engen [Mon, 17 Nov 2014 17:33:38 +0000 (12:33 -0500)] 
lua: fix return value of attach() method

Add simple test case for attach() method. Add assert for return value
from create() method which also returns a boolean.

Signed-off-by: Dwight Engen <dwight.engen@oracle.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-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 agoMerge pull request #358 from silvio/sfr/bugfix-freed-return-value
hallyn [Thu, 20 Nov 2014 23:37:51 +0000 (17:37 -0600)] 
Merge pull request #358 from silvio/sfr/bugfix-freed-return-value

lxc/utils: bugfix freed pointer return value

10 years agolxc/utils: bugfix freed pointer return value 358/head
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 agoMerge pull request #356 from silvio/sfr/utils-choose-init
hallyn [Tue, 18 Nov 2014 15:07:45 +0000 (09:07 -0600)] 
Merge pull request #356 from silvio/sfr/utils-choose-init

lxc/utils: improve choose_init code readability

10 years agoMerge pull request #353 from ashtoreth/master
Dwight Engen [Mon, 17 Nov 2014 16:48:36 +0000 (11:48 -0500)] 
Merge pull request #353 from ashtoreth/master

added container:attach() into the Lua API

10 years agolxc/utils: improve choose_init code readability 356/head
Silvio Fricke [Wed, 12 Nov 2014 07:38:59 +0000 (08:38 +0100)] 
lxc/utils: improve choose_init code readability

Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
10 years agoUpdate core.c 353/head
ashtoreth [Sat, 8 Nov 2014 14:04:32 +0000 (16:04 +0200)] 
Update core.c

fixed indent and vars

10 years agoadded container:attach() into the Lua API
PiXy [Fri, 7 Nov 2014 09:04:42 +0000 (11:04 +0200)] 
added container:attach() into the Lua API

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 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 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 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 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 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 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 agoc/r: put lxc-restore-net in /usr/share
Tycho Andersen [Wed, 22 Oct 2014 22:25:02 +0000 (22:25 +0000)] 
c/r: put lxc-restore-net in /usr/share

On restore, we pass criu a script to manage the network interfaces (i.e. the
full path to lxc-restore-net), which we previously installed into
/var/lib/<tuple>/lxc. However, this is also the directory that is the default
for use in mounting the rootfs locally before pivot_root()ing. So, we mounted
the rootfs and then happliy called criu, pointing it to this directory which
didn't have lxc-restore-net any more, it just had the container's rootfs.
Instead, we should put lxc-restore-net somewhere else, so that criu can still
see it after the rootfs is mounted.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@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>