Commit Graph

128 Commits

Author SHA1 Message Date
Michal Sekletar e01ff70a77 nspawn: always setup machine id
We check /etc/machine-id of the container and if it is already populated
we use value from there, possibly ignoring value of --uuid option from
the command line. When dealing with R/O image we setup transient machine
id.

Once we determined machine id of the container, we use this value for
registration with systemd-machined and we also export it via
container_uuid environment variable.

As registration with systemd-machined is done by the main nspawn process
we communicate container machine id established by setup_machine_id from
outer child to the main process by unix domain socket. Similarly to PID
of inner child.
2016-04-11 16:43:16 +02:00
Petros Angelatos b3969f73f9 man: document missing KillSignal= .nspawn option
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-03-15 15:08:04 -07:00
Lennart Poettering 7732f92bad nspawn: optionally run a stub init process as PID 1
This adds a new switch --as-pid2, which allows running commands as PID 2, while a stub init process is run as PID 1.
This is useful in order to run arbitrary commands in a container, as PID1's semantics are different from all other
processes regarding reaping of unknown children or signal handling.
2016-02-03 23:58:24 +01:00
Lennart Poettering 5f932eb9af nspawn: add new --chdir= switch
Fixes: #2192
2016-02-03 23:58:24 +01:00
Jan Engelhardt cd72d2044a doc: improved wording in some places
Avoid "mountpoint mounted" (word repetition),
"queriable" (no match in m-w.com and dict.cc).
2016-01-28 11:13:17 +01:00
Lennart Poettering f6d6bad146 nspawn: add new --network-veth-extra= switch for defining additional veth links
The new switch operates like --network-veth, but may be specified
multiple times (to define multiple link pairs) and allows flexible
definition of the interface names.

This is an independent reimplementation of #1678, but defines different
semantics, keeping the behaviour completely independent of
--network-veth. It also comes will full hook-up for .nspawn files, and
the matching documentation.
2015-11-12 22:04:49 +01:00
Jan Engelhardt a8eaaee72a doc: correct orthography, word forms and missing/extraneous words 2015-11-06 13:45:21 +01:00
Jan Engelhardt b938cb902c doc: correct punctuation and improve typography in documentation 2015-11-06 13:00:02 +01:00
Lennart Poettering 09c76ef618 man: let's enclose * in shell examples in ''
Technically, it's safer that way, since dnf is supposed to parse the
"*", not the shell. It doesn't really matter too much in real life (as
the expression is too complex), but let's better be safe than sorry, and
make sure people won't file bugs about this...
2015-10-24 23:05:51 +02:00
Zbigniew Jędrzejewski-Szmek b8b9d8f5e5 man: also add --enablerepo=updates to dnf invocation
Without the updates repo, we are installing packages from the time
that that version of Fedora was released. Normally, during the
lifetime of the release most packages are updated, so most of the
packages installed would be outdated, and the first update after
installation would update a massive set of packages. Avoid all this
by installing from the updates repo from the start.
2015-10-22 14:11:24 -04:00
Zbigniew Jędrzejewski-Szmek cf48ff5d2a man: remove --nogpg from dnf install command line
Keys for previous and future Fedora distributions were added
for the fedora-repos package recently:
https://bugzilla.redhat.com/show_bug.cgi?id=1246701.
There is no need to skip signature checking.

Also, update to the latest and greatest and remove unnecessary quotes.
2015-10-22 13:34:46 -04:00
Lennart Poettering 7757cfbecb man: drop reference to yum from man pages
Apparently, yum is obsolete, and dnf is the new yum. Mention only dnf
hence, and don't mention yum anymore.
2015-09-22 16:36:49 +02:00
Thomas Hindoe Paaboel Andersen 4f76ef0423 man: typo fixes 2015-09-07 20:06:58 +02:00
Lennart Poettering f757855e81 nspawn: add new .nspawn files for container settings
.nspawn fiels are simple settings files that may accompany container
images and directories and contain settings otherwise passed on the
nspawn command line. This provides an efficient way to attach execution
data directly to containers.
2015-09-06 01:49:06 +02:00
Eugene Yakubovich 5e5bfa6e1c nspawn: add (no)rbind option to --bind and --bind-ro
--bind and --bind-ro perform the bind mount
non-recursively. It is sometimes (often?) desirable
to do a recursive mount. This patch adds an optional
set of bind mount options in the form of:
	--bind=src-path:dst-path:options
options are comma separated and currently only
"rbind" and "norbind" are allowed.
Default value is "rbind".
2015-08-28 18:06:05 -07:00
Richard Maw 2eadf91ca1 man: Document \: escapes in nspawn's --overlay option 2015-08-07 15:50:43 +00:00
Richard Maw 8ef24e7a4f man: Document \: escapes in nspawn's --bind option 2015-08-07 15:50:43 +00:00
Richard Maw ffcd3e89d5 man: Document \: escapes in nspawn's --tmpfs option 2015-08-07 15:50:42 +00:00
Richard Maw 32b64cce23 man: point nspawn --machine to machinectl search-path
The --machine option used to describe searching for machines in
/var/lib/machines, which is not the whole story, so let's link to where
it's described in more detail.
2015-08-05 12:01:16 +00:00
Tom Gundersen 12b42c7667 man: revert dynamic paths for split-usr setups
This did not really work out as we had hoped. Trying to do this upstream
introduced several problems that probably makes it better suited as a
downstream patch after all. At any rate, it is not releaseable in the
current state, so we at least need to revert this before the release.

 * by adjusting the path to binaries, but not do the same thing to the
   search path we end up with inconsistent man-pages. Adjusting the search
   path too would be quite messy, and it is not at all obvious that this is
   worth the effort, but at any rate it would have to be done before we
   could ship this.

 * this means that distributed man-pages does not make sense as they depend
   on config options, and for better or worse we are still distributing
   man pages, so that is something that definitely needs sorting out before
   we could ship with this patch.

 * we have long held that split-usr is only minimally supported in order
   to boot, and something we hope will eventually go away. So before we start
   adding even more magic/effort in order to make this work nicely, we should
   probably question if it makes sense at all.
2015-06-18 19:47:44 +02:00
Filipe Brandenburger 681eb9cf2b man: generate configured paths in manpages
In particular, use /lib/systemd instead of /usr/lib/systemd in distributions
like Debian which still have not adopted a /usr merge setup.

Use XML entities from man/custom-entities.ent to replace configured paths while
doing XSLT processing of the original XML files. There was precedent of some
files (such as systemd.generator.xml) which were already using this approach.

This addresses most of the (manual) fixes from this patch:
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/tree/debian/patches/Fix-paths-in-man-pages.patch?h=experimental-220

The idea of using generic XML entities was presented here:
http://lists.freedesktop.org/archives/systemd-devel/2015-May/032240.html

This patch solves almost all the issues, with the exception of:
- Path to /bin/mount and /bin/umount.
- Generic statements about preference of /lib over /etc.

These will be handled separately by follow up patches.

Tested:
- With default configure settings, ran "make install" to two separate
  directories and compared the output to confirm they matched exactly.
- Used a set of configure flags including $CONFFLAGS from Debian:
  http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/tree/debian/rules
  Installed the tree and confirmed the paths use /lib/systemd instead of
  /usr/lib/systemd and that no other unexpected differences exist.
- Confirmed that `make distcheck` still passes.
2015-05-28 19:28:19 +02:00
Jonathan Boulle 7c918141ed fix typos in systemd-nspawn man page 2015-05-23 10:41:00 +02:00
Lennart Poettering 03cfe0d514 nspawn: finish user namespace support 2015-05-21 16:32:01 +02:00
Lennart Poettering 5a8af538ae nspawn: rework custom mount point order, and add support for overlayfs
Previously all bind mount mounts were applied in the order specified,
followed by all tmpfs mounts in the order specified. This is
problematic, if bind mounts shall be placed within tmpfs mounts.

This patch hence reworks the custom mount point logic, and alwas applies
them in strict prefix-first order. This means the order of mounts
specified on the command line becomes irrelevant, the right operation
will always be executed.

While we are at it this commit also adds native support for overlayfs
mounts, as supported by recent kernels.
2015-05-13 14:07:26 +02:00
Torstein Husebø ff9b60f38b treewide: Correct typos and spell plural of bus consistent 2015-05-11 15:51:30 +02:00
Lennart Poettering 3fe22bb4b6 man: document that nspawn -x, --template= and machinectl clone leave hostname and machine id unmodified 2015-05-05 15:07:00 -07:00
Lennart Poettering 7de7ee62c5 man: nspawn is used in production these days, admit that
Previously, the man page suggested to only use nspawn for testing,
building, and debugging things. However, it is nowadays used in
production and used as building block for rocket, hence let's just admit
that it's pretty much production ready.
2015-05-05 15:07:00 -07:00
Lennart Poettering 64b282ef71 man: document that nspawn's --bind= switch may be used multiple times 2015-04-27 15:40:30 +02:00
Zbigniew Jędrzejewski-Szmek 3ba3a79df4 man: fix a bunch of links
All hail linkchecker!
2015-03-13 23:42:18 -04:00
Lennart Poettering c6c8f6e218 nspawn: make kill signal to use for PID 1 configurable 2015-02-25 22:06:54 +01:00
Lennart Poettering f36933fef6 nspawn: add support for --property= to set scope properties
This is similar to systemd-run's --property= setting.
2015-02-18 19:42:24 +01:00
Zbigniew Jędrzejewski-Szmek 798d3a524e Reindent man pages to 2ch 2015-02-03 23:11:35 -05:00
Zbigniew Jędrzejewski-Szmek 74a6d87d0c man: switch yum to dnf for Fedora
The dnf name is here to stay, we might as well adjust.
2015-02-01 17:22:32 -05:00
Lennart Poettering e0ea94c1e2 man: document new download magic 2015-01-22 15:14:36 +01:00
Tom Gundersen 4bbfe7ad22 nspawn: add ipvlan support 2015-01-20 00:46:13 +01:00
Lennart Poettering 5f129649b9 nspawn,machined: change default container image location from /var/lib/container to /var/lib/machines
Given that this is also the place to store raw disk images which are
very much bootable with qemu/kvm it sounds like a misnomer to call the
directory "container". Hence, let's change this sooner rather than
later, and use the generic name, in particular since we otherwise try to
use the generic "machine" preferably over the more specific "container"
or "vm".
2015-01-15 01:47:21 +01:00
Lennart Poettering 0dfaa00607 nspawn: add "-n" shortcut for "--network-veth"
Now that networkd's IP masquerading support means that running
containers with "--network-veth" will provide network access out of the
box for the container, let's add a shortcut "-n" for it, to make it
easily accessible.
2015-01-13 20:17:06 +01:00
Lennart Poettering 6d0b55c272 nspawn: add new option "--port=" for exposing container ports on the local host
This exposes an IP port on the container as local port using DNAT.
2015-01-13 13:55:15 +01:00
Veres Lajos f131770b14 tree-wide: spelling fixes
https://github.com/vlajos/misspell_fixer

b6fdeb618c
Thanks to Torstein Husebo <torstein@huseboe.net>.
2014-12-30 20:07:04 -05:00
Lennart Poettering 667993e88e man: fedora 21 has been release, suggest 21 as fedora version in example yum command line 2014-12-12 17:30:25 +01:00
Lennart Poettering b9ba4dabba nspawn: when booting in ephemeral mode, append random token to machine name
Also, when booting up an ephemeral container of / use the system
hostname as default machine name.

This way specifiyng -M is unnecessary when booting up an ephemeral
container, while allowing any number of ephemeral containers to run from
the same tree.
2014-12-12 17:30:25 +01:00
Lennart Poettering ec16945ebf nspawn: beef up nspawn with some btrfs magic
This adds --template= to duplicate an OS tree as btrfs snpashot and run
it

This also adds --ephemeral or -x to create a snapshot of an OS tree and
boot that, removing it after exit.
2014-12-12 13:35:32 +01:00
Martin Pitt 574edc9006 nspawn: Add try-{host,guest} journal link modes
--link-journal={host,guest} fail if the host does not have persistent
journalling enabled and /var/log/journal/ does not exist. Even worse, as there
is no stdout/err any more, there is no error message to point that out.

Introduce two new modes "try-host" and "try-guest" which don't fail in this
case, and instead just silently skip the guest journal setup.

Change -j to mean "try-guest" instead of "guest", and fix the wrong --help
output for it (it said "host" before).

Change systemd-nspawn@.service.in to use "try-guest" so that this unit works
with both persistent and non-persistent journals on the host without failing.

https://bugs.debian.org/770275
2014-11-21 14:27:26 +01:00
Ronny Chevalier c45827d6e7 man: fix project reference for archlinux 2014-10-21 01:11:50 +02:00
Lennart Poettering 0b3b83e59b man: move one more nspawn example into a proper <example> section 2014-10-21 01:11:14 +02:00
Ronny Chevalier 1db8c66f2e man: use <example> instead of multiple <refsect1> for examples 2014-10-21 01:09:17 +02:00
Ruben Kerkhof 06b643e7f5 Fix a few more typos 2014-08-30 13:46:07 -04:00
Zbigniew Jędrzejewski-Szmek 5aded36978 man: add a mapping for external manpages
It is annoying when we have dead links on fd.o.

Add project='man-pages|die-net|archlinux' to <citerefentry>-ies.

In generated html, add external links to
http://man7.org/linux/man-pages/man, http://linux.die.net/man/,
https://www.archlinux.org/.

By default, pages in sections 2 and 4 go to man7, since Michael
Kerrisk is the autorative source on kernel related stuff.

The rest of links goes to linux.die.net, because they have the
manpages.

Except for the pacman stuff, since it seems to be only available from
archlinux.org.

Poor gummiboot gets no link, because gummitboot(8) ain't to be found
on the net. According to common wisdom, that would mean that it does
not exist. But I have seen Kay using it, so I know it does, and
deserves to be found. Can somebody be nice and put it up somewhere?
2014-07-07 18:36:55 -04:00
Lennart Poettering 108e8cd11e man: document nspawn's new --volatile switch 2014-07-04 12:56:57 +02:00
Lennart Poettering 5ae4d543cb os-release: define /usr/lib/os-release as fallback for /etc/os-release
The file should have been in /usr/lib/ in the first place, since it
describes the OS container in /usr (and not the configuration in /etc),
hence, let's support os-release files in /usr/lib as fallback if no
version in /etc exists, following the usual override logic.

A prior commit already enabled tmpfiles to create /etc/os-release as a
symlink to /usr/lib/os-release should it be missing, thus providing nice
compatibility with applications only checking in /etc.

While it's probably a good idea if all apps check both locations via a
fallback logic, it is only necessary in the early boot process, as long
as the /etc/os-release symlink has not been restored, in case we boot
with an empty /etc.
2014-06-13 20:11:59 +02:00