Commit Graph

33491 Commits

Author SHA1 Message Date
Yu Watanabe c9f620bfec core: support unit specifiers in IODeviceWeight= and friends 2018-05-20 23:08:50 +09:00
Yu Watanabe 063c4b1a92 core/load-fragment: update log messages 2018-05-20 23:08:29 +09:00
David Tardon a7a7163df7 fix race between daemon-reload and other commands
When "systemctl daemon-reload" is run at the same time as "systemctl
start foo", the latter might hang. That's because commands like start
wait for JobRemoved signal to know when the job is finished. But if the
job is finished during reloading, the signal is never sent.

The hang can be easily reproduced by running

    # for ((N=1; N>0; N++)) ; do echo $N ; systemctl daemon-reload ; done
    # for ((N=1; N>0; N++)) ; do echo $N ; systemctl start systemd-coredump.socket ; done

in two different terminals. The start command will hang after 1-2
iterations.

This keeps track of jobs that were started before reload and finished
during it and sends JobRemoved after the reload has finished.
2018-05-19 11:37:00 +02:00
Lucas Werkmeister 90bc77af29 man: fix typo 2018-05-19 15:01:52 +09:00
Lennart Poettering 6f8fa29465
Merge pull request #8981 from keszybz/ratelimit-and-dbus
Ratelimit renaming and dbus error message fix
2018-05-18 21:38:30 +02:00
Franck Bui 752bcb770b core: keep the kernel coredump defaults when systemd-coredump is disabled
If systemd-coredump is disabled (at build time), PID1 should keep the
(old) kernel defaults as they are.
2018-05-18 20:37:54 +02:00
David Tardon 3b082a59d8 localectl: drop duplicate property entry 2018-05-18 20:37:29 +02:00
Lennart Poettering c385b10a13
Merge pull request #8993 from keszybz/sd-resolve-coverity-and-related-fixes
sd-resolve coverity and related fixes
2018-05-18 20:30:12 +02:00
Lennart Poettering 0612ac38a7
Merge pull request #8985 from yuwata/bus-macro-3
tree-wide: use BUS_DEFINE_PROPERTY_GET* macros
2018-05-18 20:25:52 +02:00
Zbigniew Jędrzejewski-Szmek 627d2bac24 fs-util,test: add helper to remove tempfiles
This simplifies the use of tempfiles in tests and fixes "leaked"
temporary files in test-fileio, test-catalog, test-conf-parser.

Not the whole tree is converted.
2018-05-18 20:11:31 +02:00
Lennart Poettering c55b280158
Merge pull request #9026 from yuwata/followup-9021
core: refuse StateDirectory=private
2018-05-18 20:02:43 +02:00
Yu Watanabe 5e2d3a5496 core: use free_and_replace() 2018-05-18 17:35:23 +09:00
Yu Watanabe e760d687dc core: fix coding style 2018-05-18 17:34:59 +09:00
Zbigniew Jędrzejewski-Szmek 7fbb5dd5e2
Merge pull request #8940 from poettering/nspawn-attrs
nspawn: make a couple of additional container parameters configurable
2018-05-18 10:33:10 +02:00
Lennart Poettering a2d1fb882c tmpfiles: fix up and complain paths referring to /var/run (instead of /run) automatically
tmpfiles.d relies on merging lines for the same file paths, as well as
detecting conflicts between lines for the same file paths. /var/run is a
prominent case that is an alias for /run, any many tmpfiles snippets
refer to paths in /var/run rather than /run currently, which breaks the
conflict detection and merging.

We can't really fix this comprehensively, as doing so would require us
to resolve symlinks early on, but that's precisely not what we want to
do, as tmpfiles is usually run very early on where the paths might not
be fully available yet (in particular as we might likely create them
ourselves).

Hence, let's at least detect and fix this case for the most prominent
case of this ambiguity, and also log explicitly about this, asking users
to fix the snippets in question so that the merging and conflict
detection works properly again.
2018-05-18 10:26:29 +02:00
David Tardon f3c9133c50 inhibit: use pager for systemd-inhibit --list 2018-05-18 08:33:45 +02:00
Yu Watanabe 8994a11790 core: refuse StateDirectory=private
Follow-up for e886568873 (#9021).
2018-05-18 13:30:21 +09:00
Lennart Poettering a78388e1cb tmpfiles: create /var/{lib,log,cache}/private during early boot
This directory is used by the DynamicUer= stuff when used in combination
with StateDirectory=/LogDirectory=/CacheDirectory=. Let's make sure the
dir exists early on with the right perms. This is not strictly necessary
as we'll also create the dir on demand if it is missing, but in the
interest of grabbing the name early on, and making things more explicit
let's also list this in a tmpfiles.d/ snippet.
2018-05-18 11:00:42 +09:00
Lennart Poettering e886568873 core: refuse StateDirectory=private, as our internal DynamicUser=1 symlink is called that way
Let's better be safe than sorry.
2018-05-18 10:59:15 +09:00
Lennart Poettering 919f5ae0c7 nspawn: voidify more things 2018-05-17 20:48:55 +02:00
Lennart Poettering 53e87b5afe path-util: one more empty_or_root() change 2018-05-17 20:48:55 +02:00
Lennart Poettering 5d9614077d nspawn: split out merging of settings object
Let's separate the loading of the settings object and the merging into
our arg_xyz fields into two.

This will become particularly useful when we eventually are able to load
settings from OCI runtime files in addition to .nspawn files.
2018-05-17 20:48:55 +02:00
Lennart Poettering d107bb7d63 nspawn: add a new --cpu-affinity= switch
Similar as the other options added before, this is primarily useful to
provide comprehensive OCI runtime compatbility, but might be useful
otherwise, too.
2018-05-17 20:48:54 +02:00
Lennart Poettering 50ebcf6cb7 nspawn: show --help text in a pager
The text is long enough now, and we do auto-paging for systemctl
already, hence let's do it here too.
2018-05-17 20:48:13 +02:00
Lennart Poettering 81f345dfed nspawn: add a new --oom-score-adjust= command line switch
This is primarily useful in order to provide comprehensive OCI runtime
compatibility with nspawn, but might have uses outside of it.
2018-05-17 20:48:12 +02:00
Lennart Poettering c818eef1cd nspawn: properly handle and log about hostname setting errors 2018-05-17 20:47:21 +02:00
Lennart Poettering 9f8168eb23 process-util: add new helper call for adjusting the OOM score
And let's make use of it in execute.c
2018-05-17 20:47:21 +02:00
Lennart Poettering e9eb2c02f0 basic: split parsing of the OOM score adjust value into its own function in parse-util.c
And port config_parse_exec_oom_score_adjust() over to use it.

While we are at it, let's also fix config_parse_exec_oom_score_adjust()
to accept an empty string for turning off OOM score adjustments set
earlier.
2018-05-17 20:47:21 +02:00
Lennart Poettering 66edd96310 nspawn: add a new --no-new-privileges= cmdline option to nspawn
This simply controls the PR_SET_NO_NEW_PRIVS flag for the container.
This too is primarily relevant to provide OCI runtime compaitiblity, but
might have other uses too, in particular as it nicely complements the
existing --capability= and --drop-capability= flags.
2018-05-17 20:47:20 +02:00
Lennart Poettering 3a9530e5f1 nspawn: make the hostname of the container explicitly configurable with a new --hostname= switch
Previously, the container's hostname was exclusively initialized from
the machine name configured with --machine=, i.e. the internal name and
the external name used for and by the container was synchronized. This
adds a new option --hostname= that optionally allows the internal name
to deviate from the external name.

This new option is mainly useful to ultimately implement the OCI runtime
spec directly in nspawn, but it might be useful on its own for some
other usecases too.
2018-05-17 20:46:45 +02:00
Lennart Poettering 5a4ff98840 conf-parser: shorten config_parse_string() by using free_and_strdup() and empty_to_null() 2018-05-17 20:45:57 +02:00
Lennart Poettering bf428efb07 nspawn: add new --rlimit= switch, and always set resource limits explicitly for our container payloads
This ensures we set the various resource limits of our container
explicitly on each invocation so that we inherit less from our callers
into the payload.

By default resource limits are now set to the same values Linux
generally passes to the host PID 1, thus minimizing needless differences
between host and container environments.

The limits are now also configurable using a new --rlimit= switch. This
is preparation for teaching nspawn native OCI runtime support as OCI
permits setting resource limits for container payloads, and it hence
probably makes sense if we do too.
2018-05-17 20:45:54 +02:00
Lennart Poettering 114c55f2d5 rlimit-util: tweak setrlimit_closest() a bit
POSIX doesn't declare too clearly how RLIM_INFINITY is set. Let's hence
filter it out explicitly early on, just as safety precaution should it
be defined weirdly on some arch, for example negative or below the
maximum value of the rlim_t type.
2018-05-17 20:40:04 +02:00
Lennart Poettering 37bc14de5b basic: be more careful when closing fds based on RLIMIT_NOFILE
Let's make sure we properly handle cases where RLIMIT_NOFILE is set to
infinity, zero or values outside of the "int" range.
2018-05-17 20:40:04 +02:00
Lennart Poettering 1752d69a8b man: document what happens if --kill-signal= is not used in nspawn and --boot neither 2018-05-17 20:40:04 +02:00
Lennart Poettering c7fc3c4cfe man: don't claim systemd-analyze was documented as part of the man-pages project
It's our own command, we document it in our own set of man pages.
2018-05-17 20:40:04 +02:00
Lennart Poettering 34a5df58da rlimit-util: introduce setrlimit_closest_all()
This new call applies all configured resource limits in one.
2018-05-17 20:40:04 +02:00
Lennart Poettering 31ce987c2b rlimit-util: add a common destructor call for arrays of struct rlimit 2018-05-17 20:36:52 +02:00
Lennart Poettering 4f424df760 core: move config_parse_limit() to the generic conf-parser.[ch]
That way we can use it in nspawn.

Also, while we are at it, let's rename the call config_parse_rlimit(),
i.e. insert the "r", to clarify what kind of limit this is about.
2018-05-17 20:36:52 +02:00
Lennart Poettering 6550c24c7f rlimit-util: rework rlimit_{from|to}_string() to work without "Limit" prefix
let's make the call more generic, so that we can also easily use it for
parsing "RLIMIT_xyz" style constants.
2018-05-17 20:36:52 +02:00
Lennart Poettering 0e960f9b5c
Merge pull request #9017 from keszybz/man-coredump
coredump documention enhancement
2018-05-17 10:45:22 -07:00
Lennart Poettering b391a5f5d5
Merge pull request #9002 from yuwata/fix-timedate
Fixes timedated and cleanups hostnamed
2018-05-17 10:38:37 -07:00
Lennart Poettering 94e05c9a09
Merge pull request #9016 from yuwata/fix-policy
polkit policy related fixes
2018-05-17 10:07:56 -07:00
Zbigniew Jędrzejewski-Szmek d18cb3937b Turn VALGRIND variable into a meson configuration switch
Configuration through environment variable is inconvenient with meson, because
they cannot be convieniently changed and/or are not preserved during
reconfiguration (https://github.com/mesonbuild/meson/issues/1503).
This adds -Dvalgrind=true/false, which has the advantage that it can be set
at any time with meson configure -Dvalgrind=... and ninja will rebuild targets
as necessary. Additional minor advantages are better consistency with the
options for hashmap debugging, and typo avoidance with '#if' instead of '#ifdef'.
2018-05-17 09:54:36 -07:00
Zbigniew Jędrzejewski-Szmek c8e053fbe4 man: fix ProcessSizeMax= description, describe how to disable coredumps
What the man page said was different than what the code did.
save_external_coredump() will store the core temporarily for backtrace
generation, and will delete if afterwards if it is too large. So to disable
processing, it's necessary to both set
Storage=none/Storage=journal+JournalSizeMax=0/Storage=external+ExternalSizeMax=0
and ProcessSizeMax=0. This updates the man page to reflect the code.

The man pages are extended to describe that Storage=none + ProcessSizeMax=0 is
the simplest way to disable coredump processing. All the storage and processing
options make this quite complicated, so let's add a copy-and-pasteable example
of how to disable coredump. Doing it through coredump.conf has the advantage
that we still log, and the effect is immediate, unlike masking the sysconf
file.

Fixes #8788.
2018-05-17 17:15:03 +02:00
Yu Watanabe e610ac3d50 timedatectl: do not wrap polkit policy message
If messages are wrapped, then only the last line is shown in the
dialog, at least polkit gui for Xfce. It may be a bug of polkit or
Xfce. But it is not necessary to wrap the message in the policy
file. So, let's fix them.
2018-05-18 00:03:15 +09:00
Yu Watanabe a8f2b6912e core: systemd1.manage-unit-files policy implies systemd1.manage-units
This makes e.g. `systemctl enable --now` ask password only once.

Follow-up for b07abe63d3abf03df559f7cb2c9863943df22274.
2018-05-18 00:02:58 +09:00
Zbigniew Jędrzejewski-Szmek ee0449fd7a coredump: properly treat Storage=none as disabled storage
Also don't attempt to create /var/lib/systemd/coredump if storage
limit is set to 0 and coredump processing is disabled.
2018-05-17 17:00:11 +02:00
Yu Watanabe 51b66c7a8a core: systemd1.manage-unit-files policy implies systemd1.reload-daemon
Closes #5013.
2018-05-15 15:01:05 -07:00
Zbigniew Jędrzejewski-Szmek 5300857701
Merge pull request #9005 from fsateler/circular-deps
core: Fix some header dependencies
2018-05-15 21:56:50 +02:00