Commit Graph

430 Commits

Author SHA1 Message Date
Dwight Engen
fce070c815 fixups to init script rework
- move action() from common to sysvinit wrapper since its only really
  applicable for sysvinit and not the other init systems

- fix bug in action() fallback, need to shift away msg before executing action

- make lxc-net 98 so it starts before lxc-container (99), otherwise the lxcbr0
  won't be available when containers are autostarted

- make the default RUNTIME_PATH be /var/run instead of /run. On older
  distros (like ol6.5) /run doesn't exist. lxc-net will create this directory
  and attempt to create the dnsmasq.pid file in it, but this will fail when
  SELinux is enabled because the directory will have the default_t type.
  Newer systems have /var/run symlinked to /run so you get to the same place
  in that case.

- add %postun to remove lxc-dnsmasq user when pkgs are removed

- fix bug in lxc-oracle template that was creating /var/lock/subsys/lxc as
  a dir and interfering with the init scripts

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-09-29 12:17:11 -04:00
Stéphane Graber
3cd988ccdb download: Make --keyserver actually work
Reported-by: NeilGreenwood <neil.greenwood@gmail.com>
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-09-23 10:25:47 -04:00
TAMUKI Shoichi
dc5518b82e lxc-gentoo: keep original uid/gid of files/dirs when installing
Call tar with --numeric-owner option to use numbers for user/group
names because the whole uid/gid in rootfs should be consistently
unchanged as in original stage3 tarball and private portage.

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-09-19 17:02:36 -04:00
TAMUKI Shoichi
d0348408b5 lxc-plamo: keep original uid/gid of files/dirs when installing
Regardless of whether "installpkg" command exists or not, install the
command temporarily with static linked tar command into the lxc cache
directory to keep the original uid/gid of files/directories.  Also,
use sed command instead of ed command for simplicity.

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-09-19 16:58:00 -04:00
Bill Kolokithas
8fefbee406 lxc-archlinux: Properly set default locale in /etc/locale.conf
Signed-off-by: Bill Kolokithas <kolokithas.b@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-08-25 16:15:32 -04:00
Denis Pynkin
05e61b82cf Additional checks in ALTLinux template
Added check of services in container before start or stop.
Added check of syslog config existence prior changing.

Signed-off-by: Denis Pynkin <dans@altlinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-08-25 16:14:13 -04:00
TAMUKI Shoichi
ea00a202cd Update plamo template
- If "installpkg" command does not exist, lxc-plamo temporarily
  install the command with static linked tar command into the lxc
  cache directory.  The tar command does not refer to passwd/group
  files, which means that only a few files/directories are extracted
  with wrong user/group ownership.  To avoid this, the installpkg
  command now uses the standard tar command in the system.
- Change mode to 666 for $rootfs/dev/null to allow write access for
  all users.
- Small fix in usage message.

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2014-08-19 07:49:01 -04:00
Denis Pynkin
a9ae28a05a Updated template for ALTLinux.
- Added predefined package list if /etc/lxc/profiles/default is absent.
- Fixed syntax mistake in options list.

Signed-off-by: Denis Pynkin <dans@altlinux.ru>
Acked-by: Stéphne Graber <stgraber@ubuntu.com>
2014-08-15 21:09:34 -04:00
Stéphane Graber
206a255e17
ubuntu: Check that btrfs is actually available
Before calling btrfs and playing with subvolumes, let's make sure the
btrfs command is available.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-08-15 19:59:45 -04:00
rabisg
b69e7bf14e Use portageq to determine portage distdir
Signed-off-by: Rabi Shanker Guha <guha.rabishankar@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-08-08 12:17:02 -04:00
Kalman Olah
91c5c53f59 Include hostname in DHCP requests
With the current old CentOS template, dnsmasq was not able to resolve
the hostname of an lxc container after it had been created. This minor
change rectifies that.

Signed-off-by: Kalman Olah <hello@kalmanolah.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-08-08 12:15:07 -04:00
Nikolay Martynov
b78b2e23a1 ssh: send hostname to dhcp server
Send container's hostname to dhcp server when getting ip address.

Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-08-08 12:14:19 -04:00
Michael Werner
4849ab991b templates: switch from arch command to uname -m
Signed-off-by: Michael Werner <xaseron@googlemail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-08-08 12:12:21 -04:00
Serge Hallyn
68c36a303f ubuntu templates: don't check for $rootfs/run/shm
/dev/shm must be turned from a directory into a symlink to /run/shm.
The templates do this only if they find -d $rootfs/run/shm.  Since /run
will be a tmpfs, checking for it in the rootfs is silly.  It also is
currently broken as ubuntu cloud images have an empty /run.

(this should fix https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1353734)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-08-08 11:40:03 -04:00
Stéphane Graber
acabe1faee download: Have wget retry 3 times
This forces wget to retry if it gets a network error.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-07-31 13:47:01 -04:00
Trần Ngọc Quân
04cda6d1d3 add help string for ubuntu templete
Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-07-29 08:34:23 -05:00
Serge Hallyn
cd6b3e37a6 remove mountcgroup hook entirely
Also fix the comment in lxc-cirros template (which I overlooked last time).

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-07-17 17:33:45 -05:00
Claudio Alarcon-Reyes
7edae51efc centos template: prevent mingetty from calling vhangup(2)
When using unprivileged containers, tty fails because of vhangup. Adding
--nohangup to nimgetty, it fixes the issue. This is the same problem
occurred for oracle template, commit 2e83f7201c

Signed-off-by: Claudio Alarcon clalarco@gmail.com
2014-07-14 20:22:39 -04:00
Alexander Dreweke
177f2cd2c2 lxc-debian: added support for package installation
- added --mirror, --security-mirror and --package parameters
- generate source.list
- install packages into final lxc instance

Signed-off-by: Alexander Dreweke <alexander@dreweke.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-07-09 10:20:04 -04:00
Alexander Dreweke
b3d3f3c661 lxc-debian: standardize formatting
Signed-off-by: Alexander Dreweke <alexander@dreweke.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-07-09 10:19:52 -04:00
Alexander Dreweke
cd44154ca7 lxc-debian: fix formatting
added space ">/" -> ">  /"

Signed-off-by: Alexander Dreweke <alexander@dreweke.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-07-09 10:19:38 -04:00
José Martínez
5652d61020 lxc-ubuntu: update coding style
Signed-off-by: José Martínez <xosemp@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-07-07 10:49:12 -04:00
José Martínez
b6e07af7c2 lxc-ubuntu: fix btrfs when rootfs == realrootfs
Fix btrfs support when lxc-create does not bind-mount the rootfs.

Signed-off-by: José Martínez <xosemp@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-07-07 10:49:09 -04:00
Dwight Engen
6000d5bacb lxc-oracle: mount cgroup:mixed
- Mounting cgroup:mixed prevents systemd inside the container from
  moving its children out of the cgroups lxc setup. This ensure the
  limits setup in the configuration or with lxc-cgroup are effective.

- Update for the OL7 channel name that will be used on
  public-yum.oracle.com.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-07-03 15:39:11 -04:00
hallyn
616d626b4e Merge pull request #244 from xose/btrfs
lxc-ubuntu: use btrfs subvolumes and snapshots
2014-06-30 16:18:35 -05:00
Alexander Vladimirov
23cc88bae0 lxc-archlinux.in: update securetty when lxc.devttydir is set
Update container's /etc/securetty to allow console logins when lxc.devttydir is not empty.
Also use config entries provided by shared and common configuration files.

Signed-off-by: Alexander Vladimirov <alexander.idkfa.vladimirov@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-06-27 13:05:39 -04:00
Alexander Vladimirov
99cbd2996b lxc-archlinux.in: Add pacman keyring initialization back
Shuffle around usage text a bit and add missing -d while there.

Signed-off-by: Alexander Vladimirov <alexander.idkfa.vladimirov@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-06-27 13:03:57 -04:00
Alexander Vladimirov
c194ffc100 Update Arch Linux template and add common configuration files
Move common container configuration entries into template config.
Remove unnecessary service symlinking and configuration entries, as well as
guest configs and other redundant configuration, fix minor script bugs.
Clean up template command line, add -d option to allow disabling services.
Also enable getty's on all configured ttys to allow logins via lxc-console,
set lxc.tty value corresponding to default Arch /etc/securetty configuration.

This patch simplifies Arch Linux template a bit, while fixing some
longstanding issues. It also provides common configuration based on
files provided for Fedora templates.

Signed-off-by: Alexander Vladimirov <alexander.idkfa.vladimirov@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-06-24 16:00:31 -04:00
Stéphane Graber
ce7aee4d91
lxc-download: Bump compat to 2 after OpenSUSE
OpenSUSE is now ready for the download template in the master branch,
however it's not going to be compatible with older LXC as they lack the
needed config files, so bump the compat level to 2 to indicate that the
current lxc-download can deal with the current OpenSUSE containers.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-06-18 17:33:10 -04:00
Michael H. Warfield
41cf1ac30d Updated lxc-opensuse for common configuration changes.
Updated the lxc-opensuse template for the changes for the common
configuration used by the download template.  Changed the default
network mode in the container to dhcp.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-06-18 16:56:11 -04:00
José Martínez
654bf1af09 lxc-ubuntu: use btrfs subvolumes and snapshots
Try to create the cache rootfs as a btrfs subvolume, and use btrfs
snapshots to copy the rootfs if btrfs is selected as backing store.

Signed-off-by: José Martínez <xosemp@gmail.com>
2014-06-17 23:01:33 +02:00
Stéphane Graber
809a1539a3 lxc-download: Attempt to get the GPG key 3 times
This is to deal with the GPG pool occasionaly yielding broken servers.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-06-03 15:52:43 -04:00
Michael H. Warfield
e5469dadd9 lxc-fedora.in: Correct some systemd target setups.
Set the halt.target action to be sigpwr.target.  This allows
SIGPWR to properly shut the container down from lxc-stop.

Renable the systemd-journald.service.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-06-03 15:06:35 -04:00
TAMUKI Shoichi
aadd458215 lxc-plamo: fix for configuring network interface
Fix configure_plamo so as not to configure wireless network interface
in containers even if the host uses wireless network interface.

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-06-03 11:11:51 -04:00
Dwight Engen
5b457f7bd8 lxc-oracle: fix ssh login under libvirt-lxc
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-05-20 17:09:27 -04:00
Dwight Engen
fd4d297dd6 lxc-oracle: set hostname with systemd
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-05-20 10:49:18 -04:00
Dwight Engen
7e4ca1a21d lxc-oracle: export upstart environment variable for maygetty
This is a fix to commit 5f2ea8cfcb.
Sorry, not sure how I missed this in testing the original patch.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-05-16 09:56:03 -04:00
Edvinas Klovas
44464003ee archlinux template: fix lxc.root for btrfs backend
when using btrfs backend lxc-create first creates rootfs in /usr/lib/lxc/rootfs
directory before moving it to /var/lib/lxc or other directory supplied by the
command line. Archlinux template relied in $rootfs_path which made containers
created with btrfs backend have lxc.rootfs set to /usr/lib/lxc/rootfs. By using
$path instead of $rootfs_path we make sure that lxc.rootfs is always correct.

Signed-off-by: Edvinas Klovas <edvinas@pnd.io>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-05-13 15:28:22 -04:00
Dwight Engen
5f2ea8cfcb lxc-oracle: add pts/[1-4] to securetty for libvirt-lxc
Don't spawn a getty on /dev/console when running under libvirt-lxc

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-05-12 22:59:47 -04:00
Edvinas Klovas
31efc34cff archlinux template: added sigpwr handling to systemd (lxc-stop)
archlinux is using systemd and systemd's configuration does not have any
services setup to handle sigpwr hook which is sent by lxc-stop command. By
enabling sigpwr service we make sure that lxc-stop will work.

Signed-off-by: Edvinas Klovas <edvinas@pnd.io>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-05-07 08:38:36 -05: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
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
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
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
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