Commit Graph

33516 Commits

Author SHA1 Message Date
Yu Watanabe 0187368cad resolve: enable DynamicUser= for systemd-resolved.service 2018-05-22 22:32:25 +09:00
Yu Watanabe fdff1da299 core: chown RuntimeDirectory= if DynamicUser= is set
When DynamicUser= is set, then RuntimeDirectory= should be always
chowned, as the service unit may enable RuntimeDirectoryPreserve=,
and the uid or gid may changed from the last run.
This also makes easier to migrate the service to use DynamicUser=.
2018-05-22 22:26:22 +09:00
Yu Watanabe 906cb2eb74 timesync,shared: move logic requesting bus name to shared
Preparation for setting DynamicUser= to other services which
request bus names.
2018-05-22 22:20:17 +09:00
Yu Watanabe be80154827 unit: drop After=systemd-sysusers.service from timesyncd
After=systemd-sysusers.service is not necessary, as timesyncd
already enables DynamicUser=.
2018-05-22 22:20:17 +09:00
Arnaud Rebillout c9fe05e07d nspawn: support pivot-root option during directory validation
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2018-05-22 14:42:10 +02:00
Lennart Poettering 2fcbdd2d3f
Merge pull request #9059 from keszybz/rm-rf-generators
Allow removing generators dirs on real fs
2018-05-22 14:30:03 +02:00
Lennart Poettering c0d7a4f0cd
Merge pull request #9061 from poettering/dump-string-table
add new DUMP_STRING_TABLE() macro and make use of it everywhere
2018-05-22 14:28:38 +02:00
Lennart Poettering c1104417b7
Merge pull request #9058 from keszybz/fun-with-uint64_c
Fun with UINT64_C
2018-05-22 13:23:56 +02:00
Lennart Poettering 398246292e detect-virt: add new --list command for showing all currently known VM/container envs 2018-05-22 13:14:18 +02:00
Lennart Poettering 5c828e66b5 tree-wide: port various bits of the tree over to the new DUMP_STRING_TABLE() macro 2018-05-22 13:14:18 +02:00
Lennart Poettering 081a0c7256 volatile-mode: use the usual string table macros for implementing volatile_mode_from_string()
Let's shorten our code a bit, and also add the matching _to_string()
call.
2018-05-22 13:14:18 +02:00
Lennart Poettering abdf29f50d coredumpctl: always output proper english sentence
Let's uppercase the first character, and finish them in a full stop.
2018-05-22 13:14:18 +02:00
Lennart Poettering d34f3bc4e5 string-table: add new DUMP_STRING_TABLE() macro
The macro is inspired by the other string table macros, and takes the
same arguments in the same order and dumps a string table to stdout.
Since it's typesafe it's nice to implement this as macro rather than
regular function.

This new macro is useful for implementing commands such as "systemctl -t
help" and similar, i.e. wherever we want to dump all values of an enum
to stdout.
2018-05-22 13:14:18 +02:00
Zbigniew Jędrzejewski-Szmek 114110cdf1 Generator dirs might be on a real filesystem
Most of the time, tmpfs is used for /tmp, but this is not required.
Applied to both pid1 and systemd-analyze verify.

Fixes #8592.
2018-05-22 12:04:39 +02:00
Zbigniew Jędrzejewski-Szmek 265e9be772 basic/rm-rf: include the path in error messages
Attempted to remove disk file system under "/tmp/systemd-temporary-aWPkbQ", and we can't allow that.
2018-05-22 12:04:39 +02:00
Zbigniew Jędrzejewski-Szmek b49c6ca089 systemd-nspawn: make SettingsMask 64 bit wide
The use of UINT64_C() in the SettingsMask enum definition is misleading:
it does not mean that individual fields have this width. E.g., with
enum {
   FOO = UINT64_C(1)
}
sizeof(FOO) gives 4. It only means that the shift is done properly. So
1 << 35 is undefined, but UINT64_C(1) << 35 is the expected 64 bit
constant. Thus, the use UINT64_C() is useful, because we know that the shifts
are done properly, no matter what the value of _RLIMIT_MAX is, but when those
fields are used in expressions, we don't know what size they will be
(probably 4). Let's add a define which "hides" the enum definition behind a
define which gives the same value but is actually 64 bit. I think this is a
nicer solution than requiring all users to cast SETTING_RLIMIT_FIRST before
use.

Fixes #9035.
2018-05-22 10:51:49 +02:00
Zbigniew Jędrzejewski-Szmek 9b505bc257 sd-resolve: remove misleading casts
As shown in previous commit, UINT64_C() has no effect here, the field can still
be smaller. Remove it.
2018-05-22 10:09:55 +02:00
Zbigniew Jędrzejewski-Szmek 994282d2de test-sizeof: show that a small 64 field is not enough to force the enum to be 64 bits
On both 32 and 64 bits, the result is:
enum Enum → 32 bits, unsigned
enum BigEnum → 32 bits, unsigned
enum BigEnum2 → 64 bits, unsigned
big_enum2_pos → 4
big_enum2_neg → 8

The last two lines show that even if the enum is 64 bit, and the field of an
enum is defined with UINT64_C(), the field can still be smaller.
2018-05-22 10:09:07 +02:00
Zbigniew Jędrzejewski-Szmek 930362ab26 man: fix typo in man page citation
Fixes #9045.
2018-05-21 11:06:32 +09:00
Zbigniew Jędrzejewski-Szmek 509ad7897c core/job: shortening
Follow-up for a7a7163df7.
2018-05-20 23:25:04 +09:00
Yu Watanabe 0297f67e7a
Merge pull request #9036 from keszybz/rpm-macro-cleanup
rpm macro cleanup
2018-05-20 23:20:24 +09:00
Zbigniew Jędrzejewski-Szmek 424e80b4b7 rpm: add macros for common configuration dirs
%_environmnentdir /usr/lib/environment.d
%_modulesloaddir /usr/lib/modules-load.d
%_modprobedir /usr/lib/modprobe.d

This makes installing files there more convenient because people don't need to
construct the path from %_prefix/lib/… .

See https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/GBF5WJLTQVSXMHGYGBF3723ZYCWFBR7C/.
2018-05-19 17:02:59 +02:00
Lennart Poettering 6982156044 fs-util: don't alter errno in unlink_tempfilep()
Functions whose only purpose is to be used with _cleanup_() should not
touch errno, so that failing removals do not alter errno at unexpected
places.

This is already done in unlink_and_freep(), rmdir_and_freep(),
rm_rf_physical_and_freep(), hence do so for unlink_tempfilep(), too.

Follow-up for #9013
2018-05-19 15:50:02 +02:00
Evegeny Vereshchagin 2f09974f34 meson: use run_target for generating tags with ctags
In https://github.com/systemd/systemd/pull/6561, `run_target`
was changed to `custom_target`, which inadvertently caused
relative paths to be passed to ctags due to
https://github.com/mesonbuild/meson/issues/3589.
The switch to `run_target` causes absolute paths to be
passed again and makes it easier to jump from file to
file, hopefully delaying the need to exit Vim :-)
2018-05-19 15:32:47 +02:00
Lennart Poettering 4aab839c90 sd-resolve: tweak error assignment code a bit, use abs() and regular functions
Let's tweak the assignment of errors a bit, and automatically abs()
errnos, similar to how log_error_errno() and friends does it.

Macros are fine to use, but regular functions usually preferable if
there's no reason to use macros, because they avoid multiple evaluation
and suchlike. Hence, let's just use a regular funciton for assigning
errors, instead of macros.

Follow-up for #8993
2018-05-19 15:14:18 +02:00
Zbigniew Jędrzejewski-Szmek 030caa6501 rpm: simplify redirects to /dev/null 2018-05-19 13:04:57 +02:00
Zbigniew Jędrzejewski-Szmek 28d36da64a rpm: remove confusing --user before --global
Fixes #9027.
2018-05-19 13:04:57 +02: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