Commit Graph

2729 Commits

Author SHA1 Message Date
Serge Hallyn
50040b5e46 lxc-create: make 'none' bdev type work again
This should address https://github.com/lxc/lxc/issues/199

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-05-01 13:54:16 -04:00
Nikolay Martynov
8a2fdf50ad use correct lxc-init path in sshd template
lxc-init got moved into SBINDIR/init.lxc recently.
This broke sshd template because path wasn't updated there.
This patch should fix this issue.

Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-05-01 10:38:12 -04:00
Carlo Landmeter
91828b0e1f alpinelinux: set correct lxc_arch for x86
Signed-off-by: Carlo Landmeter <clandmeter@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-30 16:28:59 -04:00
S.Çağlar Onur
178af55b1c fix minor typo in .gitignore
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-30 15:25:30 -04:00
Stéphane Graber
13aad0ae78 clang: Fix build warnings for 3.4
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-30 13:02:15 -04:00
Dwight Engen
9e607c2f35 lxc-oracle: fix warnings/errors from some rpm scriptlets
- Some scriptlets expect fstab to exist so create it before doing the
  yum install

- Set the rootfs selinux label same as the hosts or else the PREIN script
  from initscripts will fail when running groupadd utmp, which prevents
  creation of OL4.x containers on hosts > OL6.x.

- Move creation of devices into a separate function

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-30 10:39:09 -05:00
Serge Hallyn
773bd28258 apparmor: allow writes to sem* and msg* sysctls
/proc/sys/kernel/sem* and /proc/sys/kernel/msg* are ipc sysctls
which are properly namespaced.  Allow writes to them from
containers.

Reported-by: Dan Kegel <dank@kegel.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-29 16:45:16 -05:00
S.Çağlar Onur
71a606eeb3 revert 1d16785 - fixes #191
According to Serge, we no longer need to keep cgmanager connection open.

As long as my tests go it seems to be working fine.

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-28 20:07:04 -05:00
Serge Hallyn
f79b86a344 Revert "snapshots: move snapshot directory"
This reverts commit 276a086264.

It breaks lxc-test-snapshot, and perhaps we should go with
stgraber's suggestion of using $lxcpath/$lxcname/snaps/
2014-04-28 17:33:36 -05:00
Dwight Engen
1462279962 output lxc.arch as i686 for PER_LINUX32
When outputing the lxc.arch setting, use i686 instead of x86 since the
later is not a valid input to setarch, nor will the kernel output
UTS_MACHINE as x86. The kernel sets utsname.machine to i[3456]86, which
all map to PER_LINUX32.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-28 16:18:00 -05:00
Dwight Engen
bb8d8207c3 allow all iX86 strings for lxc.arch
This change accepts all the same strings for lxc.arch that setarch(8) does.

Note that we continue to parse plain x86 as PER_LINUX32 so as not to break
existing lxc configuration files.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-28 16:17:58 -05:00
Serge Hallyn
a0566914c2 lxc-user-nic: handle failure in create_nic
Failures were being ignored, leading up to an eventual segfault.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-28 16:16:08 -05:00
KATOH Yasufumi
dc421f3aac Convert punctuation marks in Japanese man pages
This only converts punctuation marks from FULLWIDTH COMMA/FULL STOP to
IDEOGRAPHIC COMMA/FULL STOP in Japanese man pages. The contents of man
pages do not change at all.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-28 12:29:04 -05:00
Dwight Engen
92ffb6d8ac coverity: fix fd leak in error case (1011105)
I inadvertently introduced this with commit 8bf1e61e.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-28 12:28:33 -05:00
Michael H. Warfield
09227be286 Check for symlinks before attempting create.
Check for symlinks before attempting create.

When attempting to create the compulsory symlinks in /dev,
check for the existence of the link using stat first before
blindly attempting to create the link.

This works around an apparent quirk in the kernel VFS on read-only
file systems where the returned error code might be EEXIST or EROFS
depending on previous access to the /dev directory and its entries.

Reported-by: William Dauchy <william@gandi.net>
Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Tested-by: William Dauchy <william@gandi.net>
2014-04-28 10:19:01 -05:00
Serge Hallyn
276a086264 snapshots: move snapshot directory
Originally we kept snapshots under /var/lib/lxcsnaps.  If a
separate btrfs is mounted at /var/lib/lxc, then we can't
make btrfs snapshots under /var/lib/lxcsnaps.

This patch moves the default directory to /var/lib/lxc/lxcsnaps.
If /var/lib/lxcsnaps already exists, then use that.  Don't allow
any container to be used with the name 'lxcsnaps'.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-28 10:18:49 -05:00
Serge Hallyn
e995d7a269 lxc startup: manually mark every shared mount entry as slave
If you 'ip netns add x1', this creates /run/netns and /run/netns/x1
as shared mounts.  When a container starts, it umounts these after
pivot_root, and the umount is propagated to the host.

Worse, doing mount("", "/", NULL, MS_SLAVE|MS_REC, NULL) does not
suffice to change those, even after binding /proc/mounts onto
/etc/mtab.

So, I give up.  Do this manually, walking over /proc/self/mountinfo
and changing the mount propagation on everything marked as shared.

With this patch, lxc-start no longer unmounts /run/netns/* on the
host.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-28 10:18:47 -05:00
Serge Hallyn
0e98b3bd31 lxc-clone man page: fix typos
In the body of the manpage, replace a few errant 'fssize's with the
more appropriate word.

Reported-by: MegaBrutal <megabrutal@megabrutal.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-28 08:42:24 -05:00
Serge Hallyn
5135b555bb cppcheck: fix unchecked realloc in lxc_info.c
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-15 16:10:35 -05:00
Serge Hallyn
ccab6c6029 cgmanager: don't call nih_dbus_setup
it actually sets us up to run the nih_mainloop, but we will never run
that.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-11 11:07:02 -04:00
Dwight Engen
f6d5cecc19 lxc-oracle: use db_load from container
This makes it so that the host doesn't need to have an old, compat
version of db43_load installed by using the db_load from the just
installed container. Some newer distributions do not even have an old
enough compat-db4 package available.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-09 14:30:15 -05:00
Dwight Engen
30ecf66929 lxc-oracle: only create media repo when --baseurl is specified
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-09 14:30:08 -05:00
Dwight Engen
c937991e1f lxc-oracle: update to support OL7
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-09 10:34:33 -05:00
Dwight Engen
e120d0575b lxc-oracle: allow installing from arbitrary yum repo
With this change, you can install a container from a mounted .iso, or any
yum repo with the necessary packages. Unlike the --url option, the repo
does not need to be a mirror of public-yum, but the arch and release must
be specified. For example to install OL6.5 from an .iso image:

mount -o loop OracleLinux-R6-U5-Server-x86_64-dvd.iso /mnt
lxc-create -n OL6.5 -t oracle -- --baseurl=file:///mnt -a x86_64 -R 6.5

The template will create two yum .repo files within the container such that
additional packages can be installed from local media, or the container can
be updated from public-yum, whichever is available. Local media must be bind
mounted from the host onto the containers' /mnt for the former .repo to work:

mount --bind /mnt $LXCPATH/OL6.5/rootfs/mnt

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-09 10:34:32 -05:00
Stéphane Graber
c2997f9e6b Fix typo in previous commit
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-08 17:23:31 -04:00
Stéphane Graber
48356bbfdf
tests; Bump wait delay for shutdown to 120s
On very busy boards with slow IO, the shutdown process can take over 60s
as the disk is syncing.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-08 17:12:00 -04:00
Stéphane Graber
524505b971 apparmor: Use more generic allow rule for pivot
Recent fixes in the apparmor kernel code is now making at least the CI
environment and quite possibly some others fail due to an invalid path
in the pivot_root stanza.

So update both lines to allow a more generic pivot_root call for
anything in LXC's work directory.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-04-08 14:45:00 -04:00
KATOH Yasufumi
bb8eca54d6 doc: Update Japanese lxc-stop(1) to describe about exit value
Update for commit 13bc2fd237

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-08 10:13:57 -04:00
Serge Hallyn
6d35844184 cgmanager: cgm_get: len = 0 is a query for length only
The caller might (like lxc-test-startone does) pass in a valid
(or invalid) buffer and 0 length.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-07 17:19:19 -04:00
Serge Hallyn
13bc2fd237 lxc_*.c: don't exit with -1
In this patch I tried to stick with each file's coding style, however I
think we should probably change that.  Every main() should always not
return and only exit;  they should always return EXIT_SUCCESS or EXIT_FAILURE
with the only exceptions being cases where we are returning a child's
exit status (lxc_execute, lxc_attach, lxc_init).

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-07 17:19:14 -04:00
Ryan Mulligan
8dac6e74c4 archlinux: add debugging info for missing network link
Signed-off-by: Ryan Mulligan <ryan@ryantm.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-07 17:05:35 -04:00
Serge Hallyn
a7440c15c1 lxc_start: return 1 not -1 on error
So that exit status doesn't show up as 255.

Reported-by: Andrey Khozov <avkhozov@googlemail.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-07 10:21:49 -05:00
Serge Hallyn
2f2623ec2b lxc_spawn: initialize netpipe
When rebooting an unprivileged container, netpipe starts out
as not -1.  If count_veths somehow changed this could lead
to trying to send data over nonexistent pipe.  (Ok can't
*really* happen, as it currently stands, but it's an open
end)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-04 21:26:16 -05:00
Leonid Isaev
21ca73b980 archlinux: Code cleanups (v2)
Cleanups:
1. Do not modify container's /etc/hosts (archlinux uses /etc/nsswitch.conf)
2. Remove duplicate lines from config
3. Print a nicer final message
4. Get rid of some grep's

Signed-off-by: Leonid Isaev <lisaev@umail.iu.edu>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-04 19:29:58 -04:00
Stéphane Graber
6ee795d2e3 Revert "archlinux: Code cleanups"
This reverts commit 34fd08f87b.
2014-04-04 19:27:18 -04:00
Leonid Isaev
34fd08f87b archlinux: Code cleanups
Cleanups:
1. Do not modify container's /etc/hosts (archlinux uses /etc/nsswitch.conf)
2. Remove duplicate lines from config
3. Print a nicer final message
4. Get rid of some grep's in favor of bash regex

Signed-off-by: Leonid Isaev <lisaev@umail.iu.edu>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-04 19:04:34 -04:00
Leonid Isaev
44b036309b archlinux: Create per-container pacman host key
Do not copy the pacman master key from the host, as this opens it to
attacks; generate a new secret hostkey.

Signed-off-by: Leonid Isaev <lisaev@umail.iu.edu>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-04 19:04:30 -04:00
Leonid Isaev
b7b7d3884e archlinux: Fix default package selection
Do not cherry-pick packages for the default install to avoid dependency
issues. Instead, install the base group modulo blacklisted packages.

Signed-off-by: Leonid Isaev <lisaev@umail.iu.edu>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-04 19:04:23 -04:00
Robert Vogelgesang
6a7f2dcdb8 Move lxc-monitord.log out of /var/lib/lxc/
Place log file into LOGPATH instead of LXCPATH (but still use the
given lxcpath if the latter differs from LXCPATH).

Signed-off-by: Robert Vogelgesang <vogel@users.sourceforge.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-04 17:45:35 -04:00
Robert Vogelgesang
3d3bc9ed7b Fix wait_for_bridge() in sysvinit script
Fix parsing of /etc/lxc/default.conf, i. e. ignore comments, and don't
require whitespace left and right of the equal sign.

Make the early return actually work.

Signed-off-by: Robert Vogelgesang <vogel@users.sourceforge.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-04 17:45:35 -04:00
S.Çağlar Onur
bfd483d43a add init.lxc to .gitignore
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-04 17:45:35 -04:00
Stéphane Graber
2a31251cc5 apparmor: Update profiles for current upstream parser
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-04-04 17:45:35 -04:00
Dwight Engen
e2426f0bb0 fix lxc-info printing duplicate lines
When lxc-info's stdout is not line buffered (ie. "lxc-info -n foo |more")
the first three lines will be duplicated. This is because c->get_ips()
comes next and it forks and the child will exit() causing its fds to be
closed which flushes out its (fork duplicated) stdio buffers. The lines are
then duplicated when the parent actually gets around to flushing out its
stdio. This causes problems for programs (such as the lxc-webpanel) which
are popen()ing lxc-info.

The fix here isn't necessarily the right one, but does show what the
problem is. Seems like maybe we should fix this inside of get_ips(), for
other API callers as well.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-03 18:37:19 -05:00
Michael H. Warfield
e13923c711 Added lxc.arch to configuration files for CentOS and Fedora
Added lxc.arch to the resulting container configuration files
to support i686 on x86_64 cross arch containers.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-02 18:07:45 -05:00
Dwight Engen
8bf1e61ea3 make monitor/monitord more resilient to unexpected termination
Reported-by: Florian Klink <flokli@flokli.de>
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-02 12:30:29 -05:00
Serge Hallyn
94a77f3fd8 apparmor: deny writes to most of /proc/sys (v2)
Allow writes to kernel.shm*, net.*, kernel/domainname and
kernel/hostname,

Also fix a bug in the lxc-generate-aa-rules.py script in a
path which wasn't being exercised before, which returned a
path element rather than its child.

Changelog (v2): remove trailing / from block path

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-02 09:54:54 -05:00
Guillaume ZITTA
84ad17ede0 enable sshd by default like other templates
Signed-off-by: Guillaume ZITTA <lxc@zitta.fr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-02 10:53:13 -04:00
Guillaume ZITTA
3a74e9097a lxc-gentoo, fix lack of any generated locale
fix lack of any generated locale

Signed-off-by: Guillaume ZITTA <lxc@zitta.fr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-04-02 10:50:59 -04:00
Stéphane Graber
cf0c72d3c5 tests: Try to make shutdowntest a bit more robust
This should help it run better on slow test environment like the LXC CI
armhf builder.
 - Wait longer for the container to start
 - Wait longer for the container to shutdown
 - On failure to shutdown, kill the container
 - Always destroy the container if it's around

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-04-02 10:42:50 -04:00
Guillaume ZITTA
982b59592e fix lxc-console not working by default
fix lxc-console not working by default

Signed-off-by: Guillaume ZITTA <lxc@zitta.fr>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-04-01 14:58:39 -05:00