b26fa1a2fbcfee7d03b0c8fd15ec3aa64ae70b9f |
|
10-Feb-2016 |
Daniel Mack <daniel@zonque.org> |
tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file. |
2b26a72816aac6d28f44460ffe28882f006489c8 |
|
03-Feb-2016 |
Lennart Poettering <lennart@poettering.net> |
nspawn: make sure --help fits it 79ch |
7732f92bad5f24a4bd03bb357af46da56b0ac94d |
|
03-Feb-2016 |
Lennart Poettering <lennart@poettering.net> |
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. |
5f932eb9af7a5e4723855bcd776c2acaa2a31932 |
|
03-Feb-2016 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add new --chdir= switch
Fixes: #2192 |
ba8e6c4d0e074a3df0b55751f1753460ce82f1eb |
|
28-Jan-2016 |
Lennart Poettering <lennart@poettering.net> |
nspawn: make sure --link-journal=host may be used twice in a row
Fixes #2186
This fixes fall-out from 574edc90066c3faeadcf4666928ed9b0ac409c75. |
8054d749c4ad69503b5b2735864f8e72a1b73e62 |
|
28-Jan-2016 |
Lennart Poettering <lennart@poettering.net> |
nspawn: make journal linking non-fatal in try and auto modes
Fixes #2091 |
61e741ed3df2a73f4ff138d276e58f8fb2439337 |
|
25-Jan-2016 |
Michal Sekletar <msekleta@redhat.com> |
nspawn: fix memory leak |
a103496ca585e22bb5e386e3238b468d133f5659 |
|
11-Jan-2016 |
Ismo Puustinen <ismo.puustinen@intel.com> |
capabilities: keep bounding set in non-inverted format.
Change the capability bounding set parser and logic so that the bounding
set is kept as a positive set internally. This means that the set
reflects those capabilities that we want to keep instead of drop. |
4afd3348c7506dd1d36305b7bcb9feb8952b9d6b |
|
27-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy
GLIB has recently started to officially support the gcc cleanup
attribute in its public API, hence let's do the same for our APIs.
With this patch we'll define an xyz_unrefp() call for each public
xyz_unref() call, to make it easy to use inside a
__attribute__((cleanup())) expression. Then, all code is ported over to
make use of this.
The new calls are also documented in the man pages, with examples how to
use them (well, I only added docs where the _unref() call itself already
had docs, and the examples, only cover sd_bus_unrefp() and
sd_event_unrefp()).
This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we
tend to call our destructors these days.
Note that this defines no public macro that wraps gcc's attribute and
makes it easier to use. While I think it's our duty in the library to
make our stuff easy to use, I figure it's not our duty to make gcc's own
features easy to use on its own. Most likely, client code which wants to
make use of this should define its own:
#define _cleanup_(function) __attribute__((cleanup(function)))
Or similar, to make the gcc feature easier to use.
Making this logic public has the benefit that we can remove three header
files whose only purpose was to define these functions internally.
See #2008. |
4a0b58c4a30ecaa61202f845ed86f75b36370cd0 |
|
17-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: use right cast macros for UIDs, GIDs and PIDs |
f6d6bad1461a8f545a80955fadd7ee0c10db15bb |
|
12-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
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. |
e1427b138fbf7b7f13bb61187635b882be3ca2b2 |
|
09-Nov-2015 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: apply errno.cocci
with small manual cleanups for style. |
6aadfa4c5239f6cd2a80e82f6bc102cc116583df |
|
09-Nov-2015 |
Iago López Galeiras <iaguis@gmail.com> |
nspawn: support custom container service name
We were hardcoding "systemd-nspawn" as the value of the $container env
variable and "nspawn" as the service string in machined registration.
This commit allows the user to configure it by setting the
$SYSTEMD_NSPAWN_CONTAINER_SERVICE env variable when calling
systemd-nspawn.
If $SYSTEMD_NSPAWN_CONTAINER_SERVICE is not set, we use the string
"systemd-nspawn" for both, fixing the previous inconsistency. |
a8eaaee72a2f06e0fb64fb71de3b71ecba31dafb |
|
06-Nov-2015 |
Jan Engelhardt <jengelh@inai.de> |
doc: correct orthography, word forms and missing/extraneous words |
b938cb902c3b5bca807a94b277672c64d6767886 |
|
06-Nov-2015 |
Jan Engelhardt <jengelh@inai.de> |
doc: correct punctuation and improve typography in documentation |
35607a8d1c843d352f61b6108a147e84fc6a8b00 |
|
05-Nov-2015 |
Michal Schmidt <mschmidt@redhat.com> |
nspawn: save errno before reopening log after exec failure |
070edd97f397c90015c9ecad33ab9bf50d84ceb4 |
|
05-Nov-2015 |
Michal Schmidt <mschmidt@redhat.com> |
nspawn: no fake errno
The S_ISREG test does not set errno, so don't use it in the error
message. |
4314d33f514212f1f353c80cda4d4f0b845e082e |
|
05-Nov-2015 |
Michal Schmidt <mschmidt@redhat.com> |
nspawn: simplify error returns
Use the "return log_error_errno(...)" idiom to have fewer curly braces.
The last hunk also fixes the return value of setup_journal(), but the
fix has no practical effect. |
709f6e46a35ec492b70eb92943d82a8d838ce918 |
|
05-Nov-2015 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: use the negative error codes returned by our functions
Our functions return negative error codes.
Do not rely on errno being set after calling our own functions. |
97044145b48fa5644ecd23e73bc33980faeabda3 |
|
31-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
core,nspawn: minor coding style fixes |
6cbe4ed1e11fd2916f9dde39b27c70ffa6ba01d9 |
|
28-Oct-2015 |
Susant Sahani <ssahani@gmail.com> |
nspwan: port to extract_first_word |
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out allocation calls into alloc-util.[ch] |
15a5e95075a7f6007dd97b2a165c8ed16fe683df |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out printf() helpers to stdio-util.h |
430f0182b72373145c839dbfe99d2382855cb8f8 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
src/basic: rename audit.[ch] → audit-util.[ch] and capability.[ch] → capability-util.[ch]
The files are named too generically, so that they might conflict with
the upstream project headers. Hence, let's add a "-util" suffix, to
clarify that this are just our utility headers and not any official
upstream headers. |
affb60b1ef0cb48388d23360c6f3b043c50f6b8c |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out umask-related code to umask-util.h |
8fcde01280adcbd07e8205b91ac52b06305b6208 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split stat()/statfs()/stavfs() related calls into stat-util.[ch] |
f4f15635ec05293ffcc83a5b39f624bbabbd8fd0 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move a number of fs operations into fs-util.[ch] |
4349cd7c1d153c4ffa23cf1cff1644e0afa9bcf0 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move mount related utility calls to mount-util.[ch] |
6bedfcbb2970e06a4d3280c8fb62083d252ede73 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split string parsing related calls from util.[ch] into parse-util.[ch] |
2583fbea8e762d2e915582af60560f884d5093f5 |
|
26-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
socket-util: move remaining socket-related calls from util.[ch] to socket-util.[ch] |
b1d4f8e154bf61b5de1b27461ef8e9c8c5e838a1 |
|
26-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out user/group/uid/gid calls into user-util.[ch] |
3ffd4af22052963e7a29431721ee204e634bea75 |
|
25-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over. |
07630cea1f3a845c09309f197ac7c4f11edd3b62 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.
This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.
Also touches a few unrelated include files. |
0f03c2a4c093e3d44f4072144827e943c05c8904 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
path-util: unify how we process paths specified on the command line
Let's introduce a common function that makes relative paths absolute and
warns about any errors while doing so. |
0f4743651081b5367ab06f238827ddfd4da74e74 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: get_current_dir_name() can return errors other than ENOMEM
get_current_dir_name() can return a variety of errors, not just ENOMEM,
hence don't blindly turn its errors to ENOMEM, but return correct errors
in path_make_absolute_cwd().
This trickles down into a couple of other functions, some of which
receive unrelated minor fixes too with this commit. |
16fb773ee33a5b4e85605bf18a0572bead1b8224 |
|
22-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: don't try to resolve passed binary before entering namespace
Othewise we might follow the symlinks on the host, instead of the
container.
Fixes #1400 |
0e2656744f6d2e2cf65788a497f266d469865e30 |
|
22-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: rework how we determine private networking settings
Make sure we acquire CAP_NET_ADMIN if we require virtual networking.
Make sure we imply virtual ethernet correctly when bridge is request.
Fixes: #1511
Fixes: #1554
Fixes: #1590 |
5bcd08db289cd02aad8a89b37b2a46244a7bd473 |
|
22-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
btrfs: beef-up btrfs support with a limited understanding of quota
With this change we understand more than just leaf quota groups for
btrfs file systems. Specifically:
- When we create a subvolume we can now optionally add the new subvolume
to all qgroups its parent subvolume was member of too. Alternatively
it is also possible to insert an intermediary quota group between the
parent's qgroups and the subvolume's leaf qgroup, which is useful for
a concept of "subtree" qgroups, that contain a subvolume and all its
children.
- The remove logic for subvolumes has been updated to optionally remove
any leaf qgroups or "subtree" qgroups, following the logic above.
- The snapshot logic for subvolumes has been updated to replicate the
original qgroup setup of the source, if it follows the "subtree"
design described above. It will not cover qgroup setups that introduce
arbitrary qgroups, especially those orthogonal to the subvolume
hierarchy.
This also tries to be more graceful when setting up /var/lib/machines as
btrfs. For example, if mkfs.btrfs is missing we don't even try to set it
up as loopback device.
Fixes #1559
Fixes #1129 |
d167824896e583ffaca891b1c355ff852496ff66 |
|
20-Oct-2015 |
Iago López Galeiras <iaguis@gmail.com> |
nspawn: skip /sys-as-tmpfs if we don't use private-network
Since v3.11/7dc5dbc ("sysfs: Restrict mounting sysfs"), the kernel
doesn't allow mounting sysfs if you don't have CAP_SYS_ADMIN rights over
the network namespace.
So the mounting /sys as a tmpfs code introduced in
d8fc6a000fe21b0c1ba27fbfed8b42d00b349a4b doesn't work with user
namespaces if we don't use private-net. The reason is that we mount
sysfs inside the container and we're in the network namespace of the host
but we don't have CAP_SYS_ADMIN over that namespace.
To fix that, we mount /sys as a sysfs (instead of tmpfs) if we don't use
private network and ignore the /sys-as-a-tmpfs code if we find that /sys
is already mounted as sysfs.
Fixes #1555 |
ae3dde801253b1d5f7363bb9fb06bcb230f00eb8 |
|
07-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
machinectl: fix race when opening new shells with "machinectl shell"
Previously, we'd allocate the TTY, spawn a service on it, but
immediately start processing the TTY and forwarding it to whatever the
commnd was started on. This is however problematic, as the TTY might get
actually opened only much later by the service. We'll hence first get
EIOs on the master as the other side is still closed, and hence
considered it hung up and terminated the session.
With this change we add a flag to the pty forwarding logic:
PTY_FORWARD_IGNORE_INITIAL_VHANGUP. If set, we'll ignore all hangups
(i.e. EIOs) on the master PTY until the first byte is successfully read.
From that point on we consider a hangup/EIO a regular connection termination. This
way, we handle the race: when we get EIO initially we'll ignore it,
until the connection is properly set up, at which time we start
honouring it. |
d8fc6a000fe21b0c1ba27fbfed8b42d00b349a4b |
|
30-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: mount /sys as tmpfs, and then mount only select subdirs of the real sysfs below it
This way we can hide things like /sys/firmware or /sys/hypervisor from
the container, while keeping the device tree around.
While this is a security benefit in itself it also allows us to fix
issue #1277.
Previously we'd mount /sys before creating the user namespace, in order
to be able to mount /sys/fs/cgroup/* beneath it (which resides in it),
which we can only mount outside of the user namespace. To ensure that
the user namespace owns the network namespace we'd set up the network
namespace at the same time as the user namespace. Thus, we'd still see
the /sys/class/net/ from the originating network namespace, even though
we are in our own network namespace now. With this patch, /sys is
mounted before transitioning into the user namespace as tmpfs, so that
we can also mount /sys/fs/cgroup/* into it this early. The directories
such as /sys/class/ are then later added in from the real sysfs from
inside the network and user namespace so that they actually show whatis
available in it.
Fixes #1277 |
403af78c8049358496ec10920b3aaf741056daf9 |
|
30-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: fix user namespace support
We didn#t actually pass ownership of /run to the UID in the container
since some releases, let's fix that. |
db3b1dedb27b631f6685eda394977249804966c6 |
|
30-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: order includes |
3f6fd1ba65f962702753c4ad284b588e59689a23 |
|
29-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: introduce common version() implementation and use it everywhere
This also allows us to drop build.h from a ton of files, hence do so.
Since we touched the #includes of those files, let's order them properly
according to CODING_STYLE. |
189d5bac5c45a6a735489541e285dec8bfc1d38d |
|
29-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: unify implementation of NOP signal handler
This is highly complex code after all, we really should make sure to
only keep one implementation of this extremely difficult function
around. |
2feceb5eb945d430999a8130e14c512af35b21d9 |
|
29-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: take benefit of the fact that fdset_free() returns NULL |
3ee897d6c2401effbc82f5eef35fce405781d6c8 |
|
29-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: port more code to use send_one_fd() and receive_one_fd()
Also, make it slightly more powerful, by accepting a flags argument, and
make it safe for handling if more than one cmsg attribute happens to be
attached. |
c0ffce2bd179699ad77808ffe480e499f1f775ef |
|
22-Sep-2015 |
Krzesimir Nowak <krzesimir@endocode.com> |
nspawn, machined: fix comments and error messages
A bunch of "Client -> Child" fixes and one barrier-enumerator fix.
(David: rebased on master) |
327e26d6892c2ba6ab1c8c00d4dda8aa65ecab38 |
|
22-Sep-2015 |
Krzesimir Nowak <krzesimir@endocode.com> |
nspawn: close unneeded sockets in outer child
(David: Note, this is just a cleanup and doesn't fix any bugs) |
d960371482d75711e61896f27ea0d3740ea69fe0 |
|
22-Sep-2015 |
David Herrmann <dh.herrmann@gmail.com> |
util: introduce {send,receive}_one_fd()
Introduce two new helpers that send/receive a single fd via a unix
transport. Also make nspawn use them instead of hard-coding it.
Based on a patch by Krzesimir Nowak. |
59f448cf15f94bc5ebfd5b254de6f2441d02fbec |
|
10-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: never use the off_t unless glibc makes us use it
off_t is a really weird type as it is usually 64bit these days (at least
in sane programs), but could theoretically be 32bit. We don't support
off_t as 32bit builds though, but still constantly deal with safely
converting from off_t to other types and back for no point.
Hence, never use the type anymore. Always use uint64_t instead. This has
various benefits, including that we can expose these values directly as
D-Bus properties, and also that the values parse the same in all cases. |
82116c43298c9e638742a87072fa29176104edf4 |
|
08-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: also close uid shift socket in the parent
We should really close all parent sides of our child/parent socket
pairs. |
76d448820e9e6b11dbdc5778802bda6f998212b4 |
|
08-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: short reads do not set errno, hence don't try to print it |
4610de5022f4af31dbe86d244c272426dffd9fd8 |
|
08-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
inspawn: switch from SOCK_DGRAM to SOCK_SEQPACKET for internal socketpairs
SOCK_DGRAM and SOCK_SEQPACKET have very similar semantics when used with
socketpair(). However, SOCK_SEQPACKET has the advantage of knowing a
hangup concept, since it is inherently connection-oriented.
Since we use socket pairs to communicate between the nspawn main process
and the nspawn child process, where the child might die abnormally it's
interesting to us to learn about this via hangups if the child side of
the pair is closed. Hence, let's switch to SOCK_SEQPACKET for these
internal communication sockets.
Fixes #956. |
07fa00f9d9f4bcedc2289680b6d39f9b0815f577 |
|
08-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: properly propagate errors when we fail to set soemthing up |
8fe0087ede134527b8af8580abc966edb6fd3ff4 |
|
07-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: sort and clean up included header list
Let's remove unnecessary inclusions, and order the list alphabetically
as suggested in CODING_STYLE now. |
2b5c04d59cf3442791aff49013921acb68eb9fc6 |
|
07-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: remove nspawn.h, it's empty now |
ee64508006f5db25d8819890e15603790bfebc2f |
|
07-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: split out --uid= logic into nspawn-setuid.[ch] |
b7103bc5f43ceed8e1de71f3d38757dea542b705 |
|
07-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: split out machined registration code to nspawn-register.[ch] |
34829a324b1ffc6cb8405223329a9c55cd8de0ee |
|
07-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: split out cgroup related calls into nspawn-cgroup.[ch] |
9a2a5625bfd395033a0767d1685f725ca8293dd9 |
|
07-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: split out network related code to nspawn-network.[ch] |
7a8f63251df2202e59a76e537a688fe7500cb1ad |
|
07-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: split all port exposure code into nspawn-expose-port.[ch] |
e83bebeff7d9d734e17c3e38ac13daabc09518e1 |
|
07-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: split out mount related functions into a new nspawn-mount.c file |
f757855e81fc0bc116de372220096e532afb5cb8 |
|
06-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
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. |
98e4d8d7635496cbf62c8127ce6a8e8f7604a031 |
|
04-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: enable all controllers we can for the "payload" subcgroup we create
In the unified hierarchy delegating controller access is safe, hence
make sure to enable all controllers for the "payload" subcgroup if we
create it, so that the container will have all controllers enabled the
nspawn service itself has. |
efdb02375beb0a940c3320865572913780b4d7de |
|
01-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
core: unified cgroup hierarchy support
This patch set adds full support the new unified cgroup hierarchy logic
of modern kernels.
A new kernel command line option "systemd.unified_cgroup_hierarchy=1" is
added. If specified the unified hierarchy is mounted to /sys/fs/cgroup
instead of a tmpfs. No further hierarchies are mounted. The kernel
command line option defaults to off. We can turn it on by default as
soon as the kernel's APIs regarding this are stabilized (but even then
downstream distros might want to turn this off, as this will break any
tools that access cgroupfs directly).
It is possibly to choose for each boot individually whether the unified
or the legacy hierarchy is used. nspawn will by default provide the
legacy hierarchy to containers if the host is using it, and the unified
otherwise. However it is possible to run containers with the unified
hierarchy on a legacy host and vice versa, by setting the
$UNIFIED_CGROUP_HIERARCHY environment variable for nspawn to 1 or 0,
respectively.
The unified hierarchy provides reliable cgroup empty notifications for
the first time, via inotify. To make use of this we maintain one
manager-wide inotify fd, and each cgroup to it.
This patch also removes cg_delete() which is unused now.
On kernel 4.2 only the "memory" controller is compatible with the
unified hierarchy, hence that's the only controller systemd exposes when
booted in unified heirarchy mode.
This introduces a new enum for enumerating supported controllers, plus a
related enum for the mask bits mapping to it. The core is changed to
make use of this everywhere.
This moves PID 1 into a new "init.scope" implicit scope unit in the root
slice. This is necessary since on the unified hierarchy cgroups may
either contain subgroups or processes but not both. PID 1 hence has to
move out of the root cgroup (strictly speaking the root cgroup is the
only one where processes and subgroups are still allowed, but in order
to support containers nicey, we move PID 1 into the new scope in all
cases.) This new unit is also used on legacy hierarchy setups. It's
actually pretty useful on all systems, as it can then be used to filter
journal messages coming from PID 1, and so on.
The root slice ("-.slice") is now implicitly created and started (and
does not require a unit file on disk anymore), since
that's where "init.scope" is located and the slice needs to be started
before the scope can.
To check whether we are in unified or legacy hierarchy mode we use
statfs() on /sys/fs/cgroup. If the .f_type field reports tmpfs we are in
legacy mode, if it reports cgroupfs we are in unified mode.
This patch set carefuly makes sure that cgls and cgtop continue to work
as desired.
When invoking nspawn as a service it will implicitly create two
subcgroups in the cgroup it is using, one to move the nspawn process
into, the other to move the actual container processes into. This is
done because of the requirement that cgroups may either contain
processes or other subgroups. |
a19222e1d39e8f0ae254bf02b7babb0bd73ee5be |
|
29-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: don't try to extract quotes from option string, glibc doesn't do that either
Follow-up regarding #649. |
5e5bfa6e1c915e795dd99ab65275c4bf9af667ed |
|
29-Aug-2015 |
Eugene Yakubovich <eugene.yakubovich@coreos.com> |
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". |
c1521918b48f45a316f0bd034976809ae0ce4dd8 |
|
25-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: make sure --template= and --machine= my be combined
Fixes #1018.
Based on a patch from Seth Jennings. |
62f176068c31de4b7b56aae06efaf27c410dc3c3 |
|
21-Aug-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
remove unused variables |
62f9f39a455204fac698f702a1369bd6fdbdbf9d |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
nspawn: Allow : characters in overlay paths
: characters can be entered with the \: escape sequence. |
872d0dbdc335053ee94ae9158fb9637c3c904ade |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
nspawn: escape paths in overlay mount options
Overlayfs uses , as an option separator and : as a list separator. These
characters are both valid in file paths, so overlayfs allows file paths
which contain these characters to backslash escape these values. |
e4a5d9edee1d967e4c1386ce442cbe1f465766ec |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
nspawn: Allow : characters in nspawn --bind paths
: characters in bind paths can be entered as the \: escape sequence. |
6330ee108362a419dfc8806ab6402416c793a4ca |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
nspawn: Allow : characters in --tmpfs path
This now accepts : characters with the \: escape sequence.
Other escape sequences are also interpreted, but having a \ in your file
path is less likely than :, so this shouldn't break anyone's existing
tools. |
ae691c1d9382995ea7e28317f5c37023229c27ee |
|
06-Aug-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
hostname-util: get rid of unused parameter of hostname_cleanup()
All users are now setting lowercase=false. |
97b11eedff9d2e17101ad453caf9e48b73246719 |
|
31-Jul-2015 |
David Herrmann <dh.herrmann@gmail.com> |
tree-wide: introduce mfree()
Pretty trivial helper which wraps free() but returns NULL, so we can
simplify this:
free(foobar);
foobar = NULL;
to this:
foobar = mfree(foobar); |
2fc09a9cdd1ad25bc7c53a23d5301eb952e1ce3d |
|
30-Jul-2015 |
Daniel Mack <daniel@zonque.org> |
tree-wide: use free_and_strdup()
Use free_and_strdup() where appropriate and replace equivalent,
open-coded versions. |
3dce891505f7b2bef4d492203125da765e128b1b |
|
23-Jul-2015 |
Mike Gilbert <floppym@gentoo.org> |
nspawn: Don't pass uid mount option for devpts
Mounting devpts with a uid breaks pty allocation with recent glibc
versions, which expect that the kernel will set the correct owner for
user-allocated ptys.
The kernel seems to be smart enough to use the correct uid for root when
we switch to a user namespace.
This resolves #337. |
af86c440389986ed72cb1a943a98d1aaf297f467 |
|
07-Jul-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Remove repeated 'the's |
ad118bda159d3f9c27c5a15ace54cf808a6e8788 |
|
07-Jul-2015 |
Daniel Mack <daniel@zonque.org> |
tree-wide: fix write_string_file() user that should not create files
The latest consolidation cleanup of write_string_file() revealed some users
of that helper which should have used write_string_file_no_create() in the
past but didn't. Basically, all existing users that write to files in /sys
and /proc should not expect to write to a file which is not yet existant. |
4c1fc3e404d648c70bd2f50ac50aeac6ece8872e |
|
07-Jul-2015 |
Daniel Mack <daniel@zonque.org> |
fileio: consolidate write_string_file*()
Merge write_string_file(), write_string_file_no_create() and
write_string_file_atomic() into write_string_file() and provide a flags mask
that allows combinations of atomic writing, newline appending and automatic
file creation. Change all users accordingly. |
825d5287d7717b2dd220846217891c110e7c3083 |
|
06-Jul-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
nspawn: Communicate determined UID shift to parent
There is logic to determine the UID shift from the file-system, rather
than having it be explicitly passed in.
However, this needs to happen in the child process that sets up the
mounts, as what's important is the UID of the mounted root, rather than
the mount-point.
Setting up the UID map needs to happen in the parent becuase the inner
child needs to have been started, and the outer child is no longer able
to access the uid_map file, since it lost access to it when setting up
the mounts for the inner child.
So we need to communicate the uid shift back out, along with the PID of
the inner child process.
Failing to communicate this means that the invalid UID shift, which is
the value used to specify "this needs to be determined from the file
system" is left invalid, so setting up the user namespace's UID shift
fails. |
dbb60d694463a2d73d12a1d6725685dc1eeba078 |
|
06-Jul-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: fix indenting |
03976f7b4a84b8b1492a549a3470b2bba8f37008 |
|
03-Jul-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: introduce new sd_bus_flush_close_unref() call
sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush()
(which writes all unwritten messages out) + sd_bus_close() (which
terminates the connection, releasing all unread messages) +
sd_bus_unref() (which frees the connection).
The combination of this call is used pretty frequently in systemd tools
right before exiting, and should also be relevant for most external
clients, and is hence useful to cover in a call of its own.
Previously the combination of the three calls was already done in the
_cleanup_bus_close_unref_ macro, but this was only available internally.
Also see #327 |
391567f479f56c2ae7c2beb9eb5305f5c02f5d82 |
|
03-Jul-2015 |
Lennart Poettering <lennart@poettering.net> |
Revert "nspawn: determine_uid_shift before forking" |
7fe2bb84c49233ca4da76c0df377819b93571f9c |
|
30-Jun-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
nspawn: determine_uid_shift before forking
It is needed in one branch of the fork, but calculated in another
branch.
Failing to do this means using --private-users without specifying a uid
shift always fails because it tries to shift the uid to UID_INVALID. |
3c59d4f21f714838ce0c28b2a4ff305e56a4a342 |
|
30-Jun-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
nspawn: Don't remount with fewer options
When we do a MS_BIND mount, it inherits the flags of its parent mount.
When we do a remount, it sets the flags to exactly what is specified.
If we are in a user namespace then these mount points have their flags
locked, so you can't reduce the protection.
As a consequence, the default setup of mount_all doesn't work with user
namespaces. However if we ensure we add the mount flags of the parent
mount when remounting, then we aren't removing mount options, so we
aren't trying to unlock an option that we aren't allowed to. |
68a313c5921d32896136e0775ecb375b0be60206 |
|
18-Jun-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: suppress warning when /etc/resolv.conf is a valid symlink
In such a case let's suppress the warning (downgrade to LOG_DEBUG),
under the assumption that the user has no config file to update in its
place, but a symlink that points to something like resolved's
automatically managed resolve.conf file.
While we are at it, also stop complaining if we cannot write /etc/resolv.conf
due to a read-only disk, given that there's little we could do about it. |
503546da7cb28219193ccad70b9682bede1f62e5 |
|
17-Jun-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: when exiting, flush all remaining bytes from the pty to stdout
This is a simpler fix for #210, it simply uses copy_bytes() for the
copying. |
b774fb7f002c9877391e8d4fe8e6b6d0ea8647da |
|
16-Jun-2015 |
Djalal Harouni <djalal@endocode.com> |
nspawn: check if kernel supports userns as early as possible
If the kernel do not support user namespace then one of the children
created by nspawn parent will fail at clone(CLONE_NEWUSER) with the
generic error EINVAL and without logging the error. At the same time
the parent may also try to setup the user namespace and will fail with
another error.
To improve this, check if the kernel supports user namespace as early
as possible. |
72c0a2c255b172ebbb2a2b7dab7c9aec4c9582d9 |
|
15-Jun-2015 |
Lennart Poettering <lennart@poettering.net> |
everywhere: port everything to sigprocmask_many() and friends
This ports a lot of manual code over to sigprocmask_many() and friends.
Also, we now consistly check for sigprocmask() failures with
assert_se(), since the call cannot realistically fail unless there's a
programming error.
Also encloses a few sd_event_add_signal() calls with (void) when we
ignore the return values for it knowingly. |
770b5ce4fc31a336a41e81381c229da725ef0cfa |
|
15-Jun-2015 |
Lennart Poettering <lennart@poettering.net> |
tmpfiles: automatically remove old machine snapshots at boot
Remove old temporary snapshots, but only at boot. Ideally we'd have
"self-destroying" btrfs snapshots that go away if the last last
reference to it does. To mimic a scheme like this at least remove the
old snapshots on fresh boots, where we know they cannot be referenced
anymore. Note that we actually remove all temporary files in
/var/lib/machines/ at boot, which should be safe since the directory has
defined semantics. In the root directory (where systemd-nspawn
--ephemeral places snapshots) we are more strict, to avoid removing
unrelated temporary files.
This also splits out nspawn/container related tmpfiles bits into a new
tmpfiles snippet to systemd-nspawn.conf |
14bcf25c8b94b5c3556ba3983028a2b35ed0572f |
|
15-Jun-2015 |
Lennart Poettering <lennart@poettering.net> |
util: when creating temporary file names, allow including extra id string in it
This adds a "char *extra" parameter to tempfn_xxxxxx(), tempfn_random(),
tempfn_ranomd_child(). If non-NULL this string is included in the middle
of the newly created file name. This is useful for being able to
distuingish the kind of temporary file when we see one.
This also adds tests for the three call.
For now, we don't make use of this at all, but port all users over. |
12c2884c552de25bc9c6155cafff619f6c1766b3 |
|
15-Jun-2015 |
Daniel Mack <daniel@zonque.org> |
firewall: rename fw-util.[ch] → firewall-util.[ch]
The names fw-util.[ch] are too ambiguous, better rename the files to
firewall-util.[ch]. Also rename the test accordingly. |
9b1cbdc6e18ddeddc42df558e574322c64867b24 |
|
15-Jun-2015 |
Iago López Galeiras <iago@endocode.com> |
nspawn: make seccomp loading errors non-fatal
seccomp_load returns -EINVAL when seccomp support is not enabled in the
kernel [1]. This should be a debug log, not an error that interrupts nspawn.
If the seccomp filter can't be set and audit is enabled, the user will
get an error message anyway.
[1]: http://man7.org/linux/man-pages/man2/prctl.2.html |
1c4baffc1895809bae9ac36b670af90a4cb9cd7d |
|
13-Jun-2015 |
Tom Gundersen <teg@jklm.no> |
sd-netlink: rename from sd-rtnl |
31710be527104abad7541b122ee10c4560bd14d2 |
|
11-Jun-2015 |
Tom Gundersen <teg@jklm.no> |
sd-rtnl: make joining broadcast groups implicit |
ce30c8dcb41dfe9264f79f30c7f51c0e74576638 |
|
10-Jun-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: whenever we fork off a foreign child process reset signal mask/handlers
Also, when the child is potentially long-running make sure to set a
death signal.
Also, ignore the result of the reset operations explicitly by casting
them to (void). |
24882e06c135584f16f31ba8a00fecde8b7f6fad |
|
29-May-2015 |
Lennart Poettering <lennart@poettering.net> |
util: split out signal-util.[ch] from util.[ch]
No functional changes. |
e26d6ce517a49c246141ed20528614823c2f5799 |
|
29-May-2015 |
Martin Pitt <martin.pitt@ubuntu.com> |
path-util: Change path_is_mount_point() symlink arg from bool to flags
This makes path_is_mount_point() consistent with fd_is_mount_point() wrt.
flags. |
cc9fce65544117f9c5e02daed6fb445c10127e37 |
|
25-May-2015 |
Tom Gundersen <teg@jklm.no> |
nspawn: fix memleak
This was a typo, swapping prefix_root() in place of prefix_roota().
Fixes CID 1299640. |
2371271c2acaeab31e232b6749f12aeac7c18348 |
|
25-May-2015 |
Tom Gundersen <teg@jklm.no> |
nspawn: avoid memleak
Simplify the code a bit, at the cost of potentially duplicating some
memory unneccessarily.
Fixes CID 1299641. |
4b53a9d21b5d280e1c2e42f5bd29193754251c1e |
|
25-May-2015 |
Tom Gundersen <teg@jklm.no> |
nspawn: drop some debugging code
These have no effect.
Fixes CID 1299643. |
f001a83522284bc85c1fdc352229e58316ce0e16 |
|
25-May-2015 |
Tom Gundersen <teg@jklm.no> |
nspawn: make coverity happy
Rather than checking the return of asprintf() we are checking if buf gets allocated,
make it clear that it is ok to ignore the return value.
Fixes CID 1299644. |
637aa8a36ce21e0c83466d9b91ee1bfad2404d1c |
|
24-May-2015 |
Umut Tezduyar Lindskog <umut.tezduyar@axis.com> |
nspawn: be verbose about interface names
Allowed interface name is relatively small. Lets not make
users go in to the source code to figure out what happened.
--machine=debian-tree conflicts with
--machine=debian-tree2
ex: Failed to add new veth \
interfaces (host0, vb-debian-tree): File exists |
5ba7a26847846322740c02b9b469f42ea4c3f105 |
|
21-May-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: prohibit access to the kernel log buffer by default
Unless CAP_SYSLOG is explicitly passed block all access to kmg |
050f727728f0631ce2b9c5f9635054480ccea3f6 |
|
21-May-2015 |
Lennart Poettering <lennart@poettering.net> |
util: introduce PERSONALITY_INVALID as macro for 0xffffffffLU |
03cfe0d51499e86b1573d121337594719d9f2012 |
|
21-May-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: finish user namespace support |
6458ec20b574edf7170fda61c51ccd3c6e73937f |
|
20-May-2015 |
Lennart Poettering <lennart@poettering.net> |
core,nspawn: unify code that moves the root dir |
6b7d2e9ea4cdb4cfa1512d37548a1a967623d7f2 |
|
18-May-2015 |
Alban Crequy <alban@endocode.com> |
nspawn: close extra fds before execing init
When systemd-nspawn gets exec*()ed, it inherits the followings file
descriptors:
- 0, 1, 2: stdin, stdout, stderr
- SD_LISTEN_FDS_START, ... SD_LISTEN_FDS_START+LISTEN_FDS: file
descriptors passed by the system manager (useful for socket
activation). They are passed to the child process (process leader).
- extra lock fd: rkt passes a locked directory as an extra fd, so the
directory remains locked as long as the container is alive.
systemd-nspawn used to close all open fds except 0, 1, 2 and the
SD_LISTEN_FDS_START..SD_LISTEN_FDS_START+LISTEN_FDS. This patch delays
the close just before the exec so the nspawn process (parent) keeps the
extra fds open.
This patch supersedes the previous attempt ("cloexec extraneous fds"):
http://lists.freedesktop.org/archives/systemd-devel/2015-May/031608.html |
958b66ea16deddd794b3a52643bd44633e165ead |
|
18-May-2015 |
Lennart Poettering <lennart@poettering.net> |
util: split all hostname related calls into hostname-util.c |
ce5b3ad4508fa6d561fcccff0852afaace1d82ac |
|
14-May-2015 |
Stefan Junker <code@stefanjunker.de> |
nspawn: allow access to device nodes listed in --bind= and --bind-ro= switches
https://bugs.freedesktop.org/show_bug.cgi?id=90385 |
875e1014dd9d55cd0692dcce843598cffb2d09b0 |
|
13-May-2015 |
Iago López Galeiras <iago@endocode.com> |
nspawn: skip symlink to a combined cgroup hierarchy if it already exists
If a symlink to a combined cgroup hierarchy already exists and points to
the right path, skip it. This avoids an error when the cgroups are set
manually before calling nspawn. |
54b4755f15438c86991d5a4eaadc47150f7e5a84 |
|
13-May-2015 |
Iago López Galeiras <iago@endocode.com> |
nspawn: only mount the cgroup root if it's not already mounted
This allows the user to set the cgroups manually before calling nspawn. |
5a8af538aee99741ab492506b4284fdd26b597d1 |
|
13-May-2015 |
Lennart Poettering <lennart@poettering.net> |
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. |
27023c0ef5701d31ae2a985d986674282d465b0f |
|
11-May-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: pass on kill signal setting to contaner scope
Let's just pass on what the user set for us. |
1a2399e57d9f5943a508720aaddc87512a972378 |
|
28-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: when run as a service, don't ask machined for terminatin of ourselves |
773ce3d89c25aa51b0fe9085bd0eb7ba5e50508b |
|
28-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: make sure we install the device policy if nspawn is run as unit as on the command line |
aee327b8169670986f6a48acbd5ffe1355bfcf27 |
|
22-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: don't inherit read-only flag from disk image if --ephemeral is used
When --ephemeral is used there's no need to keep the image read-only, so
let's not do that then. |
10a8700606d832ba88706f35e63d37b98c409d10 |
|
21-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: get rid of more strerror() calls |
288a74cce597f81d3ba01d8a5ca7d2ba5b654b7e |
|
11-Apr-2015 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
shared: add terminal-util.[ch] |
3df3e884ae1237ef0d4d23b0e80f4ffda95ac135 |
|
11-Apr-2015 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
shared: add random-util.[ch] |
0b452006de98294d1690f045f6ea2f7f6630ec3b |
|
10-Apr-2015 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
shared: add process-util.[ch] |
6482f6269c87d2249e52e889a63adbdd50f2d691 |
|
10-Apr-2015 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
shared: add formats-util.h |
da00518b3f3a8b08d521c4b72068eafa2db566cc |
|
07-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
path-util: fix more path_is_mount e792e890f fallout |
f70a17f8d47ec8a62fa3b9b0bbe40fa107088540 |
|
06-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
btrfs: add support for recursive btrfs snapshotting |
e9bc1871b974fa9e33d9c1a45e249e6d1c8bc562 |
|
06-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
btrfs: make btrfs_subvol_snapshot() parameters a flags field |
d9e2daaf3d8649650cf9784b4fe9d9de4507da0c |
|
06-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
btrfs: support recursively removing btrfs snapshots |
c6878637502b1717a110a9a7e8bba32a8583fcdf |
|
06-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rework rm_rf() logic
- Move to its own file rm-rf.c
- Change parameters into a single flags parameter
- Remove "honour sticky" logic, it's unused these days |
81f5049b7c35752182e855cdb06d707db92d7ac8 |
|
31-Mar-2015 |
Alban Crequy <alban@endocode.com> |
nspawn: fallback on bind mount when mknod fails
Some systems abusively restrict mknod, even when the device node already
exists in /dev. This is unfortunate because it prevents systemd-nspawn
from creating the basic devices in /dev in the container.
This patch implements a workaround: when mknod fails, fallback on bind
mounts.
Additionally, /dev/console was created with a mknod with the same
major/minor as /dev/null before bind mounting a pts on it. This patch
removes the mknod and creates an empty regular file instead.
In order to test this patch, I used the following configuration, which I
think should replicate the system with the abusive restriction on mknod:
# grep devices /proc/self/cgroup
4:devices:/user.slice/restrict
# cat /sys/fs/cgroup/devices/user.slice/restrict/devices.list
c 1:9 r
c 5:2 rw
c 136:* rw
# systemd-nspawn --register=false -D .
v2:
- remove "bind", it is not needed since there is already MS_BIND
v3:
- fix error management when calling touch()
- fix lowercase in error message |
4f923a1984476de3441922ee5bf7102ebdd250ef |
|
31-Mar-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: drop sd_booted() check
We have no such check in any of the other tools, hence don't have one in
nspawn either.
(This should make things nicer for Rocket, among other things)
Note: removing this check does not mean that we support running nspawn
on non-systemd. We explicitly don't. It just means that we remove the
check for running it like that. You are still on your own if you do... |
4543768d13946e9193b367330cb32ded4d96058a |
|
31-Mar-2015 |
Iago López Galeiras <iago@endocode.com> |
nspawn: change filesystem type from "bind" to NULL in mount() syscalls
Try to keep syscalls as minimal as possible. |
48861960acbdf93000087bbf546b6589778fb460 |
|
14-Mar-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: tell coverity that we ignore return value
CID #1271353. |
15411c0cb1192799b37ec8f25d6f30e8d7292fc6 |
|
13-Mar-2015 |
David Herrmann <dh.herrmann@gmail.com> |
tree-wide: there is no ENOTSUP on linux
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses. |
8a16a7b4e7f6702a7e6edaead80ecf04be7d3ba2 |
|
07-Mar-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: fix use-after-free and leak in error paths
CID #1257765. |
9a71b1122c6e49dd9227f82b2f53837c7ea13019 |
|
05-Mar-2015 |
Jay Faulkner <jay@jvf.cc> |
nspawn: Map all seccomp filters to capabilities
This change makes it so all seccomp filters are mapped
to the appropriate capability and are only added if that
capability was not requested when running the container.
This unbreaks the remaining use cases broken by the
addition of seccomp filters without respecting requested
capabilities.
Co-Authored-By: Clif Houck <me@clifhouck.com>
[zj: - adapt to our coding style, make struct anonymous] |
c6c8f6e218995852350e5e35c080dec788c42c3f |
|
25-Feb-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: make kill signal to use for PID 1 configurable |
2eec67acbb00593e414549a7e5b35eb7dd776b1b |
|
23-Feb-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use. |
4aab5d0cbd979b2cccb88534f118bceaa86466d8 |
|
23-Feb-2015 |
Jan Synacek <jsynacek@redhat.com> |
nspawn: fix whitespace and typo in partition table blurb |
6278cf604834ab3535934209a704f222e472bf17 |
|
19-Feb-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: chown basic device nodes to userns root |
d15d65a01fe02fc66c3a9664fa9eab983f0f5024 |
|
19-Feb-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: fix build on non-selinux systems |
6dac160c0a5ba7a0f39db183e877ed8e85057234 |
|
19-Feb-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add basic user namespacing support
(This is incomplete, /proc and /sys are still owned by root from outside
the container, not inside) |
9c857b9d160c10b4454fc9f83442c1878343422f |
|
18-Feb-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: when connected to pipes for stdin/stdout, pass them as-is to PID 1
Previously we always invoked the container PID 1 on /dev/console of the
container. With this change we do so only if nspawn was invoked
interactively (i.e. its stdin/stdout was connected to a TTY). In all other
cases we directly pass through the fds unmodified.
This has the benefit that nspawn can be added into shell pipelines.
https://bugs.freedesktop.org/show_bug.cgi?id=87732 |
f36933fef605a7dccce8e3aecccff5152e522fa6 |
|
18-Feb-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add support for --property= to set scope properties
This is similar to systemd-run's --property= setting. |
d0a0ccf3fecdb422d3fb7ab89646fe9042f11acd |
|
04-Feb-2015 |
Jay Faulkner <jay@jvf.cc> |
nspawn: Allow module loading if CAP_SYS_MODULE is requested
nspawn containers currently block module loading in all cases, with
no option to disable it. This allows an admin, specifically setting
capability=CAP_SYS_MODULE or capability=all to load modules. |
63c372cb9df3bee01e3bf8cd7f96f336bddda846 |
|
03-Feb-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rework strappenda(), and rename it strjoina()
After all it is now much more like strjoin() than strappend(). At the
same time, add support for NULL sentinels, even if they are normally not
necessary. |
fed6df828d86c053a96d5b50af75c53eb8dd4666 |
|
02-Feb-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
remove unused variables |
c0534580aca48c65a5f240b093f8d0cc33eb98b9 |
|
23-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: when mounting the cgroup hierarchies, use the exact same mount options for the superblock as the host
Otherwise we'll generate kernel runtime warnings about non-matching
mount options. |
bbb99c30d01a8bcdc27fb151cc6376a7877a6b07 |
|
23-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: mount /tmp in the container, don't leave this to the container's init
We really want /tmp to be properly mounted, especially in containers
that lack CAP_SYS_ADMIN or that are not fully booted up and only get a
shell, hence let's do so in nspawn already. |
05e7da5afa07b5620c06507a3f033334a5179d21 |
|
23-Jan-2015 |
Alban Crequy <alban@endocode.com> |
nspawn: allow bind-mounting char and block files |
c09ef2e4e8331ddc7ee063d295c322a0939ea851 |
|
20-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: work around kernel bug with partition table probing on loopback devices
When we set up a loopback device with partition probing, the udev
"change" event about the configured device is first passed on to
userspace, only the the in-kernel partition prober is started. Since
partition probing fails with EBUSY when somebody has the device open,
the probing frequently fails since udev starts probing/opening the
device as soon as it gets the notification about it, and it might do so
earlier than the kernel probing.
This patch adds a (hopefully temporary) work-around for this, that
compares the number of probed partitions of the kernel with those of
blkid and synchronously asks for reprobing until the numebrs are in
sync.
This really deserves a proper kernel fix. |
4bbfe7ad22b0666e82719e39e40be1c6cbb5cc91 |
|
20-Jan-2015 |
Tom Gundersen <teg@jklm.no> |
nspawn: add ipvlan support |
f6c51a8136de3f27e28caea2003e18f4bc4cb9a8 |
|
19-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: support dissecting GPT images that contain only a single generic linux partition
This should allow running Ubuntu UEFI GPT Images with nspawn,
unmodified. |
2fbe4296c5ba5bcce3ac845f196c60a88e3181fe |
|
19-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
inspawn: wait until udev has probed a loopback device before making us of it |
835214146b60edfcec00075558ccc4238cc1ffe4 |
|
15-Jan-2015 |
Jonathan Boulle <jonathanboulle@gmail.com> |
nspawn: fix log typos |
aceac2f0b652dff701e5815c51c2e372e8fee84d |
|
15-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
import: rename "gpt" disk image type to "raw"
After all, nspawn can now dissect MBR partition levels, too, hence
".gpt" appears a misnomer. Moreover, the the .raw suffix for these files
is already pretty popular (the Fedora disk images use it for example),
hence sounds like an OK scheme to adopt. |
5e4074aa3188ff439c0509908284469807d2749e |
|
15-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
spawn: downgrade loopback detach errors to debug
Sometimes udev or some other background daemon might keep the loopback
devices busy while we already want to detach them. Downgrade the warning
about it.
Given that we use autodetach downgrading these messages should be with
little risk. |
ada4799ac5ad2e6c0fe11dc5c096faca8a85876b |
|
15-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add support for limited dissecting of MBR disk images with nspawn
With this change nspawn's -i switch now can now make sense of MBR disk
images too - however only if there's only a single, bootable partition
of type 0x83 on the image. For all other cases we cannot really make
sense from the partition table alone.
The big benefit of this change is that upstream Fedora Cloud Images can
now be booted unmodified with systemd-nspawn:
# wget http://download.fedoraproject.org/pub/fedora/linux/releases/21/Cloud/Images/x86_64/Fedora-Cloud-Base-20141203-21.x86_64.raw.xz
# unxz Fedora-Cloud-Base-20141203-21.x86_64.raw.xz
# systemd-nspawn -i Fedora-Cloud-Base-20141203-21.x86_64.raw -b
Next stop: teach the import logic to automatically download these
images, uncompress and verify them. |
733d15ac7a23c80f2e447f6c2fca0406bc9960db |
|
14-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: pass the container's init PID out via sd_notify()
This is useful for nspawn managers that want to learn when nspawn is
finished with initialiuzation, as well what the PID of the init system
in the container is. |
657bdca9e4c0f0163b8c1f139e3f6734d2e0d69a |
|
14-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: fix an incorrect assert comparison |
30535c16924a3da7b47ea87190d929d617d95c5a |
|
14-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add file system locks for controlling access to container images
This adds three kinds of file system locks for container images:
a) a file system lock next to the actual image, in a .lck file in the
same directory the image is located. This lock has the benefit of
usually being located on the same NFS share as the image itself, and
thus allows locking container images across NFS shares.
b) a file system lock in /run, named after st_dev and st_ino of the
root of the image. This lock has the advantage that it is unique even
if the same image is bind mounted to two different places at the same
time, as the ino/dev stays constant for them.
c) a file system lock that is only taken when a new disk image is about
to be created, that ensures that checking whether the name is already
used across the search path, and actually placing the image is not
interrupted by other code taking the name.
a + b are read-write locks. When a container is booted in read-only mode
a read lock is taken, otherwise a write lock.
Lock b is always taken after a, to avoid ABBA problems.
Lock c is mostly relevant when renaming or cloning images. |
8937422f3b8c4a163ffa4df697ef2939161f4f53 |
|
14-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: remove the right propagation directory |
ab5e3a1bccaf79d65c93fc15ddeaa7595ffe0b86 |
|
13-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: --help typo fix |
0dfaa0060711a8332c8eb9f1e10f48fe182d3650 |
|
13-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
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. |
6d0b55c272ea31d025e8b3c311cea8cda0bfefd7 |
|
13-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
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. |
f2068bcce01db31cdc9422f44185f3b49c04d2ce |
|
08-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
machined: when cloning a raw disk image, also set the NOCOW flag |
080e78329a742dd95bdee321fee81c305e073491 |
|
08-Jan-2015 |
Tom Gundersen <teg@jklm.no> |
nspawn: fix error message when mknod fails |
0ec5543c4c0318552a4dcdd83210793347b93081 |
|
07-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
machinectl: make sure that "machinectl login" exits immediately when the machine it is connected to dies |
b12afc8c5c5c3ee5720780df9a602288bbcc24ea |
|
05-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
nspawn: mount most of the cgroup tree read-only in nspawn containers except for the container's own subtree in the name=systemd hierarchy
More specifically mount all other hierarchies in their entirety and the
name=systemd above the container's subtree read-only. |
814a3fdfdc8cd94797eff5f3e1d9a3cc032d880a |
|
29-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: report back to systemd only very late whether we are OK
That way, systemd can actually figure out if everything is OK with
nspawn. |
1b9cebf6385b5ea0e5ea099da163687013ac7790 |
|
28-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: use the same image discovery logic in nspawn as in machined |
f01ae8260d90ccff2f299242cd370ab58ea723f0 |
|
25-Dec-2014 |
Filipe Brandenburger <filbranden@google.com> |
nspawn: remove spurious include of <sys/capability.h>
It does not use any functions from libcap directly. The CAP_* constants in use
through this file come from "missing.h" which will import <linux/capability.h>
and complement it with CAP_* constants not defined by the current kernel
headers.
Add an explicit import of our "capability.h" since it does use the function
capability_bounding_set_drop from that header file. Previously, that header was
implicitly imported through through "cap-list.h".
Tested that "systemd-nspawn" builds cleanly and works after this change. |
611b312b7d0799281347374dc303c73a066cedf8 |
|
23-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn,pty: port over to new ptsname_malloc() helper |
c7b7d4493aa03e9ef5fb1e670b8969a48aa494dd |
|
23-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
machinectl,nspawn: don't print extra final newline if pty terminal output was newline-terinated anyway |
9b15b7846d4de01bb5d9700a24077787e984e8ab |
|
23-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
run: add a new "-t" mode for invoking a binary on an allocated TTY |
785890acf6d629ff881a1f065f431df1b7fc8c7a |
|
18-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
machinectl: implement "bind" command to create additional bind mounts from host to container during runtime |
60e1651a31c9c0ed1caef1a63f5e3a87156b0b1e |
|
17-Dec-2014 |
Ken Werner <ken@linux.vnet.ibm.com> |
nspawn: fix invocation of the raw clone() system call on s390 and cris
Since the order of the first and second arguments of the raw clone() system
call is reversed on s390 and cris it needs to be invoked differently. |
b9ba4dabbab8a58a044ec42655e11e65bd3ecc47 |
|
12-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
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. |
c4e34a612c81266773cf8358cb38a43d2e43474e |
|
12-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: allow spawning ephemeral nspawn containers based on the root file system of the OS
This works now:
# systemd-nspawn -xb -D / -M foobar
Which boots up an ephemeral container, based on the host's root file
system. Or in other words: you can now run the very same host OS you
booted your system with also in a container, on top of it, without
having it interfere. Great for testing whether the init system you are
hacking on still boots without reboot the system! |
df9a75e480ecbfe230589a7c1e8e0bb790ee0595 |
|
12-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: don't link journals in ephemeral mode |
53e438e3016e6b8304834d784fd0bbfeeb17cb77 |
|
12-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: properly unset arg_link_journal_try, when --link-journal= is specified |
ec16945ebfe64d5cd5403ae1a1b16bc05a779a16 |
|
12-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
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. |
0c3c42847da2f614f1a3f93c7cc96cd241e17e3a |
|
12-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: properly validate machine names |
2822da4fb7f891e5320f02f1d00f64b72221ced4 |
|
10-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
util: introduce our own gperf based capability list
This way, we can ensure we have a more complete, up-to-date list of
capabilities around, always. |
a90e23051b5b29deca4726a397574a34621038aa |
|
10-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: create the macvlan MAC addresses in an arch independent stable way |
e867ceb6b9c4de177d530ec5077cbd9d17d3531c |
|
09-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: make sure macvlan MAC addresses are stable
https://bugs.freedesktop.org/show_bug.cgi?id=85527 |
04a919394069cf024559f78eb46692a3739641eb |
|
03-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: correct EEXIST check when creating directory to mount /tmp in
https://bugs.freedesktop.org/show_bug.cgi?id=86309 |
01dc33ce287c68bf6bbc22f5b1d5eb29e204b6a7 |
|
29-Nov-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: fix unused variable warning |
820d3acfe924e58965d14b4711d5df31c5db199a |
|
29-Nov-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
delta: diff returns 1 when files differ, ignore this
https://bugs.debian/org/771397 |
4a62c710b62a5a3c7a8a278b810b9d5b5a0c8f4f |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: another round of simplifications
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno
+ return simplifications". |
56f64d95763a799ba4475daf44d8e9f72a1bd474 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.
Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'
Plus some whitespace, linewrap, and indent adjustments. |
f647962d64e844689f3e2acfce6102fc47e76df2 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: yet more log_*_errno + return simplifications
Using:
find . -name '*.[ch]' | while read f; do perl -i.mmm -e \
'local $/;
local $_=<>;
s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg;
print;'
$f
done
And a couple of manual whitespace fixups. |
da927ba997d68401563b927f92e6e40e021a8e5c |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values. |
0a1beeb64207eaa88ab9236787b1cbc2f704ae14 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'
Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno(). |
6c2d07020f752547a8a45b6f03546a61a5e1672d |
|
23-Nov-2014 |
Richard Schütz <rschuetz@uni-koblenz.de> |
nspawn: ignore EEXIST when mounting tmpfs
commit 79d80fc1466512d0ca211f4bfcd9de5f2f816a5a introduced a regression that
prevents mounting a tmpfs if the mount point already exits in the container's
root file system. This commit fixes the problem by ignoring EEXIST. |
574edc90066c3faeadcf4666928ed9b0ac409c75 |
|
21-Nov-2014 |
Martin Pitt <martin.pitt@ubuntu.com> |
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 |
63cc4c3138fd0ce9cc97884373a2dd8959a13ee9 |
|
13-Nov-2014 |
Daniel Mack <daniel@zonque.org> |
sd-bus: sync with kdbus upstream (ABI break)
kdbus has seen a larger update than expected lately, most notably with
kdbusfs, a file system to expose the kdbus control files:
* Each time a file system of this type is mounted, a new kdbus
domain is created.
* The layout inside each mount point is the same as before, except
that domains are not hierarchically nested anymore.
* Domains are therefore also unnamed now.
* Unmounting a kdbusfs will automatically also detroy the
associated domain.
* Hence, the action of creating a kdbus domain is now as
privileged as mounting a filesystem.
* This way, we can get around creating dev nodes for everything,
which is last but not least something that is not limited by
20-bit minor numbers.
The kdbus specific bits in nspawn have all been dropped now, as nspawn
can rely on the container OS to set up its own kdbus domain, simply by
mounting a new instance.
A new set of mounts has been added to mount things *after* the kernel
modules have been loaded. For now, only kdbus is in this set, which is
invoked with mount_setup_late(). |
dfb05a1cf5479e6949d2413a633431c64d006ff2 |
|
04-Nov-2014 |
David Herrmann <dh.herrmann@gmail.com> |
barrier: explicitly ignore return values of barrier_place()
The barrier implementation tracks remote states internally. There is no
need to check the return value of any barrier_*() function if the caller
is not interested in the result. The barrier helpers only return the state
of the remote side, which is usually not interesting as later calls to
barrier_sync() will catch this, anyway.
Shut up coverity by explicitly ignoring return values of barrier_place()
if we're not interested in it. |
023fb90b83871a15ef7f57e8cd126e3426f99b9e |
|
31-Oct-2014 |
Lennart Poettering <lennart@poettering.net> |
ptyforward: rework PTY forwarder logic used by nspawn to utilize the normal event loop
We really should not run manual event loops anymore, but standardize on
sd_event, so that we can run sd_bus connections from it eventually. |
919699ec301ea507edce4a619141ed22e789ac0d |
|
31-Oct-2014 |
Lennart Poettering <lennart@poettering.net> |
units: don't order journal flushing afte remote-fs.target
Instead, only depend on the actual file systems we need.
This should solve dep loops on setups where remote-fs.target is moved
into late boot. |
fddbb89c46ea5d39e52e361b390ea34a06cbb67c |
|
31-Oct-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: don't make up -1 as error code |
1ab19cb167b32967556eefd8f6d3df0e3de7d67d |
|
29-Oct-2014 |
Dave Reisner <dreisner@archlinux.org> |
nspawn: ignore EEXIST when creating mount point
A combination of commits f3c80515c and 79d80fc14 cause nspawn to
silently fail with a commandline such as:
# systemd-nspawn -D /build/extra-x86_64 --bind=/usr
strace shows the culprit:
[pid 27868] writev(2, [{"Failed to create mount point /build/extra-x86_64/usr: File exists", 82}, {"\n", 1}], 2) = 83 |
605f81a8968b2df8a28cca2cf11db99ab948a2af |
|
27-Oct-2014 |
Michal Sekletar <msekleta@redhat.com> |
util: introduce sethostname_idempotent
Function queries system hostname and applies changes only when necessary. Also,
migrate all client of sethostname to sethostname_idempotent while at it. |
317cde8b80a611f6194aaba2dad418cc21eefe55 |
|
17-Oct-2014 |
Daniel Mack <daniel@zonque.org> |
nspawn: fix DeviceAllow list
Commit 864e17068 ("nspawn: actually allow access to /dev/net/tun in the
container") added "/dev/net/tun" to the list of allowed devices but forgot
to tweak the array length, which caused "/dev/kdbus/*" to be missed. |
864e17068ce9acf418d42a625141884293170952 |
|
10-Oct-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: actually allow access to /dev/net/tun in the container
It's not sufficient to just copy the device node over, we need to update
the policy for it too. |
85614d663e4a09beee1c78aaa67f02943d50d5a0 |
|
08-Oct-2014 |
Tom Gundersen <teg@jklm.no> |
nspawn: copy /dev/net/tun from host
This enables tuntap support in the container (assumning the necessary capabilities are in place). |
e8c8ddccfc63574069c30b7e75f0ccfd5b03eab9 |
|
29-Sep-2014 |
Tom Gundersen <teg@jklm.no> |
nspawn: log when tearing down of loop device fails |
79d80fc1466512d0ca211f4bfcd9de5f2f816a5a |
|
25-Sep-2014 |
Tom Gundersen <teg@jklm.no> |
nspawn: check some more return values
Most of these failures would anyway get caught later on, but now the error messages are a bit more
specific. |
c00524c9cc7fb498c7244350e25823b8352f078c |
|
19-Sep-2014 |
Tom Gundersen <teg@jklm.no> |
nspawn: don't try to create veth link with too long ifname
Reported by: James Lott <james@lottspot.com> |
3125b3ef5db70d45882c7d6f617705802c5f939e |
|
28-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
nspawn: fix --network-interface
Use SETLINK when modifying an existing link. |
1b6d7fa742e303611dff8d7ebfa86ee5fb8b7dc7 |
|
26-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
util: make use of newly added reset_signal_mask() call wherever appropriate |
af4ec4309e8f82aad87a8d574785c12f8763d5f8 |
|
21-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
notify: send STOPPING=1 from our daemons |
4f758c23981342f1fb838f4b2630812eb89a3faa |
|
04-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: make sure that when --network-veth is used both the host and the container side get fixed MAC addresses |
249968612f16a71df909d6e73785c18a9ff36a65 |
|
04-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: always explicitly close bus from main programs
Since b5eca3a2059f9399d1dc52cbcf9698674c4b1cf0 we don't attempt to GC
busses anymore when unsent messages remain that keep their reference,
when they otherwise are not referenced anymore. This means that if we
explicitly want connections to go away, we need to close them.
With this change we will no do so explicitly wherver we connect to the
bus from a main program (and thus know when the bus connection should go
away), or when we create a private bus connection, that really should go
away after our use.
This fixes connection leaks in the NSS and PAM modules. |
601185b43da638b1c74153deae01dbd518680889 |
|
04-Aug-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Unify parse_argv style
getopt is usually good at printing out a nice error message when
commandline options are invalid. It distinguishes between an unknown
option and a known option with a missing arg. It is better to let it
do its job and not use opterr=0 unless we actually want to suppress
messages. So remove opterr=0 in the few places where it wasn't really
useful.
When an error in options is encountered, we should not print a lengthy
help() and overwhelm the user, when we know precisely what is wrong
with the commandline. In addition, since help() prints to stdout, it
should not be used except when requested with -h or --help.
Also, simplify things here and there. |
4212a3375e03fd12cb407b34cab59dbe4ed9f4eb |
|
03-Aug-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: fix truncation of machine names in interface names
Based on patch by Michael Marineau <michael.marineau@coreos.com>:
When deriving the network interface name from machine name strncpy was
not properly null terminating the string and the maximum string size as
returned by strlen() is actually IFNAMSIZ-1, not IFNAMSIZ. |
a2a5291b3f5ab6ed4c92f51d0fd10a03047380d8 |
|
31-Jul-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Reject invalid quoted strings
String which ended in an unfinished quote were accepted, potentially
with bad memory accesses.
Reject anything which ends in a unfished quote, or contains
non-whitespace characters right after the closing quote.
_FOREACH_WORD now returns the invalid character in *state. But this return
value is not checked anywhere yet.
Also, make 'word' and 'state' variables const pointers, and rename 'w'
to 'word' in various places. Things are easier to read if the same name
is used consistently.
mbiebl_> am I correct that something like this doesn't work
mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"'
mbiebl_> systemd seems to strip of the quotes
mbiebl_> systemctl status shows
mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint
mbiebl_> which is pretty weird |
7566e26721ee95d6fc864e9e6654fb61bd3cd603 |
|
19-Jul-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
barrier: initalize file descriptors with -1
Explicitly initalize descriptors using explicit assignment like
bus_error. This makes barriers follow the same conventions as
everything else and makes things a bit simpler too.
Rename barier_init to barier_create so it is obvious that it is
not about initialization.
Remove some parens, etc. |
3496b9eeafa50234371da1642dca424e4ca0e5f4 |
|
17-Jul-2014 |
David Herrmann <dh.herrmann@gmail.com> |
nspawn: fix barrier-destroy call
I dropped the cleanup-helper before pushing so use _cleanup_() directly. |
a2da110b78abe4e4b1b6d8ae4ef78b087c4dcc8b |
|
17-Jul-2014 |
David Herrmann <dh.herrmann@gmail.com> |
nspawn: use Barrier API instead of eventfd-util
The Barrier-API simplifies cross-fork() synchronization a lot. Replace the
hard-coded eventfd-util implementation and drop it.
Compared to the old API, Barriers also handle exit() of the remote side as
abortion. This way, segfaults will not cause the parent to deadlock.
EINTR handling is currently ignored for any barrier-waits. This can easily
be added, but it isn't needed so far so I dropped it. EINTR handling in
general is ugly, anyway. You need to deal with pselect/ppoll/... variants
and make sure not to unblock signals at the wrong times. So genrally,
there's little use in adding it. |
5aa4bb6b5b0b9dcea524d56cf8664b892a5a976a |
|
10-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: register external network interface with machined |
4d9f07b492ba1707d4a92cd937b87b8baf827f7d |
|
04-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add new --volatile switch for booting containers in volatile (ephemeral) mode
Two modes are supported: --volatile=yes mounts only /usr into the
container, and a tmpfs as root directory. --volatile=state mounts the
full OS tree in, but overmounts /var with a tmpfs.
--volatile=yes hence boots with an unpopulated /etc and /var, starting
with pristine configuration and state.
--volatile=state hence boots with an unpopulated /var, only starting
with pristine state. |
ce38dbc84b40148026801dd29fd0ad1f1b25d3fb |
|
03-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: when running in a service unit, use systemd for restarts
THis way we can remove cgroup priviliges after setup, but get them back
for the next restart, as we need it. |
28650077f36466d9c5ee27ef2006fae3171a2430 |
|
30-Jun-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: block open_by_handle_at() and others via seccomp
Let's protect ourselves against the recently reported docker security
issue. Our man page makes clear that we do not make any security
promises anyway, but well, this one is easy to mitigate, so let's do it.
While we are at it block a couple of more syscalls that are no good in
containers, too. |
840295fc1e30bb8902e8df08127bbc281318b537 |
|
30-Jun-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: let's avoid using goto to wildly for non-cleanup purposes |
ce9f1527b685402974e15c30b2caf3c1fe3ceb81 |
|
30-Jun-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: simplify exit condition check |
8baaf7a3d8c42970c5215f4dcf84393b84b07e78 |
|
30-Jun-2014 |
Luke Shumaker <LukeShu@sbcglobal.net> |
nspawn: log a warning on failure from wait_for_terminate()
This is at the suggestion of Djalal Harouni on the mailing list, and
reflects the behavior of shared/util.c:wait_for_terminate_and_warn(). |
6d416b9cc8ce39e5f97737b749d4bb1fb4f86df0 |
|
30-Jun-2014 |
Luke Shumaker <LukeShu@sbcglobal.net> |
nspawn: Fix regression with exit status
Commit 113cea8 introduced a bug that caused the exit code of systemd-nspawn
to not reflect the exit code of the program executed in the container. |
971ff8c78b3a7d94ed2289077f856c6988d18183 |
|
24-Jun-2014 |
Kay Sievers <kay@vrfy.org> |
switch-root: create essential base directories at system bootup
This allows us to bootup a rootfs with a /usr directory only. |
3577de7ac39c54821e1d1d946db65e109dfb94b2 |
|
24-Jun-2014 |
Kay Sievers <kay@vrfy.org> |
nspawn: create essential base directories at system bootup
This allows us to bootup a rootfs with a /usr directory only. |
c8b32e11ee24a333f8f7c7c15226741d22e55fdd |
|
22-Jun-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
consistently order cleanup attribute before type |
5ae4d543cb9b45ad6c6b82b78da1d6abc2291cdb |
|
13-Jun-2014 |
Lennart Poettering <lennart@poettering.net> |
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. |
06c17c39a8345deef1ecff4dd5ef262f968c9be2 |
|
11-Jun-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add new --tmpfs= option to mount a tmpfs on specific directories, such as /var |
849958d1ba3533c953fad46d4d41c0ec6e48316d |
|
10-Jun-2014 |
Lennart Poettering <lennart@poettering.net> |
tmpfiles: add new "C" line for copying files or directories |
45f1386c9adf0e2892306e8949ca71f4a52a8d36 |
|
07-Jun-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: split long message into two lines
For names like /var/lib/container/something, the message
becomes quite long. Better to split it.
Also reword the message not to suggest that ^]^]^] only works
in the beginning. |
d6797c920e9eb70f46a893c00fdd9ecb86d15f84 |
|
06-Jun-2014 |
Lennart Poettering <lennart@poettering.net> |
namespace: beef up read-only bind mount logic
Instead of blindly creating another bind mount for read-only mounts,
check if there's already one we can use, and if so, use it. Also,
recursively mark all submounts read-only too. Also, ignore autofs mounts
when remounting read-only unless they are already triggered. |
e866af3acc30fcd1183a028ea3ef552b7237cc55 |
|
25-May-2014 |
Djalal Harouni <tixxdz@opendz.org> |
nspawn: make nspawn robust to container failure
nspawn and the container child use eventfd to wait and notify each other
that they are ready so the container setup can be completed.
However in its current form the wait/notify event ignore errors that
may especially affect the child (container).
On errors the child will jump to the "child_fail" label and terminate
with _exit(EXIT_FAILURE) without notifying the parent. Since the eventfd
is created without the "EFD_NONBLOCK" flag, this leaves the parent
blocking on the eventfd_read() call. The container can also be killed
at any moment before execv() and the parent will not receive
notifications.
We can fix this by using cheap mechanisms, the new high level eventfd
API and handle SIGCHLD signals:
* Keep the cheap eventfd and EFD_NONBLOCK flag.
* Introduce eventfd states for parent and child to sync.
Child notifies parent with EVENTFD_CHILD_SUCCEEDED on success or
EVENTFD_CHILD_FAILED on failure and before _exit(). This prevents the
parent from waiting on an event that will never come.
* If the child is killed before execv() or before notifying the parent,
we install a NOP handler for SIGCHLD which will interrupt blocking calls
with EINTR. This gives a chance to the parent to call wait() and
terminate in main().
* If there are no errors, parent will block SIGCHLD, restore default
handler and notify child which will do execv(), then parent will pass
control to process_pty() to do its magic.
This was exposed in part by:
https://bugs.freedesktop.org/show_bug.cgi?id=76193
Reported-by: Tobias Hunger tobias.hunger@gmail.com |
113cea802db444beab4783538d39966f707be788 |
|
25-May-2014 |
Djalal Harouni <tixxdz@opendz.org> |
nspawn: move container wait logic into wait_for_container()
Move the container wait logic into its own wait_for_container() function
and add two status codes: CONTAINER_TERMINATED or CONTAINER_REBOOTED.
The status will be stored in its argument, this way we handle:
a) Return negative on failures.
b) Return zero on success and set the status to either
CONTAINER_REBOOTED or CONTAINER_TERMINATED.
These status codes are used to terminate nspawn or loop again in case of
CONTAINER_REBOOTED. |
590b6b9188e75ba46c42995984a1c2fa06adb6d6 |
|
25-May-2014 |
Cristian Rodríguez <crrodriguez@opensuse.org> |
Use %m instead of strerror(errno) where appropiate |
cdb2b9d05a2f3d649f47bd2ba24eb3fe30b52e92 |
|
22-May-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: restore journal directory is empty check
This undoes part of commit e6a4a517befe559adf6d1dbbadf425c3538849c9.
Instead of removing the error message about non-empty journal bind mount
directories, simply downgrade the message to a warning and proceed. |
e6a4a517befe559adf6d1dbbadf425c3538849c9 |
|
22-May-2014 |
Djalal Harouni <tixxdz@opendz.org> |
nspawn: allow to bind mount journal on top of a non empty container journal dentry
Currently if nspawn was called with --link-journal=host or
--link-journal=auto and the right /var/log/journal/machine-id/ exists
then the bind mount the subdirectory into the container might fail due
to the ~/mycontainer/var/log/journal/machine-id/ of the container not
being empty.
There is no reason to check if the container journal subdir is empty
since there will be a bind mount on top of it. The user asked for a bind
mount so give it.
Note: a next call with --link-journal=guest may fail due to the
/var/log/journal/machine-id/ on the host not being empty.
https://bugs.freedesktop.org/show_bug.cgi?id=76193
Reported-by: Tobias Hunger <tobias.hunger@gmail.com> |
f1721625e7145977ba705e169580f2eb0002600c |
|
18-May-2014 |
Nis Martensen <nis.martensen@web.de> |
fix spelling of privilege |
9f24adc288de142d6606fde3c5a5971613f3b6b9 |
|
16-May-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: properly format container_uuid in UUID format
http://lists.freedesktop.org/archives/systemd-devel/2014-April/018971.html |
70f539ca147694c2a61131b7068526d88decd931 |
|
10-Apr-2014 |
Philip Lorenz <philip@bithub.de> |
nspawn: Fix erroneous OOM when building group list
change_uid_gid() never initialises sz which may cause greedy_realloc to
skip the initial buffer allocation. |
d8e538ecd9e62f841242f07e3df5c835c1ba6313 |
|
28-Mar-2014 |
Tom Gundersen <teg@jklm.no> |
sd-rtnl: rework rtnl type system
Use a static table with all the typing information, rather than repeated
switch statements. This should make it a lot simpler to add new types.
We need to keep all the type info to be able to create containers
without exposing their implementation details to the users of the library.
As a freebee we verify the types of appended/read attributes.
The API is extended to nicely deal with unions of container types. |
3d94f76c99da13e5603831d0b278f8c8c21bcb02 |
|
24-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
util: replace close_pipe() with new safe_close_pair()
safe_close_pair() is more like safe_close(), except that it handles
pairs of fds, and doesn't make and misleading allusion, as it works
similarly well for socketpairs() as for pipe()s... |
03e334a1c7dc8c20c38902aa039440763acc9b17 |
|
18-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
util: replace close_nointr_nofail() by a more useful safe_close()
safe_close() automatically becomes a NOP when a negative fd is passed,
and returns -1 unconditionally. This makes it easy to write lines like
this:
fd = safe_close(fd);
Which will close an fd if it is open, and reset the fd variable
correctly.
By making use of this new scheme we can drop a > 200 lines of code that
was required to test for non-negative fds or to reset the closed fd
variable afterwards. |
039dd4afd64a8c8413ff28d43f533c30c5a06a16 |
|
16-Mar-2014 |
Tom Gundersen <teg@jklm.no> |
nspawn: UP the host side of the veth pair after adding it to a bridge |
7947952edea208f004d48e978a9fc35e6ed4ab8c |
|
14-Mar-2014 |
Dave Reisner <dreisner@archlinux.org> |
nspawn: remove unused variable |
f418f31d5042398344740f2d8ac4dc1c2583151c |
|
14-Mar-2014 |
Brandon Philips <brandon.philips@coreos.com> |
nspawn: allow -EEXIST on mkdir_safe /home/${uid}
With systemd 211 nspawn attempts to create the home directory for the
given uid. However, if the home directory already exists then it will
fail. Don't error out on -EEXIST. |
01dde0611bbf08f7e27aa8442f36eea2d0cca9de |
|
13-Mar-2014 |
Tom Gundersen <teg@jklm.no> |
nspawn: make host0's MAC address persistent
We still need to make sure that no two MAC addresses are the same, so we use
a logic similar to what is used in udev to generate MAC addresses, and base
it on a hash of the host's machine ID and thecontainer's name. |
727fd4fda56aded228967955d9805bc12cbcf794 |
|
13-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: honour GPT partition flags when mounting file systems following the discoverable partitions spec |
4de82926892eb1636d0a25cf1e4ab15cab6a6099 |
|
11-Mar-2014 |
Mantas Mikulėnas <grawity@gmail.com> |
nspawn: fix argv[0] for getent |
a07f961e98456714e7516c75041d5150d8641776 |
|
11-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: allow using kdbus from nspawn containers |
8c4e25b73c680ce4072247592bd44e1c809e2dd2 |
|
11-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: fix getent fallback |
0cb9fbcd44517ec90b2a678876194607beab5dec |
|
11-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: when resoliving UIDs/GIDs for "-u", do so in forked off /usr/bin/getent instead of in-process
When the container runs a different native architecture than the host we
shouldn't attempt to load the container's NSS modules with the host's
libc. Instead, resolve UID/GID by invoking /usr/bin/getent in the
container. The tool should be fairly universally available and allows us
to do resolving of the UID/GID with the container's libc in a parsable
format.
https://bugs.freedesktop.org/show_bug.cgi?id=75733 |
d96c1ecf7bf9dae6b0cb728e41d09999ecce0b4a |
|
11-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: make sure we don't try to mount the container block device in the child after the parent added us to the device cgroup |
eb0f0863f5af48865fb4569e2076d5f9e2313995 |
|
10-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: don't try mknod() of /dev/console with the correct major/minor
We overmount /dev/console with an external pty anyway, hence there's no
point in using the real major/minor when we create the node to
overmount. Instead, use the one of /dev/null now.
This fixes a race against the cgroup device controller setup we are
using. In case /dev/console was create before the cgroup policy was
applied all was good, but if created in the opposite order the mknod()
would fail, since creating /dev/console is not allowed by it. Creating
/dev/null instances is however permitted, and hence use it. |
1b9e5b126359a2a2ec37de1f94f046093abc74b8 |
|
10-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add --image= switch to boot GPT disk images that follow the Discoverable Partitions Specification |
13e8ceb84e56907d73b6b07418deb37faaf0e66d |
|
28-Feb-2014 |
Tero Roponen <tero.roponen@gmail.com> |
nspawn: fix detection of missing /proc/self/loginuid
Running 'systemd-nspawn -D /srv/Fedora/' gave me this error:
Failed to read /proc/self/loginuid: No such file or directory
Container Fedora failed with error code 1.
This patch fixes the problem. |
9875fd7875d433eea5c6e3319916e1be18722086 |
|
26-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: no need for duplicate checks against EEXIST |
c74e630d0ce4b1ace116e8211f3b6eb472efa7e3 |
|
25-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add new switch --network-macvlan= to add a macvlan device to the container |
9457ac5b4e755e9019ead2f564124df5d35ee7cf |
|
24-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: make use of the devices cgroup controller by default |
08af0da26935e827b58809ff1946e2f7d496e666 |
|
21-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: when adding a veth interface to a bridge, use the "vb-" rather than "ve-" interface name prefix
This way we can recognize the interfaces later on to apply different
host-side configuration to them. |
151b9b9662a90455262ce575a8a8ae74bf4ff336 |
|
20-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
api: in constructor function calls, always put the returned object pointer first (or second)
Previously the returned object of constructor functions where sometimes
returned as last, sometimes as first and sometimes as second parameter.
Let's clean this up a bit. Here are the new rules:
1. The object the new object is derived from is put first, if there is any
2. The object we are creating will be returned in the next arguments
3. This is followed by any additional arguments
Rationale:
For functions that operate on an object we always put that object first.
Constructors should probably not be too different in this regard. Also,
if the additional parameters might want to use varargs which suggests to
put them last.
Note that this new scheme only applies to constructor functions, not to
all other functions. We do give a lot of freedom for those.
Note that this commit only changes the order of the new functions we
added, for old ones we accept the wrong order and leave it like that. |
39883f622f392d8579f4428fc5a789a102efbb10 |
|
19-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
make gcc shut up
If -flto is used then gcc will generate a lot more warnings than before,
among them a number of use-without-initialization warnings. Most of them
without are false positives, but let's make them go away, because it
doesn't really matter. |
ac45f971a12280de55b834a65237f72dcacfc099 |
|
19-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
core: add Personality= option for units to set the personality for spawned processes |
6afc95b73605833e6e966af1c466b5c08feb953f |
|
18-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add new --personality= switch to make it easier to run 32bit containers on a 64bit host |
3302da4667640ac130956d8d90be7c39fb39222f |
|
18-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: x86 is special with its socketcall() semantics, be permissive in the seccomp setup |
e9642be2cce7f5e90406980092a6f71f504a16af |
|
18-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
seccomp: add helper call to add all secondary archs to a seccomp filter
And make use of it where appropriate for executing services and for
nspawn. |
f3d5485b805de60ee71810eeb58e82d44ce24fe1 |
|
18-Feb-2014 |
Dave Reisner <dreisner@archlinux.org> |
nspawn: allow 32-bit chroots from 64-bit hosts
Arch Linux uses nspawn as a container for building packages and needs
to be able to start a 32bit chroot from a 64bit host. 24fb11120756
disrupted this feature when seccomp handling was added. |
4fb7242cbbed0d865eb343548b8f0ee0fee71d85 |
|
18-Feb-2014 |
Tom Gundersen <teg@jklm.no> |
sd-rtnl-message: store reference to the bus in the message
This mimics the sd-bus api, as we may need it in the future. |
37c47eb7098cd39733de83c98d06fb67870bb825 |
|
17-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: netns_fd can be removed now |
32457153f4026ff2bcc73d82d5ad7a09a0169791 |
|
16-Feb-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
nspawn: typo fix in help |
ab046dde6f355f4a8b07ff6120a7ef51f5d49fc9 |
|
16-Feb-2014 |
Tom Gundersen <teg@jklm.no> |
nspawn: add new --network-bridge= switch
This adds the host side of the veth link to the given bridge.
Also refactor the creation of the veth interfaces a bit to set it up
from the host rather than the container. This simplifies the addition
to the bridge, but otherwise the behavior is unchanged. |
818dc5e72af8a3eb772997188e2bd8ea616de844 |
|
15-Feb-2014 |
Tom Gundersen <teg@jklm.no> |
sd-rtnl: always include linux/rtnetlink.h |
ee3a6a51e5b098aa0c9641ed71d275c459ad2f5a |
|
15-Feb-2014 |
Tom Gundersen <teg@jklm.no> |
sd-rtnl: message_open_container - don't take a 'size' argument
We can always know the size based on the type, so let's do this inside the library. |
262d10e6bd8e4a0a6a0967fbb5f89a5b989779ac |
|
14-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: if we don't find bash, try sh |
6b9132a9c40355356b4d4f5b20b6338c0eb74dfa |
|
14-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: don't accept just any tree to execute
When invoked without -D in an arbitrary directory we should not try to
execute anything, make some validity checks first. |
24fb111207566f3bb33c6438714fb5df44ed4305 |
|
13-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: make socket(AF_NETLINK, *, NETLINK_AUDIT) fail with EAFNOTSUPPORT in containers
The kernel still doesn't support audit in containers, so let's make use
of seccomp and simply turn it off entirely. We can get rid of this big
as soon as the kernel is fixed again. |
69c79d3c32ff4d6a572ee1cdec248b27df1fb6ca |
|
13-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add new --network-veth switch to add a virtual ethernet link to the host |
7e2270246b0906675c8f34bc278b1608b969e65c |
|
13-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: check with udev before we take possession of an interface |
b88eb17a7a9aad8287df275c46c1d09b1aee09fd |
|
13-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: no need to subscribe to netlink messages if we just want to execute one operation |
a42c8b54b1619078c02f5e439bd2564c6d0f901f |
|
13-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: --private-network should imply CAP_NET_ADMIN |
d595c5cc9e894c3608ed634052b0ba93aa94bf2f |
|
13-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
rtnl: rename constructors from the form sd_rtnl_xxx_yyy_new() to sd_rtnl_xxx_new_yyy()
So far we followed the rule to always indicate the "flavour" of
constructors after the "_new_" or "_open_" in the function name, so
let's keep things in sync here for rtnl and do the same. |
cf6a8911738fe2635a5210769d5348b05b166691 |
|
13-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
rtnl: drop "sd_" prefix from cleanup macros
The "sd_" prefix is supposed to be used on exported symbols only, and
not in the middle of names. Let's drop it from the cleanup macros hence,
to make things simpler.
The bus cleanup macros don't carry the "sd_" either, so this brings the
APIs a bit nearer. |
aa28aefe61c5406c5cb631f3e82457b6d1bcc967 |
|
13-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add new --network-interface= switch to move an existing interface into the container |
39ed67d14694983dabd6641c02216aa440eed767 |
|
13-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: introduce --capability=all for retaining all capabilities |
db999e0f923ca6c2c1b919d0f1c916472f209e62 |
|
12-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: newer kernels (>= 3.14) allow resetting the audit loginuid, make use of this |
89f7c8465cd1ab37347dd0c15920bce31e8225df |
|
11-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
machined: optionally, allow registration of pre-existing units (scopes
or services) as machine with machined |
eb91eb187b7491e05fb95215b77cb62061f41d08 |
|
11-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add --register=yes|no switch to optionally disable registration of the container with machined |
8a96d94e4c33173d1426b7e0a6325405804ba224 |
|
10-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add new --share-system switch to run a container without PID/UTS/IPC namespacing |
82adf6af7c72b852449346835f33184a841b4796 |
|
10-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn,man: use a common vocabulary when referring to selinux security contexts
Let's always call the security labels the same way:
SMACK: "Smack Label"
SELINUX: "SELinux Security Context"
And the low-level encapsulation is called "seclabel". Now let's hope we
stick to this vocabulary in future, too, and don't mix "label"s and
"security contexts" and so on wildly. |
fcf90586a2b26c445d6a35313990096c8562ecee |
|
10-Feb-2014 |
Vincent Batts <vbatts@redhat.com> |
nspawn: require /etc/os-release only for init
/etc/os-release is expected for the case for booting a full system, and
need not be required for thin container execution. |
ba978d7b325998709fb19d368d290fa1dff37699 |
|
07-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: rename --file-label to --apifs-label since it's really just about the API file systems, nothing else |
5d63309cf5a6fc5256391fa4ddb72cf68e2e27e5 |
|
06-Feb-2014 |
Tom Gundersen <teg@jklm.no> |
nspawn: fix HAVE_SELINUX ifdef |
284c0b917697fb0271381f331ffee28403278e72 |
|
06-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add --quiet switch for turning off any output noise |
1c03020cc48d41c94a51b5efbeeccb96e45d3e26 |
|
05-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: always use default bus |
d002827b03d78e31503a6b706ad4b4049ebf9a07 |
|
04-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: various fixes in selinux hookup
- As suggested, prefix argument variables with "arg_" how we do this
usually.
- As suggested, don't involve memory allocations when storing command
line arguments.
- Break --help text at 80 chars
- man: explain that this is about SELinux
- don't do unnecessary memory allocations when putting together mount
option string |
a8828ed93878b4b4866d40ebfb660e54995ff72e |
|
04-Feb-2014 |
Dan Walsh <dwalsh@redhat.com> |
Add SELinux support to systemd-nspawn
This patch adds to new options:
-Z PROCESS_LABEL
This specifies the process label to run on processes run within the container.
-L FILE_LABEL
The file label to assign to memory file systems created within the container.
For example if you wanted to wrap an container with SELinux sandbox labels, you could execute a command line the following
chcon system_u:object_r:svirt_sandbox_file_t:s0:c0,c1 -R /srv/container
systemd-nspawn -L system_u:object_r:svirt_sandbox_file_t:s0:c0,c1 -Z system_u:system_r:svirt_lxc_net_t:s0:c0,c1 -D /srv/container /bin/sh |
486e99a387adec15738c2822c2df5c813955f433 |
|
01-Feb-2014 |
Kay Sievers <kay@vrfy.org> |
bus: update kdbus.h (ABI break) |
40ddbdf85b592add401a0fbc963cec93559def54 |
|
29-Jan-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: fix reboot event fd reuse |
7f112f50fea585411ea2d493b3582bea77eb4d6e |
|
20-Jan-2014 |
Lennart Poettering <lennart@poettering.net> |
exec: introduce PrivateDevices= switch to provide services with a private /dev
Similar to PrivateNetwork=, PrivateTmp= introduce PrivateDevices= that
sets up a private /dev with only the API pseudo-devices like /dev/null,
/dev/zero, /dev/random, but not any physical devices in them. |
354bfd2b166d1044eea05ac9ba1cda05c93a24bc |
|
09-Jan-2014 |
Lennart Poettering <lennart@poettering.net> |
nspawn: do not invoke RegisterMachine on machined from inside the new PID namespace
On kdbus user credentials are not translated across PID namespaces, but
simply invalidated if sender and receiver namespaces don't match. This
makes it impossible to properly authenticate requests from different PID
namespaces (which is probably a good thing). Hence, register the machine
in the parent and not the client and properly synchronize this. |
e10a55fd72b5246cec1bbd09135d544db32e0414 |
|
21-Dec-2013 |
Shawn Landden <shawn@churchofgit.com> |
DEFAULT_PATH_SPLIT_USR macro |
f4889f656b477887b02caa5e9d27387309c75a87 |
|
13-Dec-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add new --setenv= switch to set an environment variable for the container to spawn |
4d680aeea1e479f08f3dbdb7430def5d9eefe2ee |
|
12-Dec-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: complain and continue if machine has same id
If --link-journal=host or --link-journal=guest is used, this totally
cannot work and we exit with an error. If however --link-journal=auto
or --link-journal=no is used, just display a warning.
Having the same machine id can happen if booting from the same
filesystem as the host. Since other things mostly function correctly,
let's allow that.
https://bugs.freedesktop.org/show_bug.cgi?id=68369 |
9e5548644f76e893c246d54ae613856b67b8dc1d |
|
12-Dec-2013 |
Lennart Poettering <lennart@poettering.net> |
bus: connect directly via kdbus in sd_bus_open_system_container()
kdbus fortunately exposes the container's busses in the host fs, hence
we can access it directly instead of doing the namespacing dance. |
2b6bf07dd23bb467099d213c97b3875c5e453491 |
|
07-Dec-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Get rid of our reimplementation of basename
The only problem is that libgen.h #defines basename to point to it's
own broken implementation instead of the GNU one. This can be fixed
by #undefining basename. |
2ed4e5e0b89cd1cf128803a62c0a27dd78e1c12e |
|
06-Dec-2013 |
Shawn Landden <shawn@churchofgit.com> |
nspawn: fix buggy mount_binds, now works for bind-mounted files |
9bd37b40fac198fee2ff4eabc8793f1a7f2770fe |
|
30-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: set up a kdbus namespace when starting a container |
898d5c913733d869820f85422a903da0f0685c6c |
|
26-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: improve error message when we cannot resolve the root directory argument |
420c7379fb96a188459690a634d0fede55721183 |
|
20-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add new --drop-capability= switch |
76b543756ef69ce69784d571aefe8de65eaeb331 |
|
12-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
bus: introduce concept of a default bus for each thread and make use of it everywhere
We want to emphasize bus connections as per-thread communication
primitives, hence introduce a concept of a per-thread default bus, and
make use of it everywhere. |
5b30bef856e89a571df57b7b953e9a1409d9aced |
|
07-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
bus: log message parsing errors everywhere with a generalized bus_log_parse_error() |
eb9da376d76b48585b3b63b4f91903b54f7abd36 |
|
06-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
clients: unify how we invoke getopt_long()
Among other things this makes sure we always expose a --version command
and show it in the help texts. |
1f0cd86b3dc0f938ce179cdddc62fc0f584e599d |
|
06-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: explicitly terminate machines when we exit nspawn
https://bugs.freedesktop.org/show_bug.cgi?id=68370
https://bugzilla.redhat.com/show_bug.cgi?id=988883 |
b3451bed41453304735b68726571d49fb676d466 |
|
05-Nov-2013 |
Djalal Harouni <tixxdz@opendz.org> |
nspawn: log out of memory errors |
04d39279245834494baccfdb9349db8bf80abd13 |
|
31-Oct-2013 |
Lennart Poettering <lennart@poettering.net> |
machinectl: add new command to spawn a getty inside a container |
4ba93280223ceb5de1bcedb196c38252f334521a |
|
31-Oct-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: split out pty forwaring logic into ptyfwd.c |
88212f7bd19e30d73874aa160e789e300a643860 |
|
30-Oct-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: only pass in slice setting if it is set |
40ca29a1370379d43e44c0ed425eecc7218dcbca |
|
16-Oct-2013 |
Lennart Poettering <lennart@poettering.net> |
timedated: use libsystemd-bus instead of libdbus for bus communication
Among other things this also adds a few things necessary for the change:
- Considerably more powerful error returning APIs in libsystemd-bus
- Adapter for connecting an sd_bus to an sd_event
- As I reworked the PolicyKit logic to the new library I also made it
asynchronous, so that PolicyKit requests of one user cannot block out
another user anymore.
- We always use the macro names for common bus error. That way it is
harder to mistype them since the compiler will notice |
51d122af23533b0b8318911c4fc8b128ad8eafb7 |
|
13-Oct-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Introduce _cleanup_fdset_free_ |
51045322c4c19638ba5588c722238220d096ca43 |
|
02-Oct-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: always copy /etc/resolv.conf rather than bind mount
We were already creating the file if it was missing, and this way
containers can reconfigure the file without running into problems.
This also makes resolv.conf handling more alike to handling of
/etc/localtime, which is also not a bind mount. |
cecf24e7f0f3385e7ced3e97d78cc9cc4012a650 |
|
19-Sep-2013 |
Dave Reisner <dreisner@archlinux.org> |
fix grammatical error |
d2421337f6e7d5a6730599e929232689acb09394 |
|
19-Sep-2013 |
Dave Reisner <dreisner@archlinux.org> |
nspawn: be less liberal about creating bind mount destinations
Previously, if a file's bind mount destination didn't exist, nspawn
would blindly create a directory, and the subsequent bind mount would
fail. Examine the filetype of the source and ensure that, if the
destination does not exist, that it is created appropriately.
Also go one step further and ensure that the filetypes of the source
and destination match. |
d182614649b48c00615d744e2b7f4a14180a980d |
|
23-Aug-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: trivial simplification |
aea38d8047a7a9370f8545007d242ede4a5cede1 |
|
19-Jul-2013 |
Jesper Larsen <jesper.larsen@ixonos.com> |
nspawn: Reorder includes to fix compilation
Commit 2e996f4d4b642c5682c608c9692ad2ffae398ab2 added an include
of linux/netlink.h
This kernel header is not self contained in the linux 2.6 kernel
which breaks compilation with an unknown type sa_family_t
A workaround is to include linux/netlink.h after sys/socket.h |
6a4e0b13473baed129522310c39f3bb70f46ed42 |
|
02-Jul-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: use the corect method signature for CreateMachine() |
1ee306e1248866617c96ed9f4263f375588ad838 |
|
02-Jul-2013 |
Lennart Poettering <lennart@poettering.net> |
machined: split out machine registration stuff from logind
Embedded folks don't need the machine registration stuff, hence it's
nice to make this optional. Also, I'd expect that machinectl will grow
additional commands quickly, for example to join existing containers and
suchlike, hence it's better keeping that separate from loginctl. |
bd5a54582ae4e7cdc390d05ea8f73dc7d02ed147 |
|
20-Jun-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: '-C' option has been removed
Fixup for 9444b1f "logind: add infrastructure to keep track of
machines, and move to slices." |
9444b1f20e311f073864d81e913bd4f32fe95cfd |
|
20-Jun-2013 |
Lennart Poettering <lennart@poettering.net> |
logind: add infrastructure to keep track of machines, and move to slices
- This changes all logind cgroup objects to use slice objects rather
than fixed croup locations.
- logind can now collect minimal information about running
VMs/containers. As fixed cgroup locations can no longer be used we
need an entity that keeps track of machine cgroups in whatever slice
they might be located. Since logind already keeps track of users,
sessions and seats this is a trivial addition.
- nspawn will now register with logind and pass various bits of metadata
along. A new option "--slice=" has been added to place the container
in a specific slice.
- loginctl gained commands to list, introspect and terminate machines.
- user.slice and machine.slice will now be pulled in by logind.service,
since only logind.service requires this slice. |
c2384970ff604e6341879bc965305b84533cdebf |
|
10-May-2013 |
Dave Reisner <dreisner@archlinux.org> |
nspawn: only warn about audit when booting the container
The audit subsystem isn't relevant when nspawn is only being used as a
chroot. |
2e996f4d4b642c5682c608c9692ad2ffae398ab2 |
|
10-May-2013 |
Colin Walters <walters@verbum.org> |
nspawn: Include netlink headers rather than using #ifdef
This is a better fix than e13e1fad8b231e187bd5de3ce668411bdcd3ac1a for
failing to compile without audit that
77b6e19458f37cfde127ec6aa9494c0ac45ad890 introduced. |
e13e1fad8b231e187bd5de3ce668411bdcd3ac1a |
|
10-May-2013 |
Colin Walters <walters@verbum.org> |
Fix previous commit for !HAVE_AUDIT |
77b6e19458f37cfde127ec6aa9494c0ac45ad890 |
|
10-May-2013 |
Lennart Poettering <lennart@poettering.net> |
audit: since audit is apparently never going to be fixed for containers tell the user what's going on
Let's try to be helpful to the user and give him a hint what he can do
to make nspawn work with normal OS containers.
https://bugzilla.redhat.com/show_bug.cgi?id=893751 |
e724b0639c43c2821613fc4f7f755f87c49a22e8 |
|
07-May-2013 |
Lennart Poettering <lennart@poettering.net> |
hostname: only suppress setting of pretty hostname if it is non-equal to the static hostname and if the static hostname is set, too
https://bugzilla.redhat.com/show_bug.cgi?id=957814 |
b00ad20fa0e490dde28e196739b4e18abb10e9b4 |
|
07-May-2013 |
Lennart Poettering <lennart@poettering.net> |
build-sys: support builds without EAs again |
f8964235e69f58225dec378437b1789744cd22a9 |
|
06-May-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: explain that we look for /etc/os-release in the container directory
https://bugs.freedesktop.org/show_bug.cgi?id=64014 |
a5f5f8a07743bb9aa31fa361c90fce8d4a62388e |
|
02-May-2013 |
Dave Reisner <dreisner@archlinux.org> |
nspawn: inherit the exit status of container
If we get as far as successfully starting the container, nspawn should
inherit the exit status of the child container process as its own. |
38158b920e772ea3a7cc9dfcf705666ce3aa5ce3 |
|
01-May-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
cgls: add --machine/-M
cg_get_machine_path is modified to include the escaped machine name
+ ".nspawn" if the machine argument is nonnull. |
05947befcec9afb83b9ce48d613ff372c63e2ed1 |
|
30-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
units: add an easy-to-use unit template file systemd-nspawn@.service for running containers as system services |
aa96c6cb44a6eeccc506ae055aae2519a7f914e1 |
|
30-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
id128: when taking user input for a 128bit ID, validate syntax
Also, always accept both our simple hexdump syntax and UUID syntax. |
d7e011e5bfa3361faf52b7b2dbacd11373d7fb86 |
|
29-Apr-2013 |
Evangelos Foutras <evangelos@foutrelis.com> |
nspawn: add -M option to optstring
This was missed in commit 7027ff61a34a12487712b382a061c654acc3a679 and
means that the --machine option would work but not its shorthand, -M. |
ae018d9bc900d6355dea4af05119b49c67945184 |
|
23-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: make sure all our cgroup objects have a suffix and are properly escaped
Session objects will now get the .session suffix, user objects the .user
suffix, nspawn containers the .nspawn suffix.
This also changes the user cgroups to be named after the numeric UID
rather than the username, since this allows us the parse these paths
standalone without requiring access to the cgroup file system.
This also changes the mapping of instanced units to cgroups. Instead of
mapping foo@bar.service to the cgroup path /user/foo@.service/bar we
will now map it to /user/foo@.service/foo@bar.service, in order to
ensure that all our objects are properly suffixed in the tree. |
aff38e74bd776471f15ba54b305a24b0251eb865 |
|
23-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: suffix the nspawn cgroups with ".nspawn"
As discussed with Dan Berrange it's a good idea to suffix all objects in
the cgroup tree with ".something", so that when the system is
partitioned using a resource management tool we can drop objects of
different types into the same partition directory without generate
namespace conflicts.
We'l add this to the Pax Control Group document as soon as write access
to the fdo wiki is restored. |
dc2c75602dc9f2529e6ba6db02fa53d057ce0f8c |
|
23-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: always use cg_get_path() to determine fs path for a cgroup |
a383724e4202ee9681bd31cb668c44bdbbf83638 |
|
22-Apr-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
systemd,nspawn: use extended attributes to store metadata
All attributes are stored as text, since root_directory is already
text, and it seems easier to have all of them in text format.
Attributes are written in the trusted. namespace, because the kernel
currently does not allow user. attributes on cgroups. This is a PITA,
and CAP_SYS_ADMIN is required to *read* the attributes. Alas.
A second pipe is opened for the child to signal the parent that the
cgroup hierarchy has been set up. |
f333fbb1efc2f32527f78cbdb003d59bae01aa07 |
|
19-Apr-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: create empty /etc/resolv.conf if necessary
nspawn will overmount resolv.conf if it exists. Since e.g.
default install with yum doesn't create /etc/resolv.conf,
a container created with yum will not have network. This
seems undesirable, and since we overmount the file anyway,
let's create it too.
Also, mounting a read-write /etc/resolv.conf in the container
is treated as a failure, since it makes it possible to
modify hosts /etc/resolv.conf from inside the container. |
7fd1b19bc9e9f5574f2877936b8ac267c7706947 |
|
18-Apr-2013 |
Harald Hoyer <harald@redhat.com> |
move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html |
6606089752df90f3eeb4924af109046f1c73554c |
|
16-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
path-util: unify code for detecting OS trees
This also makes sure we always detect an OS tree the same way, by
checking for /etc/os-release. |
7027ff61a34a12487712b382a061c654acc3a679 |
|
16-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: introduce the new /machine/ tree in the cgroup tree and move containers there
Containers will now carry a label (normally derived from the root
directory name, but configurable by the user), and the container's root
cgroup is /machine/<label>. This label is called "machine name", and can
cover both containers and VMs (as soon as libvirt also makes use of
/machine/).
libsystemd-login can be used to query the machine name from a process.
This patch also includes numerous clean-ups for the cgroup code. |
b92bea5d2a9481de69bb627a7b442a9f58fca43d |
|
06-Apr-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Use initalization instead of explicit zeroing
Before, we would initialize many fields twice: first
by filling the structure with zeros, and then a second
time with the real values. We can let the compiler do
the job for us, avoiding one copy.
A downside of this patch is that text gets slightly
bigger. This is because all zero() calls are effectively
inlined:
$ size build/.libs/systemd
text data bss dec hex filename
before 897737 107300 2560 1007597 f5fed build/.libs/systemd
after 897873 107300 2560 1007733 f6075 build/.libs/systemd
… actually less than 1‰.
A few asserts that the parameter is not null had to be removed. I
don't think this changes much, because first, it is quite unlikely
for the assert to fail, and second, an immediate SEGV is almost as
good as an assert. |
574d5f2dfc25226afc718aa5ba1a145fe5cad221 |
|
03-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
util: rename write_one_line_file() to write_string_file()
You can write much more than just one line with this call (and we
frequently do), so let's correct the naming. |
10d18763ec6f31ded1535f810be765f7fab2d97d |
|
31-Mar-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn, machine-id-setup: warn if read-only mount call fails
They are not crucial, but they shouldn't fail. |
9d60cb63d6e38236b2853b7801bb7784762b13ab |
|
15-Mar-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: don't make assumptions about the size of pid_t |
f2d88580b50e3c173dcc2838f92fa85291bc5495 |
|
07-Mar-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: create a separate devpts namespace for nspawn containers |
5674767ec2cf7d168fe9c30f78074231fbe3408c |
|
28-Feb-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: environment would be truncated with TERM unset |
17fe052346f1d905b5ce0f12123b5ce24e992c6b |
|
25-Feb-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add --bind= and --bind-ro= to bind mount host paths into the container |
1ddf879acf388a4625150c3a97b76458f6d2a070 |
|
25-Feb-2013 |
Michal Schmidt <mschmidt@redhat.com> |
Revert "nspawn: catch config mistake of specifying -b and args"
This reverts commit cb96a2c69a312fb089fef4501650f4fc40a1420b.
It is not a mistake to pass args when -b is specified. They will simply
be passed on to the container's init.
The manpage needs fixing, that's true. |
cb96a2c69a312fb089fef4501650f4fc40a1420b |
|
24-Feb-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: catch config mistake of specifying -b and args |
5659774c575c3c7ac4aa0620a6528cd39e983af6 |
|
14-Feb-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: fail if unable to close pipe |
1fd961211df69ce672252d543bf4777738647048 |
|
14-Feb-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: print PID and show how to enter the namespace
systemd-nspawn will now print the PID of the child.
An example showing how to enter the container is added
to the man page.
Support for nsenter without an explicit command was
added in https://github.com/karelzak/util-linux/commit/5758069
(post v2.22.2). So this example requires both a new kernel
and the latest util-linux. |
a5c32cff1f56afe6f0c6c70d91a88a7a8238b2d7 |
|
14-Feb-2013 |
Harald Hoyer <harald@redhat.com> |
honor SELinux labels, when creating and writing config files
Also split out some fileio functions to fileio.c and provide a SELinux
aware pendant in fileio-label.c
see https://bugzilla.redhat.com/show_bug.cgi?id=881577 |
f2956e80c99cd41ca6bbbe41b09e01b234ca8778 |
|
26-Jan-2013 |
Michal Schmidt <mschmidt@redhat.com> |
nspawn: assume stdout is always writable if it does not support epoll
stdout can be redirected to a regular file. Regular files don't support epoll.
nspawn failed with: "Failed to register fds in epoll: Operation not permitted".
If stdout does not support epoll, assume it's always writable. |
88d04e31ce0837ebf937ab46c3c39a0d93ab4c7c |
|
18-Jan-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add audit caps to default set to keep
Due to the brokeness of much of the userspace audit code we cannot
really start too many systems without the audit caps set. To make nspawn
easier to use just add the audit caps by default.
To boot up containers successfully the kernel's auditing needs to be
turned off still (use "audit=0" on the kernel command line), but at
least no manual caps have to be passed anymore.
In the long run auditing will be fixed for containers and ve virtualized
properly at which time it should be safe to enable these caps anyway. |
acbeb42770e1e99955ebc4464a0439cf741b3aeb |
|
11-Jan-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: add --version |
57cb4adf4ed61ab9eeb7f190f94d700a56bafad0 |
|
22-Dec-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: try to orderly shutdown container when receiving SIGTERM |
842f3b0fc983d9161e152da5b765008e3e6942a8 |
|
22-Dec-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: allow passing socket activation fds through nspawn |
51d88d1b4fb4ba7c2ecbc72cbbcababb21e4925f |
|
22-Dec-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: allow nspawn to be invoked without tty
This allows invoking nspawn containers as systemd services, to create a
minimal, light-weight OS container solution for servers. |
3c957acf86b9ec482a527528987b2462a32e0d07 |
|
22-Nov-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: reset supplementary and main group id before entering nspawn |
27407a01c6c115ed09ad938ab95dcb56ab963ba9 |
|
02-Oct-2012 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: use automatic cleanup and provide debug info
The documentation for --link-journal is also reworded. |
963ddb917de3140308ee62fb642b2307a577a39e |
|
24-Sep-2012 |
Lennart Poettering <lennart@poettering.net> |
log: fix repeated invocation of vsnprintf()/vaprintf() in log_struct()
https://bugs.freedesktop.org/show_bug.cgi?id=55213 |
77e63fafa5736c235920b8deef73afbf733a7fda |
|
21-Sep-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: document why we don't check resolv.conf mount errors |
d40361453be0525a0455d549b2b863931b069358 |
|
21-Sep-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: we can't overmount /etc/localtime anymore since it's usually a symlink now
Create the right symlink if possible for /etc/localtime |
89154bd4ac71157e382bacdc4dc3a96990940d36 |
|
16-Sep-2012 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: fix memleak introduced with automatic cleanup
6b2d0e8 introduced a memleak instead of fixing one.
Fix both. |
25ea79fe0756c3c46a16c0c19bf3380a30382a1c |
|
16-Sep-2012 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: use automatic cleanup for umask |
ed8b7a3ee55b27a06a54d2dfa39eec5e555e005b |
|
16-Sep-2012 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: _cleanup_free_ more |
6b2d0e85dce8762d6d65a97c7c7ae5e81806fe3e |
|
16-Sep-2012 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: use automatic cleanup
This one actually clears up a (totally harmless) memleak. |
ede89845a49c735fa9e8a04bd80f6e94ea84aeb9 |
|
16-Sep-2012 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
nspawn: mount tmpfs on /dev/shm
Most things seem to function fine without /dev/shm, but it is expected
to be there (quoting linux/Documentation/filesystems/tmpfs.txt:
glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for POSIX
shared memory (shm_open, shm_unlink)).
Since /tmp/ is already mounted as tmpfs, it would be enough to mkdir
/tmp/shm and chmod it. Mounting it separately has the advantage that
it can be easily remounted to change the quota. |
d87be9b0af81a6e07d4fb3028e45c4409100dc26 |
|
06-Sep-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: handle poweroff/reboot nicely in containers |
3eabccc46c003d129a847ba423a6d0ba778e4930 |
|
06-Sep-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: don't provide /dev/rtc0 in the container
Since RTCs are hardware devices and are very much shared resources we
should avoid to provide them in each container. |
04bc4a3f47074d22035831965e97b0990fcf6f63 |
|
05-Sep-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: generate a new randomized boot ID for each container |
9c1c7f712d8270c4f6bd8141d0b1acb1f031fa08 |
|
05-Sep-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: if a file system comes pre-mounted, still do the read-only remounts |
014a9c777b97b9df432f71537e289b2723795412 |
|
05-Sep-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: skip mounts if already mounted |
e65aec12ae1d224aa2b7743fd5d5d10c586227ac |
|
05-Sep-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: mount a clean instance of sysfs |
4fc9982cb0499f6502aefc5b8f410658c6d4d261 |
|
21-Aug-2012 |
Dave Reisner <dreisner@archlinux.org> |
nspawn: add /dev FD symlinks in container setup
This creates /dev/fd, /dev/stdin, /dev/stdout, /dev/stderr, and
/dev/core as symlinks to /proc on container creation. Except for
/dev/core, these are needed for shells like bash to be fully functional. |
1e41be20158a6d982c34cea20e66ff271302abc5 |
|
13-Aug-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn,namespaces: make sure we recursively bind mount things in
We want to make sure that everything from the host is also visible in
the sandbox. |
b4c59701f8d439f84141d4858dc1aa339f4ec529 |
|
13-Aug-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: unset a few unnecessary params to mount() |
6f67a45d8e61d69bf4f75e1da3edcf9fe7d89982 |
|
13-Aug-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: inherit mounts from real root, don't propagate mounts to real root |
0d0f0c50d3a1d90f03972a6abb82e6413daaa583 |
|
26-Jul-2012 |
Shawn Landden <shawnlandden@gmail.com> |
log.h: new log_oom() -> int -ENOMEM, use it
also a number of minor fixups and bug fixes: spelling, oom errors
that didn't print errors, not properly forwarding error codes,
few more consistency issues, et cetera |
669241a076108e0483d7d8475beaa506106d077e |
|
25-Jul-2012 |
Shawn Landden <shawnlandden@gmail.com> |
use "Out of memory." consistantly (or with "\n")
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.
Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id |
db7feb7e9c436ec3ad3b90cf21bd43d8036aad0d |
|
19-Jul-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: generate proper error messages in the child |
57fb9fb56db0584581ce33ee842dcbf5f1136856 |
|
19-Jul-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: introduce new --link-journal= switch to link container journals into host |
d05c5031ad4c528fe6bbfed289519edb9f13180a |
|
16-Jul-2012 |
Lennart Poettering <lennart@poettering.net> |
unit: introduce %s specifier for the user shell |
5076f0ccfd36b67512d44fe355b80305ced7dcba |
|
28-Jun-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: introduce new --capabilities= flag and make use of it in the nspawn test case |
d2e54fae5ca7a0f71b5ac8b356a589ff0a09ea0a |
|
31-May-2012 |
Kay Sievers <kay@vrfy.org> |
mkdir: append _label to all mkdir() calls that explicitly set the selinux context |
ec8927ca5940e809f0b72f530582c76f1db4f065 |
|
24-May-2012 |
Lennart Poettering <lennart@poettering.net> |
main: add configuration option to alter capability bounding set for PID 1
This also ensures that caps dropped from the bounding set are also
dropped from the inheritable set, to be extra-secure. Usually that should
change very little though as the inheritable set is empty for all our uses
anyway. |
9eb977db5b89b44f254ab40c1876a76b7d7ea2d0 |
|
08-May-2012 |
Kay Sievers <kay@vrfy.org> |
util: split-out path-util.[ch] |
bc2f673ec24b59948fcfc35b3077fda0314e69d8 |
|
25-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add --read-only switch |
2547bb414c69b7a5b3eb8d7a10768e0cf4114447 |
|
25-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: bind mount /etc/resolv.conf from the host by default |
144f0fc0c8a5e2f6b72179e2b5fb992474da24ad |
|
22-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add --uuid= switch to allow setting the machine id for the container |
0f0dbc46ccf5aaaf3131446d0a4d78bc97a37295 |
|
22-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add -b switch to automatically look for an init binary |
3a74cea5e4cea6d6f852a2a7118efe0e339b78c7 |
|
22-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: be more careful when initializing the hostname from the directory name |
f1e5dfe2c065670e0dac63c7bb2dd82fe820e2ab |
|
22-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: make /dev/kmsg unavailable in the container, but allow access to /proc/kmsg |
4d46fec56db73e1d2d01076792f9b8f3231d5cb1 |
|
18-Apr-2012 |
Kay Sievers <kay@vrfy.org> |
remove MS_* which can not be combined with current kernel code
MS_BIND|MS_MOVE can not be combined:
do_mount()
else if (flags & MS_BIND)
do_loopback(&path, dev_name, flags & MS_REC);
[...]
else if (flags & MS_MOVE)
do_move_mount(&path, dev_name);
MS_REMOUNT|MS_UNBINDABLE can not be combined:
do_mount()
if (flags & MS_REMOUNT)
do_remount(&path, flags & ~MS_REMOUNT, mnt_flags, data_page);
[...]
else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
do_change_type(&path, flags); |
9537eab07053d1fc26ce627117ce4da076bdbf86 |
|
13-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: add missing include lines |
e58a12770c0c7b9571cc80f487d666151811c1ee |
|
13-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
nspawn: fake /dev/kmsg and /proc/kmsg as fifo |
dce818b390a857a11f7dd634684500675cf79833 |
|
12-Apr-2012 |
Kay Sievers <kay@vrfy.org> |
move all tools to subdirs |