Commit Graph

46937 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 094c6fc338
Merge pull request #17031 from poettering/path-start-limit
core: propagate start limit hit from triggered unit to path unit
2020-09-14 21:51:39 +02:00
Zbigniew Jędrzejewski-Szmek bc2ed3bbf0
Merge pull request #17039 from poettering/dbus-default-dep
tweak when we synthesize dbus deps for service units
2020-09-14 21:45:53 +02:00
Lennart Poettering 60bcb45927 man: rework UMask= explanation
Mention the JSON user record stuff. Mention pam_umask explicitly.
Mention that UMask= of the per-user user@.service instance can be used
too.

Fixes: #16963
2020-09-14 21:44:06 +02:00
Lennart Poettering 2a03b9ed21 tree-wide: don't needlessly negate error number passed to bus_error_message()
Like it's customary in our codebase bus_error_message() internally takes
abs() of the passed error anyway, hence no need to explicitly negate it.
We mostly got this right, but in too many cases we didn't. Fix that.
2020-09-14 21:42:22 +02:00
Lennart Poettering ad0b610b0c bootctl: handle if LoaderSystemToken is invalid for some reason
This points to some firmware issue, but we should still be able to
correct things if this happens. Hence log about this and fix it.

Fixes: #17041
2020-09-14 21:33:31 +02:00
Lennart Poettering 0c94a31464
Merge pull request #17027 from poettering/env-escape-fix
make sure we our env file writer, parser and shell agree on things
2020-09-14 16:48:00 +02:00
Frantisek Sumsal 05827831a6 shared: drop a redundant if statement 2020-09-14 16:18:18 +02:00
Frantisek Sumsal 8d16f29b23 libsystemd: drop a redundant if statement 2020-09-14 16:18:02 +02:00
Frantisek Sumsal 890ea05ac2 home: return SYNTHETIC_ERRNO() when appropriate 2020-09-14 16:16:59 +02:00
Frantisek Sumsal 60d7a2029a basic: drop a redundant if statement 2020-09-14 16:16:18 +02:00
Frantisek Sumsal 973bc32ab6 core: consolidate alloc & put operations into one statement 2020-09-14 16:13:44 +02:00
Frantisek Sumsal 69e3234db7 tree-wide: fix typos found by codespell
Reported by Fossies.org
2020-09-14 15:32:37 +02:00
Lennart Poettering 22f401b269 unit-def: drop pointless 0 initialization of first enum value
This is implied in C and we generally don't bother with this, so don't
bother with this here either.
2020-09-14 13:05:09 +02:00
Lennart Poettering 47ab8f73e3 core: propagate unit start limit hit state to triggering path unit
We already do this for socket and automount units, do it for path units
too: if the triggered service keeps hitting the start limit, then fail
the triggering unit too, so that we don#t busy loop forever.

(Note that this leaves only timer units out in the cold for this kind of
protection, but it shouldn't matter there, as they are naturally
protected against busy loops: they are scheduled by time anyway).

Fixes: #16669
2020-09-14 13:05:09 +02:00
Lennart Poettering 0377cd2936 core: propagate triggered unit in more load states
In 4c2ef32767 we enabled propagating
triggered unit state to the triggering unit for service units in more
load states, so that we don't accidentally stop tracking state
correctly.

Do the same for our other triggering unit states: automounts, paths, and
timers.

Also, make this an assertion rather than a simple test. After all it
should never happen that we get called for half-loaded units or units of
the wrong type. The load routines should already have made this
impossible.
2020-09-14 13:05:09 +02:00
Lennart Poettering df8b14b591 test-fileio: test test strings with shell, too 2020-09-14 12:26:41 +02:00
Lennart Poettering 55f99c26c6 test-env-file: add test that tests our env file read + writer + shell against each other
Should hopefully make regressions on this unlikely.
2020-09-14 12:26:41 +02:00
Lennart Poettering de008e537d env-file: bring our decoding of double-quoted strings in env files in line with shell
In shell, inside of double quotes only a select few chars should be
escaped. If other chars are escaped this has no effect. Correct the list
of chars that need such escaping.

Also, make sure we can read back the stuff we wrote out without loss.

Fixes: #16788
2020-09-14 11:08:43 +02:00
Lennart Poettering 6fe3196350 test-fileio: use test strings that are actually valid in shell 2020-09-14 11:08:43 +02:00
Lennart Poettering a7f49f0b7c service: add implicit dbus deps only for Type=dbus units
We want to be able to use BusName= in services that run during early boot
already, and thus don't synthesize deps on dbus there. Instead add them
when Type=dbus is set, because in that case we actually really need
D-Bus support.

Fixes: #17037
2020-09-14 11:07:30 +02:00
Lennart Poettering 31d74c66e2 core: don't warn if BusName= is used for non-Type=dbus services
It's useful for more than just Type=dbus now, given #16976. Hence, let's
drop the warning.
2020-09-14 11:07:12 +02:00
Lennart Poettering 415f8a5bfe man: document that RemainAfterElapse=no means that also the triggered unit needs to deactivate
Fixes: #16378
2020-09-14 10:17:41 +02:00
Zbigniew Jędrzejewski-Szmek d94bab0805 systemctl: immediately reject invalid log levels
Symbolic names and number in the appropriate range are allowed
(log_level_from_string() DTRT already).

The target names are more messy, so we leave the verification to the service.
2020-09-12 10:22:51 +02:00
Zbigniew Jędrzejewski-Szmek 77db9433a7 systemctl: merge log_target(), log_level(), service_log_setting() 2020-09-12 10:22:51 +02:00
Zbigniew Jędrzejewski-Szmek 6824c132e9 systemctl: add service-log-{level,target} verbs
Heavily inspired by #15622. This adds:
  systemctl service-log-level systemd-resolved
  systemctl service-log-level systemd-resolved info
  systemctl service-log-target systemd-resolved
  systemctl service-log-target systemd-resolved console

We already have systemctl verbs log-level, log-target, and service-watchdogs.
Those two new verbs tie nicely into this scheme.
2020-09-12 10:22:51 +02:00
Zbigniew Jędrzejewski-Szmek 4b6bc95c01
Merge pull request #17009 from poettering/rootprefix-noslash
remove duplicate slashes in systemd-path output if rootprefixdir is "/"
2020-09-12 10:07:40 +02:00
Lennart Poettering ae0b700a85 hashmap: make sure to initialize shared hash key atomically
if we allocate a bunch of hash tables all at the same time, with none
earlier than the other, there's a good chance we'll initialize the
shared hash key multiple times, so that some threads will see a
different shared hash key than others.

Let's fix that, and make sure really everyone sees the same hash key.

Fixes: #17007
2020-09-12 09:33:33 +02:00
Lennart Poettering 35b4e3c1bc socket: downgrade log warnings about inability to set socket buffer sizes
In containers we might lack the privs to up the socket buffers. Let's
not complain so loudly about that. Let's hence downgrade this to debug
logging if it's a permission problem.

(This wasn't an issue before b92f350789
because back then the failures wouldn't be detected at all.)
2020-09-12 08:14:54 +02:00
Lennart Poettering e742ec6abc test-acl-util: skip test if /tmp doesn't do ACLs
Fixes: #17013
2020-09-12 08:12:36 +02:00
Lennart Poettering 95f7ab2fe6 mkosi: include libfido2 in fedora mkosi image
We want to build this image with as many deps turned on as we can make
happen, hence include libfido2 in the image.
2020-09-12 08:10:08 +02:00
Lennart Poettering 0306d1598d
Merge pull request #17028 from poettering/logind-replace-job
logind: make TerminateSession() count
2020-09-11 22:17:41 +02:00
Yu Watanabe 85b6a8110d network: do not add prefix to RA if radv is not configured
Fixes #17017.
2020-09-11 19:28:46 +02:00
Michal Sekletár 882f5f429e cryptsetup: generate the unit to umount keydev filesystem
Previously we would call umount from ExecStartPost= of
systemd-cryptsetup instance in order to get rid of the keydev
mount (i.e. filesystem containing keyfile). Let's generate unit to
handle umount. Making this symmetrical (both mount and umount of keydev
are handled by units) fixes the problem with lingering keydev mounts.

Motivation for the change is the issue where keydev mount would stay
around even if device was successfully unlocked and mount is no longer
needed. That could happen previously because when generator options are
not prefixed with "rd." we run generators twice (e.g. rd.luks.key=...).

In such case disk is unlocked in initramfs phase of boot (assuming the
initrd image contains the generator and is able to handle unlocking of
LUKS devices). After switchroot we however enqueue start job for
systemd-cryptsetup instance (because units are regenerated second time)
and that pulls in its dependencies into transaction. Later the main
systemd-cryptsetup unit not actually started since it is already active
and has RemainaAfterExit=yes. Nevertheless, dependencies get activated
and keydev mount is attached again. Because previously we called umount
from ExecStartPost= of systemd-cryptsetup instance the umount is not
called second time and keydev filesystem stays lingering.
2020-09-11 19:20:28 +02:00
Lennart Poettering 1a42ce0920 logind: make sure when we are explicitly asked to terminate session/user/seat to use "replace" job mode
Otherwise our request will possibly fail if something else is already
enqeued, but given this is an explicit user request, let's not allow
things to fail.

Fixes: #16702
2020-09-11 18:09:34 +02:00
Lennart Poettering bda625730d logind: clarify what the second argument of session_stop() means when calling it 2020-09-11 18:09:30 +02:00
Lennart Poettering 40771cf524 logind: minor simplification 2020-09-11 18:09:11 +02:00
Nazar Vinnichuk 5501da15ba man: document the random delay of persistent timers
The manual states that a persistent timer triggers it's service
immediately on activation to catch up with missed invocations, but since
PR #11608 it is no longer the case if RandomizedDelaySec= is set to a
non-zero value.
2020-09-11 18:08:40 +02:00
Yu Watanabe 766f8f388f test-network: add test for ENOBUFS issue #17012
The issue seems already fixed by PR #16982 and its follow-up commit
4934ba2121.
2020-09-11 18:07:47 +02:00
Lennart Poettering e67b818c2f unit: declare BusName= in all our units that are on the bus, event if they don't use Type=dbus
This information is always useful, so let's always declare it,
particular in the light of #16976.
2020-09-11 16:01:22 +02:00
Lennart Poettering f7c87baeca
Merge pull request #17020 from yuwata/backlight
backlight: validate sysattr value
2020-09-11 14:23:47 +02:00
Lennart Poettering 2ac4d1d45b hostnamed: add various debugging log messages when we determine chassis type
No actual code flow changes, just a bunch of debug messages.
2020-09-11 13:14:05 +02:00
Lennart Poettering 965cccae8b
Merge pull request #17005 from poettering/sockopt-ipv4-ipv6
rework how we call per-ipv4/per-ipv6 sockopts that conceptually exist on both
2020-09-11 13:13:41 +02:00
Lennart Poettering 6e65df89c3 pkg-config: prefix is not really configurable, don't pretend it was
We generally don't support prefix being != /usr, and this is hardcoded
all over the place. In the systemd.pc file it wasn't so far. Let's
adjust this to match the rest of the codebase.
2020-09-11 13:09:06 +02:00
Lennart Poettering b612c26ceb sd-path: use ROOTPREFIX without suffixed slash
We already have rootprefix_noslash as meson variable, export it so that
we can also use it in C code.

Fixes: #16773
2020-09-11 13:08:30 +02:00
Yu Watanabe 3bacb7e73b backlight: validate read sysattr value
If actual_brightness is larger than max_brightness, then fall back to
use brightness attribute.

Also, if the saved value is invalid, then this makes remove the file in
/var/lib/systemd/backlight.

Hopefully fixes #17011.
2020-09-11 17:46:11 +09:00
Yu Watanabe 06d98bdc81 backlight: do not claim that ID_BACKLIGHT_CLAMP= property is not set 2020-09-11 17:44:20 +09:00
Yu Watanabe ea2bc25762 sd-device: introduce sd_device_set_sysattr_valuef() 2020-09-11 17:41:10 +09:00
Lennart Poettering c6a7924513 man: always document both the ipv4 and the ipv6 sockopt 2020-09-11 10:33:13 +02:00
Lennart Poettering 5d0fe4233b tree-wide: add helper for IPv4/IPv6 sockopts
A variety of sockopts exist both for IPv4 and IPv6 but require a
different pair of sockopt level/option number. Let's add helpers for
these that internally determine the right sockopt to call.

This should shorten code that generically wants to support both ipv4 +
ipv6 and for the first time adds correct support for some cases where we
only called the ipv4 versions, and not the ipv6 options.
2020-09-11 10:33:13 +02:00
Lennart Poettering 00df39a56a timesyncd: don't attempt to call IP_TOS sockopt on IPv6 sockets 2020-09-11 10:16:39 +02:00