Commit Graph

3574 Commits

Author SHA1 Message Date
KATOH Yasufumi
93f28e2bcd lxc-plamo: Set lxc.autodev to 0
At this time, a container that is created by lxc-plamo can't work with
lxc.autodev=1

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-27 09:59:45 +00:00
Stéphane Graber
b04c281f10 Merge pull request #420 from hallyn/fixbusybox.1
fix busybox unpriv
2015-01-27 09:33:26 +00:00
Serge Hallyn
cfe615f031 fix busybox unpriv
1. tty5 is not needed
2. the devices should be optional in case they didn't exist in the
host / parent-container
3. switch from 'touch $rootfs/dev/$dev' to using create=file in the
mount entry.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2015-01-27 10:30:29 +01:00
KATOH Yasufumi
a9516fe57f Change the default value of kmsg and autodev in Japanese man
Update Japanese lxc.container.conf(5) for commit 124fa0a and d89de23.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-27 08:07:46 +00:00
Stéphane Graber
adc1f9185f
change version to 1.1.0.rc3 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-26 18:03:44 -05:00
Serge Hallyn
38b34913fa Use 'overlay' as fs name when needed
Close #389

We will probably also want to switch the order of the mount attempts, as
the new overlay fs should quickly become the more common scenario.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-26 11:57:14 -05:00
Stéphane Graber
ab35147cde
lua: fix crash on missing blkio
Closes: #403

Signed-off-by: Dwight Engen
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-26 00:11:55 -05:00
Stéphane Graber
e532f165e2
change version to 1.1.0.rc2 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-25 15:45:37 -05:00
Tomas Pospisek
9cbffb9f57 improve "lxc-create -t debian -h" help text
- document environment variables
- add missing --packages switch to command line
- describe how to pass template options to lxc-create (since
  lxc-create -h doesn't tell you)
- render help text in the same pretty format as lxc-create does

Signed-off-by: Tomáš Posíšek <tpo_deb@sourcepole.ch>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-25 12:10:36 -05:00
Patrick O'Leary
46cd28455f replace deprecated index with strchr
The `index` libc function was removed in POSIX 2008, and `strchr` is a direct
replacement. The bionic (Android) libc has removed `index` when you are
compiling for a 64-bit architecture, such as AArch64.

Signed-off-by: Patrick O'Leary <patrick.oleary@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-24 23:43:29 -05:00
hallyn
411c497411 Merge pull request #408 from yosida95/patch-1
fix failed to fallback at lxclock_name
2015-01-24 18:01:24 -06:00
Jörg Thalheim
6a9390e349 systemd: enable delegate in service file
Signed-off-by: Jörg Thalheim <joerg@higgsboson.tk>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-24 16:50:56 -05:00
Vicente Olivert Riera
b8ebaa9c78 Gentoo template - Add a hwaddr if there is only one veth
Reuse the code from the Debian template to associate a hwaddr if there
is only one veth interface in the container's config file.

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-24 16:47:24 -05:00
Johannes Kastl
1f3fc0d73a rpm: added dependency to lxc-libs to lxc package
Ensures matching versions of lxc and lxc-libs being installed

Signed-off-by: Johannes Kastl <mail@ojkastl.de>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-01-24 16:46:04 -05:00
Thomas Moschny
67f6957377 Small fix for Lua 5.3 compatibility.
Signed-off-by: Thomas Moschny <thomas.moschny@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-24 16:44:55 -05:00
Markus Elfring
c55d4505e3 Bug #158: Deletion of unnecessary checks before a few calls of LXC functions
The following functions return immediately if a null pointer was passed.
* container_destroy
* lxc_cgroup_process_info_free_and_remove
* lxc_cgroup_put_meta
* toss_list

It is therefore not needed that a function caller repeats a corresponding check.

This issue was fixed by using the software Coccinelle 1.0.0-rc23.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-24 16:43:56 -05:00
Markus Elfring
f10fad2f53 Bug #158: Deletion of unnecessary checks before calls of the function "free"
The function "free" is documented in the way that no action shall occur for
a passed null pointer. It is therefore not needed that a function caller
repeats a corresponding check.
http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first

This issue was fixed by using the software Coccinelle 1.0.0-rc23.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-24 16:43:53 -05:00
Stéphane Graber
ce72f6b466 lxc-start-ephemeral: fix pep-8 and pyflakes3
This defines a missing variable and re-indents the code a bit.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-01-22 12:01:40 -05:00
Kohei YOSHIDA
669b632579 fix failed to fallback at lxclock_name
lxclock_name will fallback to /tmp/$(id -u)/lxc$lxcpath/.$lxcname when failed
to create directories into rundir. But, in currently, lxclock_name returns
untill preparing directories under the /tmp, so invoker will fail to get
the container lock.  This patch fixes fixes this.

Signed-off-by: Kohei YOSHIDA <kohei.yoshida@gehirn.co.jp>
2015-01-22 15:16:39 +09:00
Stéphane Graber
3e73d66757
change version to 1.1.0.rc1 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-21 16:19:42 -05:00
Michael Adam
c2af30847a add "--mask-tmp" to lxc-fedora, plus some template script fixes]
Hi Michael,

do you have any concerns with the attached patch to
the fedora template that adds an option --mask-tmp
that prevents fedora/systemd from over-mounting
/tmp with tmpfs, which is useful in some cases?

Thanks - Michael

----- Forwarded message from Michael Adam <obnox@samba.org> -----

Date: Sat, 10 Jan 2015 13:12:06 +0100
From: Michael Adam <obnox@samba.org>
To: LXC development mailing-list <lxc-devel@lists.linuxcontainers.org>
Subject: Re: [lxc-devel] [PATCHES] add "--mask-tmp" to lxc-fedora, plus some
	template script fixes
User-Agent: Mutt/1.5.23 (2014-03-12)

On 2015-01-10 at 13:08 +0100, Michael Adam wrote:
> On 2015-01-10 at 04:05 +0000, Serge Hallyn wrote:
>
> > The less controversial one is adding mask-tmp to the fedora template.
> > It looks fine to me, but that should go separately to mwarfield, our
> > fedora template maintainer :)
>
> I had notified mhw of my patches on irc, but apparently he is
> currently very busy.
>
> For a start, following is an update of the uncontroversial fix
> patches, i.e. the fix patche without the path ones, and without
> the mask-tmp patch.

And here comes the mask-tmp patch.
It needs to be applied onto the previous fix-patchset.

From 9589dca113535ed2f4faad89db2fab33bb8a9d7e Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox@samba.org>
Date: Thu, 8 Jan 2015 10:25:24 +0100
Subject: [PATCH] lxc-fedora: add a new option --mask-tmp

This will configure the container to prevent the standard
behaviour of over-mounting /tmp with tmpfs, which can be
undesirable in some cases.

My personal use case is vagrant-lxc in combination with
vagrant-cachier.

Signed-off-by: Michael Adam <obnox@samba.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-01-21 12:48:59 -06:00
hallyn
6b1aa947ad Merge pull request #397 from axn/master
Fix instantiation of multiple vlan interfaces with same id
2015-01-21 09:33:59 -06:00
Stéphane Graber
4662c6dee0 Add common.conf.d
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2015-01-20 23:32:22 -05:00
Stéphane Graber
d89de2399c Set kmsg to 0 by default
It's now been proven over and over again that the symlink from /dev/kmsg
to /dev/console is harmful for everything but upstart systems. As Ubuntu
is now switching over to systemd too, lets switch the default.

Upstart users wishing to see boot messages can always set lxc.kmsg = 1
manually in their config (so long as they don't expect to then
dist-upgrade the container to systemd succesfuly).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-01-20 19:47:17 -05:00
Stéphane Graber
124fa0a869 Turn autodev on by default
Now that autodev works fine with unprivileged containers and shouldn't
come with any side effect, lets turn it on by default.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-01-20 19:47:14 -05:00
Serge Hallyn
dd2271e6bb yet another problem with new overlay fs
It turns out that the new upstream overlay fs requires that the delta
and work dirs be under the same mount.  So create a $lxcpath/tmpfs
and create delta0 and work0 under that.  If the user asks for a
tmpfs that'll be mounted under $lxcpath/tmpfs and workdir and delta0
both created under that.

This isn't heavily tested.  But if fixes mounting of 'overlay' fs
for me.

It's "not backward compatible", since it moves delta0, but that
shouldn't matter since ephemeral containers are either destroyed
on exit, or re-started with lxc-start.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-20 18:44:55 -05:00
S.Çağlar Onur
5fdd4b0c11 restore the dropped bits of 1c1bb85ad2 and also implement the logic
suggested at
https://lists.linuxcontainers.org/pipermail/lxc-devel/2014-December/010985.html

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-20 16:40:41 -05:00
Serge Hallyn
e6744e9b39 update hwaddr to fill in xx at create time
Commit 67702c21 regressed the case where lxc-create use a config
file with 'xx:xx' in lxc.network.hwaddr, so that the 'xx' were
preserved in the container's configuration file.  Expand those
in the unexpanded_config file whenever we are reading a
config file which is not coming from a 'lxc.include'.

The config file will have \n-terminated lines, so update
rand_complete_hwaddr to also stop on \n.

Add a test case to make sure xx gets expanded at lxc-create.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-20 16:40:27 -05:00
Stéphane Graber
af242ace3e
Update MAINTAINERS
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-19 16:23:21 -05:00
Alexander Vladimirov
97e1e9bbb2 lxc-centos: pass releasever parameter to yum
Signed-off-by: Alexander Vladimirov <alexander.idkfa.vladimirov@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-16 18:09:28 -05:00
KATOH Yasufumi
ac11ab3351 doc: Update the description of the veth in the Japanese lxc.container.conf(5)
Update for the commit 38005c5

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-16 18:03:24 -05:00
Serge Hallyn
e1daebd905 implement lxc.include for directories
If you have 'lxc.include = /some/dir' and /some/dir is a directory, then any
'*.conf" files under /some/dir will be read.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-16 18:01:58 -05:00
Serge Hallyn
9cb4d18355 fill_autodev: bind-mount if mknod fails (v3)
First, rename setup_autodev to fill_autodev, since all it
does is populate it, not fully set it up.

Secondly, if mknod of a device fails, then try bind-mounting
it from the host rather than failing immediately.

Note that this isn't an urgent patch because the common.userns
configuration hook already specifies bind,create=file mount
entries for all the devices we would want.

Changelog (v3): ignore if /dev doesn't exist

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-15 19:10:15 -05:00
Serge Hallyn
87da4ec337 autodev: switch strategies (v3)
Do not keep container devs under /dev/.lxc.  Instead, always
keep them in a small tmpfs mounted at $(mounted_root)/dev.

The tmpfs is mounted in the container monitor's namespace.  This
means that at every reboot it will get re-created.  It seems to
me this better replicates what happens on a real host.

If we want devices persisting across reboots, then perhaps we can
implement a $lxcpath/$name/keepdev directory containing devices to
bind into the container at each startup.

Changelog (v2): don't bother with the $lxcpath/$name/rootfs.dev
	directory, just mount the tmpfs straight into the container.

Changelog (v3): Don't create /dev if it doesn't exist

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-15 19:10:12 -05:00
Michael Adam
7d540a2663 lxc-download: improve help text.
--help and --list are special in the sense that they
are independent of the other options and exit early.
Document them separately.

Signed-off-by: Michael Adam <obnox@samba.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-15 19:09:14 -05:00
Michael Adam
308f4f391a lxc-download: make --list more useful.
Make it possible to use --list without having to specify
--dist, --release, and --arch, which does not make a lot
of sense.

Signed-off-by: Michael Adam <obnox@samba.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-15 19:08:47 -05:00
Michael Adam
e145b7bb6d lxc-download: fix typo in help text.
Signed-off-by: Michael Adam <obnox@samba.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-15 19:08:20 -05:00
Serge Hallyn
d2cf4c3785 close-all-fds: fix behavior
We want to close all inherited fds in three cases - one, if a container
is daemonized.  Two, if the user specifies -C on the lxc-start command
line.  Three, in src/lxc/monitor.c.  The presence of -C is passed in the
lxc_conf may not always exist.

One call to lxc_check_inherited was being done from lxc_start(), which
doesn't know whether we are daemonized.  Move that call to its caller,
lxcapi_start(), which does know.

Pass an explicit closeall boolean as second argument to lxc_check_inherited.
If it is true, then all fds are closed.  If it is false, then we check
the lxc_conf->close_all_fds.

With this, all tests pass, and the logic appears correct.

Note that when -C is not true, then we only warn about inherited fds,
but we do not abort the container start.  This appears to have ben the case
since commit 92c7f62955 in 2011.  Unfortunately the referenced URL with
the justification is no longer valid.  We may want to consider becoming
stricter about this again.  (Note that the commit did say "for now")

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-15 17:11:54 -05:00
Serge Hallyn
4799a1e7ec 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>
2015-01-15 17:11:52 -05:00
Michael Adam
38005c5436 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>
2015-01-15 17:11:48 -05:00
Axel Neumann
82f58d0396 Fix instantiation of multiple vlan interfaces with same id
Container fail to start with configs (as shown below) where the same
vlan id is used for several type=vlan container interfaces.
Then, during the instantiation of the vlan interfaces, an error occurs
because the lxc code tries to assign the same temporary name to both
of them before it is bound into the container.

> lxc.network.type      = vlan
> lxc.network.flags     = up
> lxc.network.link      = eth1
> lxc.network.vlan.id   = 3842
> lxc.network.name      = iso0
>
> lxc.network.type      = vlan
> lxc.network.flags     = up
> lxc.network.link      = eth2
> lxc.network.vlan.id   = 3842
> lxc.network.name      = iso1

Signed-off-by: Axel Neumann <neumann@cgws.de>
2015-01-13 10:48:52 +01:00
Serge Hallyn
db2930e174 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>
2015-01-12 23:07:28 -06:00
Serge Hallyn
a2739df5e4 Revert "set close-all-fds by default"
it has unfortunate reprecussions elsewhere, and the needed fix
can be done another way

This reverts commit 1f76453a74.
2015-01-12 23:06:01 -06:00
Serge Hallyn
d2f31a576b containertests: don't expect NULL lxc_conf
Because we never have that any more

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2015-01-12 22:24:26 -06:00
Serge Hallyn
88322f776c 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>
2015-01-12 16:26:08 -05:00
Serge Hallyn
1f76453a74 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>
2015-01-12 16:26:08 -05:00
Michael Adam
fccc348be4 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>
2015-01-10 10:07:41 -06:00
Michael Adam
9aed78fad1 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>
2015-01-10 10:07:41 -06:00
Michael Adam
98d316e29a 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>
2015-01-10 10:07:41 -06:00
Michael Adam
a2780518da 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>
2015-01-10 10:07:41 -06:00