Commit graph

30133 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek dab9698e1d Merge pull request #6919 from poettering/ebpf-followup
Some minor follow-ups for the ebpf/cgroup PR
2017-09-27 11:23:02 +02:00
Zbigniew Jędrzejewski-Szmek f30574144d Merge pull request #6915 from poettering/log-execute
make execute.c logging a bit less special
2017-09-27 11:16:24 +02:00
Lennart Poettering 88b013b26d udev: proc_cmdline_get_key() FTW! (#6925)
Let's use proc_cmdline_get_key() instead of some strstr() logic to find
a kernel command line key. Using strstr() gets confused by similarly
named keys, and we should reuse our own code as much as we can anyway...

Fixes: #6330
2017-09-27 09:25:25 +02:00
Lennart Poettering 6722da79f2 catalog: split out the one German language entry we have in systemd.catalog into its own file
All other languages have their own file, let's make sure German does
too.
2017-09-26 23:51:28 +02:00
Lennart Poettering 173f30eb6f catalog: add two recent message ID additions to catalog
Just brief texts for now, so that we have something

(And in the long rung we should beef all this up, and add a test that
every ID listed in sd-messages.h is accompanied by a matching catalog
entry)
2017-09-26 23:51:15 +02:00
Lennart Poettering 655aab2056 run: also show IP traffic accounting data on "systemd-run --wait"
If we collect we should show it.
2017-09-26 23:51:14 +02:00
Lennart Poettering 4fe66c8681 core: improve dbus-cgroup error message
As suggested by @keszybz in the review of #6764
2017-09-26 23:49:40 +02:00
Zbigniew Jędrzejewski-Szmek 9782c78794 Merge pull request #6912 from poettering/mount-kill-control
mount unit state engine fixes
2017-09-26 22:38:02 +02:00
Alan Jenkins 0d18f808a4 Revert "units: don't kill the emergency shell when sysinit.target is triggered (#6765)" (#6904)
This reverts commit f1e24a259c.  Oops.

# systemctl emergency
Failed to start emergency.target: Transaction order is cyclic. See syste...
See system logs and 'systemctl status emergency.target' for details.
# systemctl status emergency.target
● emergency.target - Emergency Mode
   Loaded: loaded (/usr/lib/systemd/system/emergency.target; static; vendor preset: disabled)
   Active: inactive (dead) since Mon 2017-09-25 10:43:02 BST; 2h 42min ago
     Docs: man:systemd.special(7)

systemd[1]: sysinit.target: Found dependency on sysinit.target/stop
sysinit.target: Unable to break cycle starting with sysinit.target/stop
network.target: Found ordering cycle on wpa_supplicant.service/stop
network.target: Found dependency on sysinit.target/stop
network.target: Found dependency on emergency.target/start
network.target: Found dependency on emergency.service/start
network.target: Found dependency on serial-getty@ttyS0.service/stop
network.target: Found dependency on systemd-user-sessions.service/stop
network.target: Found dependency on network.target/stop
network.target: Unable to break cycle starting with network.target/stop


IMO #6509 is ugly enough that we should aim to answer it.  But it could
take some time to investigate, so let's re-open the issue as a first step.
2017-09-26 19:47:50 +02:00
Lennart Poettering dc4a5b4b06 Merge pull request #6902 from keszybz/two-property-printing-fixes
Two property printing fixes
2017-09-26 18:09:23 +02:00
Lennart Poettering 81f84b33da update TODO 2017-09-26 18:00:38 +02:00
Lennart Poettering 40a80078d2 execute: let's close glibc syslog channels too
Just in case something opened them, let's make sure glibc invalidates
them too.

Thankfully so far no library opened log channels behind our back, at
least as far as I know, hence this is actually a NOP, but let's better
be safe than sorry.
2017-09-26 17:52:25 +02:00
Lennart Poettering 12145637e9 execute: normalize logging in execute.c
Now that logging can implicitly reopen the log streams when needed we
can log errors without any special magic, hence let's normalize things,
and log the same way we do everywhere else.
2017-09-26 17:51:22 +02:00
Lennart Poettering 86ffb32560 execute: drop explicit log_open()/log_close() now that it is unnecessary 2017-09-26 17:46:34 +02:00
Lennart Poettering 2c027c62dd execute: make use of the new logging mode in execute.c 2017-09-26 17:46:34 +02:00
Lennart Poettering 16e4fd87c5 log: add a mode where we open the log fds for every single log message
This we can then make use in execute.c to make error logging a bit less
special when preparing for process execution, as we can still log but
don't have any fds open continously.
2017-09-26 17:46:33 +02:00
Lennart Poettering 7558e10c98 log: let's make use of the fact that our functions return the negative error code for log_oom() too 2017-09-26 17:46:33 +02:00
Lennart Poettering 82677ae4c7 execute: downgrade a log message ERR → WARNING, since we proceed ignoring its result 2017-09-26 17:46:33 +02:00
Lennart Poettering 8002fb9747 execute: rework logging in setup_keyring() to include unit info
Let's use log_unit_error() instead of log_error() everywhere (and
friends).
2017-09-26 17:46:33 +02:00
Lennart Poettering dedf371909 swap: introduce SWAP_STATE_WITH_PROCESS() similar to MOUNT_STATE_WITH_PROCESS() 2017-09-26 16:17:22 +02:00
Lennart Poettering 50864457e1 swap: adjust swap.c in a similar way to what we just did to mount.c
Also drop the redundant states and make all similar changes too.
Thankfully the swap.c state engine is much simpler than mount.c's, hence
this should be easier to digest.
2017-09-26 16:17:22 +02:00
Lennart Poettering c634f3d2fc mount: rename mount_state_active() → MOUNT_STATE_WITH_PROCESS()
The function returns true for all states that have a control process
running, and each time we call it that's what we want to know, hence
let's rename it accordingly. Moreover, the more generic unit states have
an ACTIVE state, and it is defined quite differently from the set of
states this function returns true for, hence let's avoid confusion and
not reuse the word "ACTIVE" here in a different context.

Finally, let's uppercase this, since in most ways it's pretty much
identical to a macro
2017-09-26 16:17:22 +02:00
Lennart Poettering 22af0e5873 mount: rework mount state engine
This changes the mount unit state engine in the following ways:

1. The MOUNT_MOUNTING_SIGTERM and MOUNT_MOUNTING_SIGKILL are removed.
   They have been pretty much equivalent to MOUNT_UNMOUNTING_SIGTERM and
   MOUNT_UNMOUNTING_SIGKILL in what they do, and the outcome has been
   the same as well: the unit is stopped. Hence, let's simplify things a
   bit, and merge them. Note that we keep
   MOUNT_REMOUNTING_{SIGTERM|SIGKILL} however, as those states have a
   different outcome: the unit remains started.

2. mount_enter_signal() will now honour the SendSIGKILL= option of the
   mount unit if it was set. This was previously done already when we
   entered the signal states through a timeout, and was simply missing
   here.

3. A new helper function mount_enter_dead_or_mounted() is added that
   places the mount unit in either MOUNT_DEAD or MOUNT_MOUNTED,
   depending on what the kernel thinks about the mount's state. This
   function is called at various places now, wherever we finished an
   operation, and want to make sure our own state reflects again what
   the kernel thinks. Previously we had very similar code in a number of
   places and in other places didn't recheck the kernel state. Let's do
   that with the same logic and function at all relevant places now.

4. Rework mount_stop(): never forget about running control processes.
   Instead: when we have a start (i.e. a /bin/mount) process running,
   and are asked to stop, then enter the kill states for it, so that it
   gets cleaned up. This fixes #6048. Moreover, when we have a reload
   process running convert the possible states into the relevant
   unmounting states, so that we can properly execute the requested
   operation.

Fixes #6048
2017-09-26 16:17:22 +02:00
Lennart Poettering 850b741084 mount: clean up reload_result management a bit
Let's only collect the first failure in the load result, and let's clear
it explicitly when we are about to enter a new reload operation. This
makes it more alike the handling of the main result value (which also
only stores the first failure), and also the handling of service.c's
reload state.
2017-09-26 16:17:22 +02:00
Lennart Poettering a6951a5079 service: rework service_kill_control_processes()
Let's make sure we explicitly also kill any control process we know of,
given that it might have moved outside of our control group.
2017-09-26 16:17:22 +02:00
Lennart Poettering ca543871b7 set: add new helper set_make() which is like set_new() + multiple set_put() in vararg 2017-09-26 16:17:22 +02:00
Jan Synacek 0cde65e263 test-cpu-set-util.c: fix typo in comment (#6916) 2017-09-26 16:07:34 +02:00
Zbigniew Jędrzejewski-Szmek 4005677730 basic/log: fix return value from log_struct_iovec_internal()
This returned value so far wasn't used anywhere, so there's no change
in behaviour.
2017-09-26 16:04:33 +02:00
Lennart Poettering 2ebc688fc1 Merge pull request #6917 from keszybz/restore-some-tests
Restore some tests
2017-09-26 16:00:28 +02:00
Jan Synacek efd0802231 test-cpu-set-util.c: fix typo in comment (#6916) 2017-09-26 13:50:31 +02:00
Zbigniew Jędrzejewski-Szmek fdf666bc76 meson: hook up hwdb-test.sh again
The motivation for the ./systemd-hwdb is the same as in the grandparent
for systemd-sysv-generator.
2017-09-26 13:44:38 +02:00
Zbigniew Jędrzejewski-Szmek b7191b2a9b meson: hook up udev-test.pl again
Seems it was dropped along with the automake rules in
72cdb3e783.
2017-09-26 13:44:38 +02:00
Zbigniew Jędrzejewski-Szmek 73e406e140 sysv-generator-test: do not query $builddir
This variable is not set by meson, so let's not try to use it.

We could use some more elaborate scheme (e.g. based on $MESON_BUILD_ROOT and
$MESON_SUBDIR) to find the path to systemd-sysv-generator, but it seems
that plain ./systemd-sysv-generator works just as well and has the advantage
that it's easy to invoke the test by hand (as long as one cd's to the
meson build dir).
2017-09-26 13:44:38 +02:00
Zbigniew Jędrzejewski-Szmek a4b57b322e sysv-generator-test: drop python2 work-around
We require python3 for meson anyway, so support python2 doesn't seem
useful anymore.
2017-09-26 13:44:38 +02:00
Lennart Poettering f39c13e093 journal-verfiy: add a couple of missing le64toh() calls (#6888)
Apparently BE users don't verify their journals...

Noticed as result of #6887
2017-09-25 22:26:10 +02:00
Jonathan Lebon 35207e259e string-util: use size_t for strjoina macro (#6914)
`strlen` returns a `size_t` and `alloca` expects a `size_t`.
2017-09-25 21:56:57 +02:00
Zbigniew Jędrzejewski-Szmek 3594f80144 install: drop left-over debug message (#6913) 2017-09-25 19:59:49 +02:00
Zbigniew Jędrzejewski-Szmek c533658a1c shared/bus-util: format uid==-1 and gid==-1 as [not set]
$ systemctl show systemd-journald -p UID,GID
UID=4294967295
GID=4294967295

↓

$ systemctl show systemd-journald -p UID,GID
UID=[not set]
GID=[not set]

Just seeing the number is very misleading.

Fixes #6511.
2017-09-25 11:23:59 +02:00
Zbigniew Jędrzejewski-Szmek 6088cefb21 basic/cap-list: report empty capability set as ""
$ systemctl show systemd-journald -p CapabilityBoundingSet,AmbientCapabilities
CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_setgid ...
AmbientCapabilities=(null)

↓

$ systemctl show systemd-journald -p CapabilityBoundingSet,AmbientCapabilities
CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_setgid ...
AmbientCapabilities=

Partially fixes #6511. Add some basic tests for the printing function.
2017-09-25 11:11:20 +02:00
Zbigniew Jędrzejewski-Szmek efaa3176ad Merge pull request #6893 from poettering/cgroup-delegate-yay
cgroup delegation fixes, as well as socket unit slice assignment
2017-09-24 20:53:04 +02:00
Zbigniew Jędrzejewski-Szmek a2deeb41f6 Merge pull request #6891 from poettering/read-line
add read_line() helper as bounded getline() and make use of it at some places
2017-09-24 20:51:01 +02:00
Lennart Poettering cddaa1f034 Merge pull request #6887 from rantala/6447
journal: add object sanity check to journal_file_move_to_object() (#6447)
2017-09-24 19:52:07 +02:00
Zbigniew Jędrzejewski-Szmek 2e33df93de fileio: return 0 from read_one_line_file on success
Fixup for f4b51a2d09. Suggested by Evgeny Vereshchagin.
2017-09-24 14:27:21 +02:00
Tommi Rantala 10e8445bcc journal: add missing le64toh() calls in journal_file_check_object()
Lennart Poettering noticed missing le64toh() calls.
2017-09-24 11:56:52 +03:00
Zbigniew Jędrzejewski-Szmek 2c9de13912 test-fileio: also test read_line() with actual files
Just in case the real FILE and the one from fmemopen weren't exactly
the same.
2017-09-24 10:50:27 +02:00
Zbigniew Jędrzejewski-Szmek 9707d55213 test-fileio: close two leaked file handles 2017-09-24 10:50:27 +02:00
Zbigniew Jędrzejewski-Szmek 1b7ac91f94 man: add missing verb in timedatectl(1) (#6896)
As noted by Michael Biebl.
2017-09-23 16:51:41 +02:00
Zbigniew Jędrzejewski-Szmek b6e386ca1c Merge pull request #6894 from poettering/read-full-file-optimize
fileio: various fixes
2017-09-23 13:31:02 +02:00
Lennart Poettering b887cfa652 Merge pull request #6892 from keszybz/enablement-work
Fix various issues with enabled/disabled units
2017-09-23 12:44:49 +02:00
Zbigniew Jędrzejewski-Szmek 8f313f4feb test-conf-parser: add tests for the new long lines, including overflow handling 2017-09-23 11:08:57 +02:00