]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
8 years agoMerge pull request #864 from brauner/bugfix_branch
Stéphane Graber [Wed, 2 Mar 2016 15:04:04 +0000 (10:04 -0500)]
Merge pull request #864 from brauner/bugfix_branch

Add features/small improvements to man pages (lxc-attach, lxc-copy)

8 years agolxc-copy: update help to include hook options
Christian Brauner [Wed, 2 Mar 2016 13:14:06 +0000 (14:14 +0100)]
lxc-copy: update help to include hook options

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agolxc-copy: add copy hook explanation to manpage
Christian Brauner [Wed, 2 Mar 2016 13:06:52 +0000 (14:06 +0100)]
lxc-copy: add copy hook explanation to manpage

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agolxc-attach: small improvements to manpage
Christian Brauner [Wed, 2 Mar 2016 11:48:38 +0000 (12:48 +0100)]
lxc-attach: small improvements to manpage

Explain that the pipe symbol needs to be escaped for -e and -s.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #863 from brauner/bugfix_branch
Stéphane Graber [Tue, 1 Mar 2016 22:40:11 +0000 (17:40 -0500)]
Merge pull request #863 from brauner/bugfix_branch

lxc-copy: correct order of copy and original & lxc-attach: setup ts->stdoutfd

8 years agolxc-attach: setup ts->stdoutfd
Christian Brauner [Tue, 1 Mar 2016 22:05:59 +0000 (23:05 +0100)]
lxc-attach: setup ts->stdoutfd

Otherwise we cannot do things like:

- lxc-attach -n a runlevel </dev/null
- lxc-attach -n a runlevel </dev/null 2>/dev/null
- lxc-attach -n a runlevel </dev/null 2>/dev/null | cat

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agolxc-copy: correct order of copy and original
Christian Brauner [Tue, 1 Mar 2016 20:50:55 +0000 (21:50 +0100)]
lxc-copy: correct order of copy and original

lxc-copy -n ORIG -N COPY -e

accidently printed

"Created ORIG as clone of COPY"

instead of

"Created COPY as clone of ORIG".
Fix the ordering.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #862 from brauner/2016-03-01/post_stop_fail_no_reboot
Stéphane Graber [Tue, 1 Mar 2016 16:53:51 +0000 (11:53 -0500)]
Merge pull request #862 from brauner/2016-03-01/post_stop_fail_no_reboot

start.c: do not reboot on lxc.hook.post-stop fail

8 years agostart.c: do not reboot on lxc.hook.post-stop fail
Christian Brauner [Tue, 1 Mar 2016 09:42:45 +0000 (10:42 +0100)]
start.c: do not reboot on lxc.hook.post-stop fail

lxc should not reboot the container when lxc.hook.post-stop fails. It should
simply shutdown. This makes the behavior of lxc.hook.post-stop and
lxc.hook.pre-start consistent. When lxc.hook.pre-start fails, the container
does not start.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #859 from brauner/bugfix_branch
Serge Hallyn [Mon, 29 Feb 2016 22:18:10 +0000 (14:18 -0800)]
Merge pull request #859 from brauner/bugfix_branch

lxc-attach: always allocate current controlling pty

8 years agolxc-attach: always allocate current controlling pty
Christian Brauner [Mon, 29 Feb 2016 09:52:43 +0000 (10:52 +0100)]
lxc-attach: always allocate current controlling pty

lxc-attach uses lxc_console_create() to allocate a pty on the host.
lxc_console_create() in turn calls lxc_console_peer_default() which either
makes the current controlling pty our controlling pty for the container, or
uses whatever the user gave us (e.g. /dev/tty2 etc.). For lxc-attach we always
want the current controlling pty to be used. This commit ensures that we're in
fact always using the current controlling pty. The commit also fixes a segfault
when the user specified lxc.console.path = none.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #857 from brauner/bugfix_branch
Serge Hallyn [Sat, 27 Feb 2016 18:46:09 +0000 (10:46 -0800)]
Merge pull request #857 from brauner/bugfix_branch

cgfs: don't chown/chmod/rm non-existing paths

8 years agocgfs: don't chown/chmod/rm non-existing paths
Christian Brauner [Sat, 27 Feb 2016 16:00:45 +0000 (17:00 +0100)]
cgfs: don't chown/chmod/rm non-existing paths

Dirty fix for the current noisiness when lxc_cgroupfs_create() could not create
cgroups.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agochange version to 2.0.0.rc4 in configure.ac
Stéphane Graber [Sat, 27 Feb 2016 03:30:43 +0000 (22:30 -0500)]
change version to 2.0.0.rc4 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #856 from hallyn/2016-02-26/cgfs.cgns.2
Christian Brauner [Fri, 26 Feb 2016 22:08:22 +0000 (23:08 +0100)]
Merge pull request #856 from hallyn/2016-02-26/cgfs.cgns.2

cgfs: ignore mount prefix in mountinfo if cgroup namespaces are suppo…

8 years agocgfs: ignore mount prefix in mountinfo if cgroup namespaces are supported
Serge Hallyn [Fri, 26 Feb 2016 21:35:24 +0000 (13:35 -0800)]
cgfs: ignore mount prefix in mountinfo if cgroup namespaces are supported

This is not 100% correct, but will suffice until we fix the kernel so that
we can distinguish between bind mounts and namespaced cgroupfs mounts.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #855 from hallyn/2016-02-26/cgfs.crucial
Christian Brauner [Fri, 26 Feb 2016 20:55:27 +0000 (21:55 +0100)]
Merge pull request #855 from hallyn/2016-02-26/cgfs.crucial

fix cgfs failure for unpriv users

8 years agofix cgfs failure for unpriv users
Serge Hallyn [Fri, 26 Feb 2016 20:03:09 +0000 (20:03 +0000)]
fix cgfs failure for unpriv users

Cgmanager was taught awhile ago that only some cgroup controllers are
crucial.  Teach cgfs the same thing.

This patch needs improvement, but will fix failure of lxc without cgmanager
for unprivileged users for now.  In particular, needed improvements include:

1. the check for crucial subsystems needs to include lxc.use
2. we should keep a list of the actually used subsystems so we don't keep
trying to chmod and enter after create has found we couldn't use a particular
subsystem

This fixes unprivileged lxc use.  It does not appear to suffice to fix
nested unprivilegd lxd usage.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #751 from jirutka/alpine-tmpl
Christian Brauner [Fri, 26 Feb 2016 14:46:02 +0000 (15:46 +0100)]
Merge pull request #751 from jirutka/alpine-tmpl

Rewrite template script for Alpine Linux

8 years agoMerge pull request #852 from brauner/bugfix_branch
Stéphane Graber [Fri, 26 Feb 2016 14:44:05 +0000 (09:44 -0500)]
Merge pull request #852 from brauner/bugfix_branch

lxc-ls: count spaces

8 years agolxc-alpine: allow to install additional packages
Jakub Jirutka [Sun, 21 Feb 2016 00:31:19 +0000 (01:31 +0100)]
lxc-alpine: allow to install additional packages

Signed-off-by: Jakub Jirutka <jakub@jirutka.cz>
8 years agolxc-alpine: cache APK packages instead of rootfs
Jakub Jirutka [Sun, 21 Feb 2016 00:03:03 +0000 (01:03 +0100)]
lxc-alpine: cache APK packages instead of rootfs

Signed-off-by: Jakub Jirutka <jakub@jirutka.cz>
8 years agolxc-alpine: remove all bashisms, make it compatible with dash
Jakub Jirutka [Sun, 7 Feb 2016 14:04:13 +0000 (15:04 +0100)]
lxc-alpine: remove all bashisms, make it compatible with dash

Signed-off-by: Jakub Jirutka <jakub@jirutka.cz>
8 years agolxc-alpine: make it compatible with ash, replace curl and rsync
Jakub Jirutka [Sat, 23 Jan 2016 17:55:58 +0000 (18:55 +0100)]
lxc-alpine: make it compatible with ash, replace curl and rsync

Now it runs even on minimal Alpine system without bash, curl, openssl or
rsync.

Signed-off-by: Jakub Jirutka <jakub@jirutka.cz>
8 years agolxc-alpine: completely rewrite the template script
Jakub Jirutka [Mon, 4 Jan 2016 21:20:09 +0000 (22:20 +0100)]
lxc-alpine: completely rewrite the template script

New template script is more readable and robust, uses cache and external
LXC config file as other templates.

Signed-off-by: Jakub Jirutka <jakub@jirutka.cz>
8 years agoMerge pull request #854 from ysbnim/master
Christian Brauner [Fri, 26 Feb 2016 11:48:23 +0000 (12:48 +0100)]
Merge pull request #854 from ysbnim/master

Update Korean manuals

8 years agoMerge pull request #853 from tenforward/japanese_man
Christian Brauner [Fri, 26 Feb 2016 11:45:48 +0000 (12:45 +0100)]
Merge pull request #853 from tenforward/japanese_man

doc: Update Japanese lxc-attach(1)

8 years agodoc: Update Japanese lxc-attach(1)
KATOH Yasufumi [Fri, 26 Feb 2016 11:05:09 +0000 (20:05 +0900)]
doc: Update Japanese lxc-attach(1)

Update the description of pty allocation. Update for commit 478dda7.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
8 years agodoc: Add the Korean description that automount is ignored when cgroup namespaces...
Sungbae Yoo [Fri, 26 Feb 2016 10:32:12 +0000 (19:32 +0900)]
doc: Add the Korean description that automount is ignored when cgroup namespaces are supported.

Update for commit 4608594

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
8 years agodoc: Update Korean lxc-clone(1) and lxc-start-ephemeral(1)
Sungbae Yoo [Fri, 26 Feb 2016 10:16:07 +0000 (19:16 +0900)]
doc: Update Korean lxc-clone(1) and lxc-start-ephemeral(1)

Update for commit 2ae6732.

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
8 years agodoc: Update Korean lxc-attach(1)
Sungbae Yoo [Fri, 26 Feb 2016 09:39:09 +0000 (18:39 +0900)]
doc: Update Korean lxc-attach(1)

Update for commit e986ea3

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
8 years agodoc: Add the Korean description of cgns apparmor profile in lxc.container.conf
Sungbae Yoo [Thu, 25 Feb 2016 06:39:00 +0000 (15:39 +0900)]
doc: Add the Korean description of cgns apparmor profile in lxc.container.conf

Update for commit 7a126ae

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
8 years agodoc: Add LXC_CGNS_AWARE env to Korean lxc.container.conf(5)
Sungbae Yoo [Thu, 25 Feb 2016 06:21:10 +0000 (15:21 +0900)]
doc: Add LXC_CGNS_AWARE env to Korean lxc.container.conf(5)

Update for commit c4cafa0

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
8 years agolxc-ls: count spaces
Christian Brauner [Fri, 26 Feb 2016 10:18:47 +0000 (11:18 +0100)]
lxc-ls: count spaces

Otherwise line wrapping might occur too late.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #851 from tych0/set-sid-in-init
Serge Hallyn [Fri, 26 Feb 2016 01:00:20 +0000 (17:00 -0800)]
Merge pull request #851 from tych0/set-sid-in-init

start: setsid in init task as well

8 years agostart: setsid in init task as well
Tycho Andersen [Fri, 26 Feb 2016 00:04:01 +0000 (17:04 -0700)]
start: setsid in init task as well

If we don't do this, we'll leak the parent's session id to the container,
which maybe doesn't matter, but it still seems better to set it anyway.

Also, it breaks CRIU for containers that don't call setsid themselves.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
8 years agoMerge pull request #849 from brauner/2016-02-25/fix_attach_container_put
Serge Hallyn [Thu, 25 Feb 2016 19:48:26 +0000 (11:48 -0800)]
Merge pull request #849 from brauner/2016-02-25/fix_attach_container_put

lxc-attach: rework pty allocation

8 years agoMerge pull request #850 from hallyn/2016-02-25/cgfs.lxcfs
Stéphane Graber [Thu, 25 Feb 2016 19:39:28 +0000 (14:39 -0500)]
Merge pull request #850 from hallyn/2016-02-25/cgfs.lxcfs

cgfs: make sure we use valid cgroup mountpoints

8 years agocgfs: make sure we use valid cgroup mountpoints
Serge Hallyn [Thu, 25 Feb 2016 19:01:12 +0000 (11:01 -0800)]
cgfs: make sure we use valid cgroup mountpoints

If lxcfs starts before cgroup-lite, then the first cgroup mountpoints in
/proc/self/mountinfo are /run/lxcfs/*.  Unprivileged users cannot access
these.  So privileged containers are ok, and unprivileged containers are ok
since they won't cache those to begin with.  But unprivileged root-owned
containers cache /run/lxcfs/* and then try to use them.

So when doing cgroup automounting check whether the mountpoints we have
stored are accessible, and if not look for a new one to use.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agolxc-attach: rework pty allocation
Christian Brauner [Thu, 25 Feb 2016 14:22:53 +0000 (15:22 +0100)]
lxc-attach: rework pty allocation

Previously we implemented two ways to get a pty for lxc-attach:
1. get a pty in the container
2. get a pty on the host

Where 1. was the default and 2. was only tried after 1. failed.
For safety and simplicity reasons, we remove 1. and just keep 2. around.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #847 from tenforward/japanese_man
Christian Brauner [Thu, 25 Feb 2016 07:57:21 +0000 (08:57 +0100)]
Merge pull request #847 from tenforward/japanese_man

Update Japanese man

8 years agodoc: Update Japanese lxc.container.conf(5)
KATOH Yasufumi [Thu, 25 Feb 2016 06:38:30 +0000 (15:38 +0900)]
doc: Update Japanese lxc.container.conf(5)

- Add the description that automount is ignored when cgroup namespaces
  are supported. Update for commit 4608594.
- Unify terminology of translation

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
8 years agodoc: Update Japanese lxc-clone(1) and lxc-start-ephemeral(1)
KATOH Yasufumi [Thu, 25 Feb 2016 06:15:41 +0000 (15:15 +0900)]
doc: Update Japanese lxc-clone(1) and lxc-start-ephemeral(1)

describe that lxc-clone and lxc-start-ephemeral have been deprecated
in those man pages.
Update for commit 2ae6732.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
8 years agochange version to 2.0.0.rc3 in configure.ac
Stéphane Graber [Thu, 25 Feb 2016 02:13:20 +0000 (21:13 -0500)]
change version to 2.0.0.rc3 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #846 from hallyn/2016-02-24/cgns.auto
Stéphane Graber [Thu, 25 Feb 2016 02:11:29 +0000 (21:11 -0500)]
Merge pull request #846 from hallyn/2016-02-24/cgns.auto

cgfs: do not automount if cgroup namespaces are supported

8 years agocgfs: do not automount if cgroup namespaces are supported
Serge Hallyn [Thu, 25 Feb 2016 01:00:35 +0000 (17:00 -0800)]
cgfs: do not automount if cgroup namespaces are supported

In that case containers will be able to mount cgroup filesystems
for themselves as they do on a host.

This fixes inability to start systemd based containers on cgns-enabled
kernels with cgmanager not running.

I've tested debian jessie, busybox, ubuntu trusty and xenial, all of
which booted ok.  However if there are some setups which require
premounted cgroupfs (i.e. they don't mount if they detect being in
a container), this may cause trouble.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #844 from brauner/2016-02-22/manpage_update
Stéphane Graber [Thu, 25 Feb 2016 01:35:26 +0000 (20:35 -0500)]
Merge pull request #844 from brauner/2016-02-22/manpage_update

configure.ac: add --enable-deprecated flag

8 years agoconfigure.ac: add --enable-deprecated flag
Christian Brauner [Wed, 24 Feb 2016 18:28:12 +0000 (19:28 +0100)]
configure.ac: add --enable-deprecated flag

- lxc-clone and lxc-start-ephemeral are marked deprecated. We add a
  --enable-deprecated flag to configure.ac allowing us to enable these
  deprecated executables
- update tests to use lxc-copy instead of lxc-clone

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agomark lxc-clone & lxc-start-ephemeral as deprecated
Christian Brauner [Tue, 23 Feb 2016 23:02:49 +0000 (00:02 +0100)]
mark lxc-clone & lxc-start-ephemeral as deprecated

- add deprecation not to man pages
- print deprecation info to stderr when the executables are invoked

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #843 from tenforward/japanese_man
Christian Brauner [Wed, 24 Feb 2016 09:10:20 +0000 (10:10 +0100)]
Merge pull request #843 from tenforward/japanese_man

Update Japanese man

8 years agodoc: Update Japanese lxc-clone(1) and lxc-start-ephemeral(1)
KATOH Yasufumi [Wed, 24 Feb 2016 09:04:40 +0000 (18:04 +0900)]
doc: Update Japanese lxc-clone(1) and lxc-start-ephemeral(1)

Update for commit 02e5d92

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
8 years agodoc: Update Japanese lxc-attach(1)
KATOH Yasufumi [Wed, 24 Feb 2016 09:04:05 +0000 (18:04 +0900)]
doc: Update Japanese lxc-attach(1)

Update for commit e986ea3

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
8 years agoMerge pull request #841 from brauner/2016-02-22/manpage_update
Stéphane Graber [Tue, 23 Feb 2016 15:08:48 +0000 (10:08 -0500)]
Merge pull request #841 from brauner/2016-02-22/manpage_update

update manpages

8 years agoupdate manpages
Christian Brauner [Tue, 23 Feb 2016 07:08:58 +0000 (08:08 +0100)]
update manpages

- add note to lxc-clone manpage that it is superseded by lxc-copy
- add note to lxc-start-ephemeral manpage that it is superseded by lxc-copy
- fix typo in lxc-attach manpage
- fix some of my comments in lxc_ls.c

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #840 from brauner/2016-02-22/manpage_update
Stéphane Graber [Tue, 23 Feb 2016 00:27:00 +0000 (19:27 -0500)]
Merge pull request #840 from brauner/2016-02-22/manpage_update

update lxc-attach manpage

8 years agoupdate lxc-attach manpage
Christian Brauner [Mon, 22 Feb 2016 22:23:58 +0000 (23:23 +0100)]
update lxc-attach manpage

- explain rationale behind allocation of pty
- briefly explain how a pty is allocated
- add a short note that describes the changed behavior for lxc-attach when the
  user is not placed in a writeable cgroup at login

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agochange version to 2.0.0.rc2 in configure.ac
Stéphane Graber [Mon, 22 Feb 2016 18:39:01 +0000 (13:39 -0500)]
change version to 2.0.0.rc2 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #839 from brauner/2016-02-15/lxc_attach_pty
Stéphane Graber [Mon, 22 Feb 2016 15:22:59 +0000 (10:22 -0500)]
Merge pull request #839 from brauner/2016-02-15/lxc_attach_pty

lxc-attach: add comment, & implement login_tty()

8 years agolxc-attach: add comment, & implement login_tty()
Christian Brauner [Mon, 22 Feb 2016 11:27:06 +0000 (12:27 +0100)]
lxc-attach: add comment, & implement login_tty()

- The code required to prepare an fd to act as a login tty is shared among
  pty_on_host_callback() and fork_pty(). This implements login_pty(), a
  minimalistic login_tty() clone, to avoid code redundancy.
- Give pty_in_container() a slightly extended comment.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #837 from tenforward/japanese_man
Stéphane Graber [Mon, 22 Feb 2016 06:30:21 +0000 (01:30 -0500)]
Merge pull request #837 from tenforward/japanese_man

doc: Add Japanese description of cgns apparmor profile in lxc.container.conf(5)

8 years agodoc: Add Japanese description of cgns apparmor profile in lxc.container.conf(5)
KATOH Yasufumi [Mon, 22 Feb 2016 06:21:40 +0000 (15:21 +0900)]
doc: Add Japanese description of cgns apparmor profile in lxc.container.conf(5)

Update for commit 7a126ae

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
8 years agoMerge pull request #836 from hallyn/2016-02-21/cgns.aa
Stéphane Graber [Mon, 22 Feb 2016 05:37:00 +0000 (00:37 -0500)]
Merge pull request #836 from hallyn/2016-02-21/cgns.aa

2016 02 21/cgns.aa

8 years agoupdate tests to recognize cgns profile
Serge Hallyn [Mon, 22 Feb 2016 05:09:42 +0000 (21:09 -0800)]
update tests to recognize cgns profile

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agolxc.container.conf / apparmor : document cgns profile
Serge Hallyn [Mon, 22 Feb 2016 04:46:58 +0000 (20:46 -0800)]
lxc.container.conf / apparmor : document cgns profile

Also document 'unchanged' which we had never documented before.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoallow cgroup mounting in nesting profile
Serge Hallyn [Sun, 21 Feb 2016 23:52:07 +0000 (15:52 -0800)]
allow cgroup mounting in nesting profile

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoApparmor: use lxc-default-cgns if cgns is enabled
Serge Hallyn [Sun, 21 Feb 2016 23:51:37 +0000 (15:51 -0800)]
Apparmor: use lxc-default-cgns if cgns is enabled

Because containers need to - and safely can - mount cgroufs in that
case.

Note that if cgns is enabled but the unshare fails, we fail the container
start, so checking whether they are enabled is enough.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoadd lxc-default-cgns profile
Serge Hallyn [Sun, 21 Feb 2016 23:38:11 +0000 (15:38 -0800)]
add lxc-default-cgns profile

This isn't safe for privileged containers which do not use cgroup
namespaces, but is required for systemd containers with cgroup
namespaces.  So create a new profile for it which lxc will use as
the default when it knows it can.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #835 from brauner/2016-02-15/lxc_attach_pty
Stéphane Graber [Sun, 21 Feb 2016 22:44:52 +0000 (17:44 -0500)]
Merge pull request #835 from brauner/2016-02-15/lxc_attach_pty

fix android build

8 years agofix android build
Christian Brauner [Sun, 21 Feb 2016 22:14:23 +0000 (23:14 +0100)]
fix android build

bionic libc doesn't know _Exit(). Replace it with _exit().

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #825 from brauner/2016-02-15/lxc_attach_pty
Serge Hallyn [Sun, 21 Feb 2016 19:16:36 +0000 (11:16 -0800)]
Merge pull request #825 from brauner/2016-02-15/lxc_attach_pty

make lxc-attach use a pty

8 years agomake lxc-attach use a pty
Christian Brauner [Mon, 15 Feb 2016 21:10:40 +0000 (22:10 +0100)]
make lxc-attach use a pty

So far lxc-attach did not use a pty when attaching to a container. This made it
vulnerable to tty input faking via TIOCSTI when switching to a different user.
This patch makes lxc-attach use a pty in most cases. The only current exemption
is when stdin, stdout, and stderr are not referring to a pty.

There are two ways how lxc-attach can receive a pty:
1. get a pty in the container
2. get a pty on the host
This patch makes 1. the default and only opts for 2. when 1. fails before
giving up. The rationale behind this is as follows: If we create a pty on the
host (2.) and pass the fds to the container the container may report "no tty"
when the "tty" command is used. This could be irritating for users when they
expect that lxc-attach now always tries to use a pty. Hence, option 1. is the
default.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoclean exit on EPOLLHUP
Christian Brauner [Thu, 18 Feb 2016 14:20:34 +0000 (15:20 +0100)]
clean exit on EPOLLHUP

lxc_console_cb_tty_masterfd() unnecessarily reported a read/write error when
the fd was closed. This happens e.g. when we have allocated a tty in the
container with lxc-console and we shut the container down. lxc-console will
then exit with an error message. This patch introduces a test whether the
EPOLLHUP bit is set in the events mask. If so, we report no error.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agorewrite lxc_console_set_stdfds
Christian Brauner [Wed, 17 Feb 2016 18:48:54 +0000 (19:48 +0100)]
rewrite lxc_console_set_stdfds

Make lxc_console_set_stdfds useable by other callers that do not have access to
lxc_handler.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agomake tty helper functions extern
Christian Brauner [Mon, 15 Feb 2016 18:40:55 +0000 (19:40 +0100)]
make tty helper functions extern

- lxc_console_cb_tty_stdin()
- lxc_console_cb_tty_master()
- lxc_setup_tios(int fd, struct termios *oldtios);
- lxc_console_winsz(int srcfd, int dstfd);
- lxc_console_cb_sigwinch_fd(int fd, uint32_t events, void *cbdata,
struct lxc_epoll_descr *descr);
- lxc_tty_state *lxc_console_sigwinch_init(int srcfd, int dstfd);
- lxc_console_sigwinch_fini(struct lxc_tty_state *ts);

We can make use these functions in other modules.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agomake escape sequence to exit tty optional
Christian Brauner [Mon, 15 Feb 2016 18:38:32 +0000 (19:38 +0100)]
make escape sequence to exit tty optional

We want to reuse lxc_console_cb_tty_stdin() in lxc_attach.c.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #833 from mar-kolya/fix-sshd-template-init-location-for-systemd
Stéphane Graber [Sun, 21 Feb 2016 07:03:24 +0000 (02:03 -0500)]
Merge pull request #833 from mar-kolya/fix-sshd-template-init-location-for-systemd

Fix sshd template on systems with systemd

8 years agoFix sshd template on systems with systemd
Nikolay Martynov [Sun, 21 Feb 2016 06:16:15 +0000 (01:16 -0500)]
Fix sshd template on systems with systemd

Systems with systemd have /sbin/init as a symlink pointing to real init.
Sshd template tries to bind-mount special init implementation.
The problem is that one cannot bind-mount to a location that is a symlink.

Fix this by deferencing /sbin/init symling and using that as bind-mount location.

Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
8 years agodoc: add LXC_CGNS_AWARE env to Japanese lxc.container.conf(5)
KATOH Yasufumi [Sun, 21 Feb 2016 05:54:07 +0000 (00:54 -0500)]
doc: add LXC_CGNS_AWARE env to Japanese lxc.container.conf(5)

Update for commit c4cafa0

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #832 from stgraber/master
Serge Hallyn [Sat, 20 Feb 2016 05:02:01 +0000 (21:02 -0800)]
Merge pull request #832 from stgraber/master

Fix typo in lxc manpage

8 years agoFix typo in lxc manpage
Stéphane Graber [Sat, 20 Feb 2016 04:37:07 +0000 (23:37 -0500)]
Fix typo in lxc manpage

Reported-by: lintian
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #831 from hallyn/2016-02-19/cgfs
Stéphane Graber [Sat, 20 Feb 2016 03:13:36 +0000 (22:13 -0500)]
Merge pull request #831 from hallyn/2016-02-19/cgfs

2016 02 19/cgfs

8 years agolxc: cgfs: handle lxcfs
Ubuntu [Sat, 20 Feb 2016 02:25:55 +0000 (02:25 +0000)]
lxc: cgfs: handle lxcfs

When containers have lxcfs mounted instead of cgroupfs, we have to
process /proc/self/mountinfo a bit differently.  In particular, we
should look for fuse.lxcfs fstype, we need to look elsewhere for the
list of comounted controllers, and the mount_prefix is not a cgroup path
which was bind mounted, so we should ignore it, and named subsystems
show up without the 'name=' prefix.

With this patchset I can start containers inside a privileged lxd
container with lxcfs mounted (i.e. without cgroup namespaces).

Closes #830

Signed-off-by: Ubuntu <ubuntu@localhost.localdomain>
8 years agocgfs: also check for EACCES when writing devices
Serge Hallyn [Sat, 20 Feb 2016 02:43:50 +0000 (18:43 -0800)]
cgfs: also check for EACCES when writing devices

Because that's what lxcfs gives us.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #829 from hallyn/2016-02-19/devices
Stéphane Graber [Fri, 19 Feb 2016 23:25:02 +0000 (18:25 -0500)]
Merge pull request #829 from hallyn/2016-02-19/devices

cgroups: do not fail if setting devices cgroup fails due to EPERM

8 years agocgroups: do not fail if setting devices cgroup fails due to EPERM
Serge Hallyn [Fri, 19 Feb 2016 22:12:47 +0000 (14:12 -0800)]
cgroups: do not fail if setting devices cgroup fails due to EPERM

If we're trying to allow a device which was denied to our parent
container, just continue.

Cgmanager does not help us to distinguish between eperm and other
errors, so just always continue.

We may want to consider actually computing the range of devices
to which the container monitor has access, but OTOH that introduces
a whole new set of complexity to compute access sets.

Closes #827

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #826 from brauner/2016-02-19/exec_cast_null
Serge Hallyn [Fri, 19 Feb 2016 19:00:59 +0000 (11:00 -0800)]
Merge pull request #826 from brauner/2016-02-19/exec_cast_null

cast NULL pointers passed to execl*()

8 years agocast NULL pointers passed to execl*()
Christian Brauner [Fri, 19 Feb 2016 11:44:40 +0000 (12:44 +0100)]
cast NULL pointers passed to execl*()

NULL pointers passed to execl*() functions must be cast to (char *)NULL since
they are variadic functions.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agochange version to 2.0.0.rc1 in configure.ac
Stéphane Graber [Thu, 18 Feb 2016 17:20:43 +0000 (12:20 -0500)]
change version to 2.0.0.rc1 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #823 from stgraber/master
Christian Brauner [Tue, 16 Feb 2016 07:01:25 +0000 (08:01 +0100)]
Merge pull request #823 from stgraber/master

Fix doc build warnings

8 years agoFix doc build warnings
Stéphane Graber [Tue, 16 Feb 2016 06:16:33 +0000 (01:16 -0500)]
Fix doc build warnings

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #822 from stgraber/master
Serge Hallyn [Tue, 16 Feb 2016 02:49:22 +0000 (18:49 -0800)]
Merge pull request #822 from stgraber/master

Couple of apparmor tweaks

8 years agoAllow cgroupfs remount by systemd
Stéphane Graber [Tue, 16 Feb 2016 01:08:09 +0000 (20:08 -0500)]
Allow cgroupfs remount by systemd

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoAllow sysfs remount by mountall
Stéphane Graber [Tue, 16 Feb 2016 01:03:50 +0000 (20:03 -0500)]
Allow sysfs remount by mountall

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #821 from hallyn/2016-02-15/lognull
Christian Brauner [Mon, 15 Feb 2016 20:38:00 +0000 (21:38 +0100)]
Merge pull request #821 from hallyn/2016-02-15/lognull

2016 02 15/lognull

8 years agolog.c:__lxc_log_set_file: completely close log file when overriding
Serge Hallyn [Mon, 15 Feb 2016 20:18:18 +0000 (12:18 -0800)]
log.c:__lxc_log_set_file: completely close log file when overriding

Otherwise after a shortcut on error we could end up trying to write
to the closed log fd.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agolog.c:__lxc_log_set_file: fname cannot be null
Serge Hallyn [Mon, 15 Feb 2016 20:15:10 +0000 (12:15 -0800)]
log.c:__lxc_log_set_file: fname cannot be null

fname cannot be passed in as NULL by any of its current callers.  If it
could, then build_dir() would crash as it doesn't check for it.  So make
sure we are warned if in the future we pass in NULL.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #813 from brauner/2016-02-01/lxc_destroy_ephemeral
Serge Hallyn [Wed, 10 Feb 2016 18:34:49 +0000 (10:34 -0800)]
Merge pull request #813 from brauner/2016-02-01/lxc_destroy_ephemeral

lxc-destroy: deal with ephemeral containers

8 years agolxc-destroy: deal with ephemeral containers
Christian Brauner [Wed, 10 Feb 2016 01:32:37 +0000 (02:32 +0100)]
lxc-destroy: deal with ephemeral containers

- Ephemeral containers are destroyed on shutdown so we do not destroy them.
- Destroy ephemeral containers with clones: first destroy all the clones, then
  destroy the container.
- Ephemeral containers with snapshots cannot be easily handled but we can
  probably trust that no one will try to make snapshots of an ephemeral
  container.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
8 years agoMerge pull request #812 from brauner/2016-02-10/quiet_lxc_copy
Serge Hallyn [Wed, 10 Feb 2016 01:00:42 +0000 (17:00 -0800)]
Merge pull request #812 from brauner/2016-02-10/quiet_lxc_copy

silence lxc-copy as well when asked

8 years agosilence lxc-copy as well when asked
Christian Brauner [Wed, 10 Feb 2016 00:22:15 +0000 (01:22 +0100)]
silence lxc-copy as well when asked

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>