Commit Graph

1263 Commits

Author SHA1 Message Date
Serge E. Hallyn
8565ea1c6f lxc-ubuntu: stop early if a bad user is specified in -b option
Otherwise we end up with a bad container fstab and a container
that won't boot.  See
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/879052

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-10-24 14:47:58 +02:00
Rainer Weikusat
bc71b5c54f Don't list containers w/ active console sessions multiple times
The lxc-ls shell script uses netstat -xa to get a listing of AF_UNIX
sockets it then parses in order to determine the names of presently
running containers. This is wrong because it will list the
listening socket and all sockets created by accepting connections on
that. This causes the script to display the names of containers with
active lxc-console sessions 1 + n times, n being the number of active
console sessions. The patch below fixes this by using netstat -xl
instead which only displays the listening sockets.

Signed-off-by: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-10-24 14:47:58 +02:00
Serge E. Hallyn
b145c6ef5e ubuntu template: allow containers to create tap devices
Thought I had sent this before, but I don't find it anywhere.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-10-24 14:38:30 +02:00
Serge E. Hallyn
3e2981d459 Accurately detect whether a system supports clone_children
If multiple cgroups are mounted under /sys/fs/cgroup, then the
original check ends up looking for /sys/fs/cgroup/cgroup.clone_children,
which does not exist because that is just a tmpfs.

So make sure to check an actual cgroupfs.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-10-24 14:38:30 +02:00
Serge E. Hallyn
b91b1cd79c Let sshd template work on ubuntu systems.
/dev/shm is a symlink to /run/shm, so we need /run/shm
to exist in the container rootfs.  Also, /dev/mqueue does
not exist on the host, and can't be created by the container.
But we don't really need it so ignore that.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-10-24 14:38:30 +02:00
Serge E. Hallyn
cdcee3c7ff ubuntu template: disallow cap_sys_module (by popular demand)
This isn't particularly reassuring, and will be moot with user
namespaces, but as people are asking for it, turn off sys_module.
While we're at it, turn off mac_admin and mac_override.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-10-24 14:38:30 +02:00
Serge E. Hallyn
0f3fe9e0b5 lxc-clone: fix dhclient.conf send hostname command
End the command with ';', which is needed, and put the hostname in
quotes (which doesn't really seem needed, but shown in man page).

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-10-24 14:38:30 +02:00
Greg Kurz
6f7c8b020c fix more broken paths in lxc-*.in scripts
There are still some sequels from commit:

1c41ddcb4a

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-10-24 14:38:30 +02:00
Greg Kurz
4e04d51500 fix broken lxc-*.in scripts
Commit 92c7f62955 broke the following scipts:
- lxc-setcap
- lxc-setuid
- lxc-create

This patch adds the missing variables to be substitued by the configure
script.

Cheers.

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-09-20 11:18:39 +02:00
Tzafrir Cohen
165015211f Set the utsname on the debian template
Signed-off-by: Tzafrir Cohen <tzafrir@cohens.org.il>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-09-13 15:08:04 +02:00
Greg Kurz
92c7f62955 only warn for inherited file descriptors
As discussed in thread:

http://sourceforge.net/mailarchive/forum.php?thread_name=4E5618C3.5060507%40free.fr&forum_name=lxc-devel

We think it's better for now to only warn the user about a fd leaking into
the container. Also remove the call to readlink() as it isn't really useful
now: since the container will start anyway, the user can look into /proc/../fd
or use lsof or whatever.

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-09-13 15:08:04 +02:00
Greg Kurz
1c41ddcb4a fixes for rpmbuild
This patch fixes some makefile/specfile issues when running
rpmbuild with the distributed lxc specfile:

- fixes usage of installation directories for config files,
  rootfs, templates and lxc-init so that they're calculated
  at make time instead of configure time. Thanks to this,
  all installed items go under $RPM_BUILD_ROOT when running
  rpmbuild
- introduce --disable-rpath option to configure to avoid
  check-rpaths errors when building non-root.
- introduce a lxc-libs package in the default spec file
  to allow concurrent installation of 32 bit and 64 bit
  libraries.

v2: - fix circular reference in lxc.pc
    - ship lxc.pc with lxc-devel

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-09-13 15:08:04 +02:00
InformatiQ
f7b98d38f0 remove the check for container path as it's done in lxc-create
Signed-off-by: InformatiQ <rhanna@informatiq.org>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-09-01 22:24:30 +02:00
InformatiQ
ac70c6cf97 if after freezing the container the snapshot/rsync fails, unfreeze before exiting
Signed-off-by: InformatiQ <rhanna@informatiq.org>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
2011-08-31 00:20:09 +02:00
InformatiQ
8534a83e94 *add the new opts to help() *set container_running=false
Signed-off-by: InformatiQ <rhanna@informatiq.org>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
2011-08-31 00:20:09 +02:00
InformatiQ
27078f4422 * allow cloning of non-snapshot lvm devices
Signed-off-by: InformatiQ <rhanna@informatiq.org>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
2011-08-31 00:20:09 +02:00
Ramez Hanna
29ec8f8473 lxc-fedora.in
* if not running on fedora host amd -R is not set, use fedora 14 as default
* trap SIGHUP SIGINT SIGTERM, and cleanup before exiting

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-31 00:20:09 +02:00
Ramez Hanna
a30ce0ac4d fix for missing EOF and fstab contents
templates/lxc-fedora.in |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-31 00:20:09 +02:00
Alexey Shabalin
262f4e48a5 add lxc-altlinux template
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-31 00:20:09 +02:00
Matthijs Kooijman
be58c6b5b4 .gateway options
Man for the gateway option.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-30 23:50:23 +02:00
Matthijs Kooijman
19a26f8214 add autodetection of the gateway address
For veth and macvlan networks, this can look up the host address on the
bridge (link) interface and add a default route on the guest to that
address. This facilitates a typical setup where guests are bridged
together.

syntax:
	lxc.ipv4.gateway = auto
	lxc.ipv6.gateway = auto

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-30 23:50:23 +02:00
Matthijs Kooijman
f8fee0e2c3 .gateway configuration
This directive adds a default route to the guest at startup.

syntax:
	lxc.network.ipv4.gateway = 10.0.0.1
	lxc.network.ipv6.gateway = 2001:db8:85a3::8a2e:370:7334

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-30 23:50:23 +02:00
Daniel Lezcano
ebdd307db7 Don't log an error when the container is stopped
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-30 23:50:00 +02:00
Daniel Lezcano
e6238180c6 remove minimal install for ubuntu template
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-12 21:47:55 +02:00
Daniel Lezcano
970ab58945 make undefined personality non-fatal
Just warn, do not exit fatally.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-12 01:34:49 +02:00
Daniel Lezcano
6f1239c380 fix segfault when an unsupported personality is set
Bad array len computation.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-12 01:34:49 +02:00
Daniel Lezcano
6371febf3c Version 0.7.5
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-11 19:00:13 +02:00
Daniel Lezcano
d3b904039c fix setns parameter
The setns syscall is now mainstream but the parameter passing changed.
Let's fix that.

The pid namespace and mount namespace attach are missing for the moment.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-11 18:59:44 +02:00
Daniel Lezcano
c797dcc3d0 lxc-ps : update the man page for passing the options
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-11 17:54:57 +02:00
Daniel Lezcano
858133f52c lxc-ps : fix the container name search
We don't have to check for the cgroup namespace name because the
pid we are looking for is already in the list of the container owned by
lxc and retrieved from the abstract socket command name.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-11 17:54:57 +02:00
Daniel Lezcano
5d42011acb add container init pid with the lxc-info command
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-11 17:19:56 +02:00
InformatiQ
9894575994 fix RELEAE_URL to not hardcode the arch
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-11 17:19:56 +02:00
InformatiQ
579ebf1283 working fedora template
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-11 17:19:56 +02:00
Daniel Lezcano
d9e2cc0ead lxc-checkconfig takes into account cgroup.clone_children
Take into account we may have the clone_children flag on the cgroup,
so we ignore cgroup namespace in this case.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-09 20:02:31 +02:00
Serge E. Hallyn
0b9c21ab8a Silence lxc-unshare warning when removing cgroup
If ns cgroup is mounted, then when lxc-unshare runs, the kernel automatically
creates a new cgroup for the task.  So lxc-unshare tries to delete it.  But
if ns cgroup is not mounted, that cgroup does not get created, and now
lxc-unshare spits an error.
Author: Serge Hallyn <serge.hallyn@canonical.com>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/819319
Forwarded: no

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-09 16:51:01 +02:00
Serge E. Hallyn
0a1259d99f make lxc-netstat work when /etc/mtab is not /proc/mounts
like lxc-ps and lxc-ls, lxc-netstat breaks if there is not an 'lxc' cgroup
mount and /etc/mtab is not a link to /proc/mounts.
Author: Serge Hallyn <serge.hallyn@canonical.com>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/819319
Forwarded: no

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-09 16:51:01 +02:00
Serge E. Hallyn
93884589f6 fix lxc-ls with mtab != /proc/mounts
The cgroup mounts created by cgroup-bin do not show up in /etc/mtab.
lxc-ls, as lxc-ps before it, assumes that /etc/mtab is symlinked to
/proc/mounts.
Author: Serge Hallyn <serge.hallyn@canonical.com>
Forwarded: no
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/819319

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-09 16:51:01 +02:00
Serge E. Hallyn
3729572b4b lxc-ps: support '-n name' and '-- ps-options'
This is more consistent with other lxc commands

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/820720

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-09 16:51:01 +02:00
Daniel Lezcano
dff21ef019 explicitly do not use the console
If the keyword 'none' is specified for the console name, lxc will ignore creating a console.
That allows to have a rootfs but without a console.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-09 16:51:01 +02:00
Serge E. Hallyn
4cb05a609b Use container's /run/utmp if it exists
If /var/run is a symlink to /run in the container, then opening
/proc/<pid>/root/var/run/utmp will end up opening the host's utmp.
Therefore the hack detecting shutdown through utmp fails.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-07 12:25:07 +02:00
Serge E. Hallyn
3e9c97c17a add ubuntu-keyring to the packagelist for oneiric containers.
Otherwise apt fails during and after debootstrap.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-08-07 12:25:07 +02:00
Serge E. Hallyn
9e4fcfa115 Don't try to add host user's groups in container
When '-b user' is specified to lxc-ubuntu container creation template, do
not automatically add all the groups of which user is a member on the host,
to user's groups in the container.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-07-27 16:34:58 +02:00
Serge Hallyn
623f98d8cc lxc-ubuntu: Allow /dev/fuse to be used in a container
As people seem to want it, i.e.
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/800886

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-07-25 00:22:50 +02:00
Serge Hallyn
c440536e7c lxc-ubuntu: don't put devpts in $confdir/container/fstab
src/lxc/conf.c will explicitly mount it anyway.  Furthermore, the fstab
entry, which is getting processed first, did not specify -o newinstance.
This can cause the host's devpts entry mount options to change, as in
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/607636.

Note - I messed up.  This was applied upstream, but I dropped it in
subsequent conversion to lxc-ubuntu template.  It therefore needs to
be reapplied.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-07-25 00:22:50 +02:00
Serge Hallyn
e7eb632cb4 Add arm as a supported srcarch
Otherwise building on armel fails with

checking for linux SRCARCH... configure: error: architecture arm-unknown-linux-gnueabi not supported

See https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/745884 for details.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-07-25 00:22:50 +02:00
Joerg Gollnick
c011782c8d fix lxc-ps to work with systemd
Dear all,
while working with systemd I found that lxc-ps -efa does not recognize the 
container name.
Best regards Joerg

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-07-25 00:22:50 +02:00
Serge E. Hallyn
bcbd102cba cgroups: support cgroups mounted in multiple places (v3)
(sorry for the extra traffic.)

With this patch, lxc works for me both with all cgroups mounted with
ns cgroup on /cgroup, and with libcgroup mounting all cgroups
separately.

To do this, instead of looking for one cgroup called 'lxc' or
otherwise taking the first cgroup we find, we actually create a
container in every mounted cgroup fs.  Right now it's done under the
root of each fs.  We may want to put that under lxc, or, better yet,
make that configurable.

Changelog:
  Michael H. Warfield: Handle the case where subsystem doesn't have '.'.
  Daniel Lezcano: clean up incorrect reentrant use of mntent helpers
  v3: use the rest of Daniel's cleanups

TODO: add a configurable directory name, 'lxc' by default, under which
      all lxc cgroups are created (i.e. /sys/fs/cgroup/lxc)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Tested-by: Michael H. Warfield <mhw@WittsEnd.com>
2011-07-04 00:42:06 +02:00
Frederic Crozat
c840b37de8 templates: add openSUSE template.
The good news is, starting with next openSUSE release (and next SLES 11
Service Pack), patching /etc/init.d/boot won't be needed anymore for
LXC, we integrated detection of LXC (through container variable set to
lxc) in /etc/init.d/boot and /dev is no longer mounted automatically by
initscript.

Signed-off-by: Frederic Crozat <fcrozat@suse.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-07-04 00:35:52 +02:00
Serge Hallyn
c1c75c04a6 print netdev name, not link, after moving dev into netns
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-06-25 15:17:47 +02:00
Serge Hallyn
7c3ab01ffd Clarify the template-specific options a bit in lxc-create's help
This does not supplant the need for a manpage, but it's a start.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-06-25 15:17:47 +02:00