Commit graph

16750 commits

Author SHA1 Message Date
Lennart Poettering 4ea0d7f431 core: make "Restart" service property accessible via the transient API
Fixes: #4402
2016-12-14 00:54:13 +01:00
Lennart Poettering d2d6c096f6 core: add ability to define arbitrary bind mounts for services
This adds two new settings BindPaths= and BindReadOnlyPaths=. They allow
defining arbitrary bind mounts specific to particular services. This is
particularly useful for services with RootDirectory= set as this permits making
specific bits of the host directory available to chrooted services.

The two new settings follow the concepts nspawn already possess in --bind= and
--bind-ro=, as well as the .nspawn settings Bind= and BindReadOnly= (and these
latter options should probably be renamed to BindPaths= and BindReadOnlyPaths=
too).

Fixes: #3439
2016-12-14 00:54:10 +01:00
Lennart Poettering 8fceda937f namespace: instead of chasing mount symlinks a priori, do so as-we-go
This is relevant as many of the mounts we try to establish only can be followed
when some other prior mount that is a prefix of it is established. Hence: move
the symlink chasing into the actual mount functions, so that we do it as late
as possibly but as early as necessary.

Fixes: #4588
2016-12-14 00:51:37 +01:00
Lennart Poettering 34de407a4f core: rename BindMount structure → MountEntry
After all, these don#t strictly encapsulate bind mounts anymore, and we are
preparing this for adding arbitrary user-defined bind mounts in a later commit,
at which point this would become really confusing. Let's clean this up, rename
the BindMount structure to MountEntry, so that it is clear that it can contain
information about any kind of mount.
2016-12-14 00:48:52 +01:00
Lennart Poettering cfbeb4ef8d namespace: add explicit read-only flag
This reworks handling of the read-only management for mount points. This will
become handy as soon as we add arbitrary bind mount support (which comes in a
later commit).
2016-12-14 00:42:01 +01:00
Lennart Poettering ddbe041277 namespace: reindent protect_system_strict_table[] as well
All other tables got reindented, but one was forgotten. Fix that.
2016-12-13 21:22:13 +01:00
Lennart Poettering 835552511e core: hook up MountFlags= to the transient unit logic
This makes "systemd-run -p MountFlags=shared -t /bin/sh" work, by making
MountFlags= to the list of properties that may be accessed transiently.
2016-12-13 21:22:13 +01:00
Evgeny Vereshchagin da2d142114 sd-id128: id128_write overwrites target file 2016-12-13 13:03:14 +00:00
Evgeny Vereshchagin a6f72863ad machine-id-setup: --print --commit respects the --root option 2016-12-13 13:03:13 +00:00
Evgeny Vereshchagin fcb2427055 core: machine_id_setup overwrites broken machine-id 2016-12-13 12:58:42 +00:00
Andrey Ulanov 6916b16464 nspawn: when getting SIGCHLD make sure it's from the first child (#4855)
When getting SIGCHLD we should not assume that it was the first
child forked from system-nspawn that has died as it may also be coming
from an orphan process. This change adds a signal handler that ignores
SIGCHLD unless it came from the first containerized child - the real
child.

Before this change the problem can be reproduced as follows:

$ sudo systemd-nspawn --directory=/container-root --share-system
Press ^] three times within 1s to kill container.
[root@andreyu-coreos ~]# { true & } &
[1] 22201
[root@andreyu-coreos ~]#
Container root-fedora-latest terminated by signal KILL
2016-12-13 02:38:18 +01:00
Martin Pitt 142a1afbb9 Merge pull request #4771 from keszybz/udev-property-ordering
Udev property ordering
2016-12-12 16:03:52 +01:00
Lennart Poettering 161f1ee134 Merge pull request #4867 from keszybz/catalog-messages
Catalog message improvements
2016-12-12 00:02:01 +01:00
Zbigniew Jędrzejewski-Szmek 7a100dce9d hwdb: emit warning when matches are specified at the very end of file
This is also an error, but it wasn't caught.

[/tmp/tmp.YWeKax4fMI/etc/udev/hwdb.d/10-bad.hwdb:26] Property expected, ignoring record with no properties
2016-12-11 18:01:26 -05:00
Zbigniew Jędrzejewski-Szmek b457b33ddc basic/log: CODE_FUNCTION → CODE_FUNC
systemd.journal-fields(7) documents CODE_FUNC=. Internally, we were
inconsistent: sd_journal_print uses CODE_FUNC=, log.h has CODE_FUNCTION=,
python-systemd and bootchart also used CODE_FUNC=, when they were internal.
Most external projects use sd_journal_* functions, so CODE_FUNC=,
python-systemd still uses CODE_FUNC=, as does systemd-bootchart, and
independent reimplementations in golang-github-coreos-go-systemd, qtbase,
network manager, glib, pulseaudio. Hence, I don't think there's much
choice.
2016-12-11 15:43:16 -05:00
Zbigniew Jędrzejewski-Szmek e697dfef64 share/log: change log_syntax from "[a:b] " to "a🅱️ "
Those square brackets don't fit how our other messages look like; we use colons
everywhere else. The "[a:b]" format was originally added in
ed5bcfbe3c, and remained unchanged for 7 years,
but in the meantime other conventions evolved.

The new version is also one character shorter.

[/etc/systemd/system/systemd-networkd.service.d/override.conf:2] Failed to parse sec value, ignoring: ...
  ↓
/etc/systemd/system/systemd-networkd.service.d/override.conf:2: Failed to parse sec value, ignoring: ...
2016-12-11 15:43:16 -05:00
Zbigniew Jędrzejewski-Szmek c2dec70292 basic/log: merge two big log_struct_internal invocations into one
We can take advantage of the fact a NULL argument terminates the list.
2016-12-11 15:43:16 -05:00
Lennart Poettering 15ffcc3456 Merge pull request #4859 from keszybz/networkd
Networkd man page update and fixes for the fallout
2016-12-11 20:38:15 +01:00
Lennart Poettering 4682047cf2 Merge pull request #4864 from keszybz/build-sys
Fix some build issues and warnings
2016-12-11 20:12:32 +01:00
Lennart Poettering 280b29ac84 Merge pull request #4861 from keszybz/dissect-tweaks
A prettification of the dissect code, mkosi and TODO updates
2016-12-11 20:09:04 +01:00
Zbigniew Jędrzejewski-Szmek 5a1d6cb19d pid1,catalog: use a different MESSAGE_ID for user manager startup
This add a new message id for the end of user instance startup.
User manager startup is a different beast then the system startup.
Their descriptions are completely different too. Let's just separate
them.

Partially fixes #3351.

Also remove "successful" from the description, since we don't know if
the startup was successful or not.
2016-12-11 12:41:23 -05:00
Zbigniew Jędrzejewski-Szmek 330785f5ca basic/extract-word,man: clarify "correction" of invalid escapes
Our warning message was misleading, because we wouldn't "correct" anything,
we'd just ignore unkown escapes. Update the message.

Also, print just the extracted word (which contains the offending sequences) in
the message, instead of the whole line.

Fixes #4697.
2016-12-11 00:21:36 -05:00
Zbigniew Jędrzejewski-Szmek 007f48bb89 pid1: remove unnecessary counter
The loop must terminate after at most three iterations anyway.
2016-12-11 00:21:35 -05:00
Zbigniew Jędrzejewski-Szmek 2dc95d98e1 shared/firewall-util: remove warning about net/if.h workaround
This is already fixed upstream, so warning is not useful.
Let's keep the workaround until the fix has percolated downstream.
2016-12-10 13:55:13 -05:00
Zbigniew Jędrzejewski-Szmek 691b90d465 journal: fix warning about LZ4_compress_limitedOutput 2016-12-10 13:52:49 -05:00
Zbigniew Jędrzejewski-Szmek 4f8b86e307 dissect: assume GPT_ROOT_SECONDARY_VERITY is defined when GPT_ROOT_SECONDARY is
We define those macros, and there's no reason to have one without
the other.
2016-12-10 13:35:47 -05:00
Zbigniew Jędrzejewski-Szmek b7cac52779 build-sys: define arm as secondary architecture for arm64
Completely unstested. Fixes #4862.
2016-12-10 13:01:22 -05:00
Zbigniew Jędrzejewski-Szmek 1ac7a93574 Merge pull request #4835 from poettering/unit-name-printf
Various specifier resolution fixes.
2016-12-10 01:29:52 -05:00
Zbigniew Jędrzejewski-Szmek 4a5567d5d6 Merge pull request #4795 from poettering/dissect
Generalize image dissection logic of nspawn, and make it useful for other tools.
2016-12-10 01:08:13 -05:00
Wim de With 2e1f244efd nspawn: add missing -E to getopt_long (#4860) 2016-12-10 07:33:58 +03:00
Zbigniew Jędrzejewski-Szmek 6f3d4decf2 networkd: check that VTI/VTI6 tunnels have a local address
Otherwise we'd fail with an assertion:
Assertion 't->family == AF_INET' failed at ../src/network/netdev/tunnel.c:244, function netdev_vti_fill_message_create(). Aborting.
2016-12-09 13:55:14 -05:00
Zbigniew Jędrzejewski-Szmek 6e47dbbcb3 networkd: tighten parsing of Tunnel addresses
When assigning addresses, we'd set the family, and later
verify that the address on the other end has the same family.
But when the address was specified as "any", we'd simply unset
the family. Instead, only unset the family if both addresses
are wiped.

Also, don't bother setting family = AF_UNSPEC, since it's the default (0).
2016-12-09 13:55:14 -05:00
Zbigniew Jędrzejewski-Szmek 40a922d055 networkd: use log_netdev_error in a two more places 2016-12-09 13:55:14 -05:00
Zbigniew Jędrzejewski-Szmek b106c5867b networkd: do not print ": Success" in debug message
%m isn't useful in success path.
2016-12-09 13:55:14 -05:00
Zbigniew Jędrzejewski-Szmek 59ec09a83e pid1: simplify the logic in two statements related to killing processes
Generally non-inverted conditions are nicer, and ternary operators
with complex conditions are a bit hard to read.

No functional change.
2016-12-09 13:53:31 -05:00
Reverend Homer 8fb3f00997 tree-wide: replace all readdir cycles with FOREACH_DIRENT{,_ALL} (#4853) 2016-12-09 10:04:30 +01:00
Zbigniew Jędrzejewski-Szmek 9258a1cae3 Merge pull request #4686 from poettering/machine-id-app-specific
Add new "khash" API and add new sd_id128_get_machine_app_specific() function
2016-12-08 23:24:28 -05:00
David Michael 1aa68db1ae network: fix const qualifier (#4849)
Follow up for #4809.
2016-12-07 16:42:17 -05:00
Franck Bui 5367354dae nspawn: resolv.conf might not be created initially (#4799)
This might happen that resolv.conf is missing in a minimal rootfs and in this
case the following warning is emitted:

 Failed to mount n/a on /mnt/etc/resolv.conf (MS_BIND ""): No such file or directory

This patch fixes this case.
2016-12-07 21:36:39 +01:00
Lennart Poettering e332833f07 Merge pull request #4843 from joukewitteveen/protocol
Go through stop_post on failure (#4770)
2016-12-07 21:35:07 +01:00
Zbigniew Jędrzejewski-Szmek 971e2ef0cb dissect: add DISSECT_IMAGE_DISCARD_ANY mask
This makes the code to set arg_flags much more readable.
2016-12-07 15:26:11 -05:00
David Michael 618b196e9d network: support negation in matching patterns (#4809) 2016-12-07 19:12:10 +01:00
Lennart Poettering 03fc9c723c core: add a note clarifying that we should be careful when adding new specifiers 2016-12-07 19:10:04 +01:00
Lennart Poettering 1b89b0c499 core: deprecate %c, %r, %R specifiers
%c and %r rely on settings made in the unit files themselves and hence resolve
to different values depending on whether they are used before or after Slice=.
Let's simply deprecate them and drop them from the documentation, as that's not
really possible to fix. Moreover they are actually redundant, as the same
information may always be queried from /proc/self/cgroup and /proc/1/cgroup.

(Accurately speaking, %R is actually not broken like this as it is constant.
However, let's remove all cgroup-related specifiers at once, as it is also
redundant, and doesn't really make much sense alone.)
2016-12-07 18:58:09 +01:00
Lennart Poettering ea9cfad1d7 tests: let's make function tables static/const 2016-12-07 18:47:32 +01:00
Lennart Poettering 7b07e99320 core: add specifier expansion to ReadOnlyPaths= and friends
Expanding specifiers here definitely makes sense.

Also simplifies the loop a bit, as there's no reason to keep "prev" around...
2016-12-07 18:47:32 +01:00
Lennart Poettering 744bb5b1be core: add specifier expansion to RequiresMountsFor=
This might be useful for some people, for example to pull in mounts for paths
including the machine ID or hostname.
2016-12-07 18:47:32 +01:00
Lennart Poettering d107589cd2 core: turn on specifier expansion for more unit file settings
Let's permit specifier expansion at a numbre of additional fields, where
arbitrary strings might be passed where this might be useful one day. (Or at
least where there's no clear reason where it wouldn't make sense to have.)
2016-12-07 18:47:32 +01:00
Lennart Poettering 18913df9a2 core: use unit_full_printf() at a couple of locations we used unit_name_printf() before
For settings that are not taking unit names there's no reason to use
unit_name_printf(). Use unit_full_printf() instead, as the names are validated
anyway in one form or another after expansion.
2016-12-07 18:47:32 +01:00
Lennart Poettering b1801e6433 core: resolve more specifiers in unit_name_printf()
unit_name_printf() is usually what we use when the resulting string shall
qualify as unit name, and it hence avoids resolving specifiers that almost
certainly won't result in valid unit names.

Add a couple of more specifiers that unit_full_printf() resolves also to the
list unit_name_printf() resolves, as they are likely to be useful in valid unit
names too. (Note that there might be cases where this doesn't hold, but we
should still permit this, as more often than not they are safe, and if people
want to use them that way, they should be able to.)
2016-12-07 18:47:32 +01:00