Zbigniew Jędrzejewski-Szmek [Fri, 7 May 2021 11:24:03 +0000 (13:24 +0200)]
modules-load: inline interator variable
Lennart Poettering [Wed, 5 May 2021 16:57:30 +0000 (18:57 +0200)]
nss-systemd: properly handle empty membership lists
When we are queried for membership lists on a system that has exactly
zero, then we'll return ESRCH immediately instead of at EOF. Which is
OK, but we need to handle this in various places, and not get confused
by it.
(cherry picked from commit
a1aa41e4e175c2712b97600d7e10e9d6c58e5543)
Lennart Poettering [Wed, 5 May 2021 14:05:43 +0000 (16:05 +0200)]
nss-systemd: reset the right field
(cherry picked from commit
1fdfca4da739f47516513afc66d4c7008c9badfd)
Mike Kazantsev [Thu, 6 May 2021 14:15:04 +0000 (19:15 +0500)]
Fix indent prefix being used as a suffix in systemd-analyze dump for some properties
(cherry picked from commit
a7bd1656f3ee3d43126c50e4baad9da77620022e)
Lennart Poettering [Mon, 3 May 2021 18:06:15 +0000 (20:06 +0200)]
userdb: honour USERDB_AVOID_SHADOW flag also when iterating
(cherry picked from commit
7c67419117f19a85cf3e7e1513c072be2b767a74)
Lennart Poettering [Fri, 30 Apr 2021 21:09:35 +0000 (23:09 +0200)]
userdb: add missing 'else'
(cherry picked from commit
d4f560df4f75d8bc5816a515c000f62cb796fa9f)
Lennart Poettering [Fri, 30 Apr 2021 21:08:55 +0000 (23:08 +0200)]
userdb: remove unnecesary repeated if check
(cherry picked from commit
77fe7d15931cc17c933ae8778c4161112783dc79)
Lennart Poettering [Fri, 30 Apr 2021 21:08:21 +0000 (23:08 +0200)]
userdb: count NSS records too
(cherry picked from commit
27a5a22f0354568e1c7e6292689ad947aa16aaac)
Anita Zhang [Fri, 26 Mar 2021 09:37:01 +0000 (02:37 -0700)]
oomd: threshold swap kill candidates to usages of more than 5%
In some instances, particularly with swap on zram, swap used will be high
while there is still a lot of memory available. FB OOMD handles this by
thresholding kills to X% of total swap usage. Let's do the same thing here.
Anecdotally with these thresholds and my laptop which is exclusively swap
on zram I can sit at 0K / 4G swap free with most of memory free and
systemd-oomd doesn't kill anything.
Partially addresses aggressive kill behavior from
https://bugzilla.redhat.com/show_bug.cgi?id=
1941170
(cherry picked from commit
685b0985f0faeb349d1449f8e9d87a9c87e1e24f)
Anita Zhang [Fri, 26 Mar 2021 08:53:15 +0000 (01:53 -0700)]
oomd: don't get pressure candidates on every interval
Only start collecting candidates for a memory pressure kill when we're
hitting the limit (but before the duration hitting that limit is
exceeded). This brings CPU util from ~1% to 0.3%.
Addresses CPU util from
https://bugzilla.redhat.com/show_bug.cgi?id=
1941340
and
https://bugzilla.redhat.com/show_bug.cgi?id=
1944646
(cherry picked from commit
cb13961ada52c1b27f6d6c2c6e37a2901f01ed30)
Anita Zhang [Fri, 26 Mar 2021 08:19:10 +0000 (01:19 -0700)]
oomd: force DefaultMemoryPressureDurationSec= to be greater than or equal 1 sec
(cherry picked from commit
a858355e4a7168625ec1b9e5d17fdb6a11dfecb8)
Anita Zhang [Fri, 26 Mar 2021 07:54:46 +0000 (00:54 -0700)]
oomd: delete unused variables
(cherry picked from commit
14140b35440306d2fc1f564b8a24aed0d65e44ba)
Anita Zhang [Sat, 27 Mar 2021 09:02:00 +0000 (02:02 -0700)]
oomd: rename last_hit_mem_pressure_limit -> mem_pressure_limit_hit_start
Since this is only changed the first time the limit is hit (and remains
set as long as the pressure remains over), I changed the name to better
reflect that.
Keeps consistent with "last_had_mem_reclaim" which is actually updated
every time there is reclaim activity.
(cherry picked from commit
69c8f0255a0a8127548907028bef09ea66056f9f)
Anita Zhang [Fri, 26 Mar 2021 07:39:25 +0000 (00:39 -0700)]
oomd: rework memory reclaim detection logic
systemd-oomd only monitors and kills within a selected cgroup subtree
For memory pressure kills, this means it's unnecessary to get the
pgscan rate across all the monitored memory pressure cgroups.
The increase will show up whether we do a total sum or not, but since
we only care about the increase in the subtree we're about to target
for a kill, we can simplify the code a bit by not doing this total sum.
(cherry picked from commit
df637ede7b4e1d0faf8d620d626a0af230712a9e)
Anita Zhang [Fri, 26 Mar 2021 06:54:22 +0000 (23:54 -0700)]
oomd: refactor pgscan_rate calculation into helper
(cherry picked from commit
37d8020ccc2f54260b581af416e02294c7591cfc)
Anita Zhang [Wed, 24 Mar 2021 09:17:04 +0000 (02:17 -0700)]
oomd: split swap and mem pressure event timers
One thing that came out of the test week is that systoomd needs to poll
more frequently so as not to race with the kernel oom killer in
situations where memory is eaten quickly. Memory pressure counters are
lagging so it isn't worthwhile to change the current read rate; however swap
is not lagging and can be checked more frequently.
So let's split these into 2 different timer events. As a result, swap
now also doesn't have to be subject to the post-action (post-kill) delay
that we need for memory pressure events.
Addresses some of slowness to kill discussed in
https://bugzilla.redhat.com/show_bug.cgi?id=
1941340
(cherry picked from commit
81d66fab342e112aefe8b5f43bc853ef66c92add)
Lennart Poettering [Wed, 24 Mar 2021 12:45:25 +0000 (13:45 +0100)]
test: add explicit test for bind_remount_one_with_mountinfo()
(cherry picked from commit
67d22a366567df874352099ff38083ffb3024d72)
Lennart Poettering [Wed, 24 Mar 2021 12:44:56 +0000 (13:44 +0100)]
test: add test for bind_remount_recursive()
(cherry picked from commit
10cdbb8372238337e0789fc4fc40949f55caddb6)
Lennart Poettering [Wed, 24 Mar 2021 13:19:04 +0000 (14:19 +0100)]
mount-util: generate failure if bind_remount_one_with_mountinfo() is called on non-existing path
(cherry picked from commit
0338df47cfaeb023c7c2eaf6b698060fd133157b)
Lennart Poettering [Wed, 24 Mar 2021 13:17:20 +0000 (14:17 +0100)]
mount-util: handle remount failures gracefully if flags already match
In bind_remount_one_with_mountinfo() let's handle mount failures
gracefully if the flags already match anyway. This isn't perfect, since
it mixes up superblock and mount point flags, but it's close enough.
(cherry picked from commit
b23c6a6411fd58ac281642bcae915a7ea55db5c7)
Lennart Poettering [Wed, 24 Mar 2021 13:16:45 +0000 (14:16 +0100)]
mount-util: fold what we need from get_mount_flags() bind_remount_one_with_mountinfo()
And get rid of get_mount_flags() altogether.
(This drops the statvfs() fallback that get_mount_flags() did. That
fallback was incomplete however, and mostly hid errors. Our primary
avenue to get mount flags is /proc/self/mountinfo and we should trust
it, and fix bugs we might encounter with it, but not tape over it.
Dropping the fallback is relevant in particular as it actually returned
mount flags for any path, not just mount points, which was very icky.)
(cherry picked from commit
2c5ff8ea76d8c3c9944567ae97f498925dfcd443)
Lennart Poettering [Wed, 24 Mar 2021 13:07:32 +0000 (14:07 +0100)]
mount-util: store mount flags in "todo" list in + handle submounts gracefully
This replaces the "todo" set with a "todo" hash map that stores the
mount flags we found. This makes an explicit call to get_mount_flags()
unncessary, since we have the flags handy right-away, and lowers our
work from O(n^2) to O(n). Nice!
The "done" set is also improved slightly: we'll use more modern ways to
allocate it, via set_ensure_consume(), and freeing-via-hash_ops.
Finally, failures on submount remounts are now handled gracefully,
there are just too many reasons why they might fail, given NFS, autofs,
FUSE which weird access controls, where even root might lack the privs
to do something.
Fixes: #16156
(cherry picked from commit
ba8dced2a60d8535bf6d685e2fd164e5ff3f056b)
Lennart Poettering [Wed, 24 Mar 2021 13:06:22 +0000 (14:06 +0100)]
mount-util: extend comment a bit, mention that we aren't atomic in behaviour
(cherry picked from commit
4b6ef52756ce1be1bd365c2bb63ad4f0c895c1a5)
Lennart Poettering [Wed, 24 Mar 2021 13:02:29 +0000 (14:02 +0100)]
mount-util: shortcut things after generating top-level bind mount
Instead of marking the bind mount read-only right-away, let's just
restart the loop, so that we'll pick it up like any other mount and then
remount like that.
(cherry picked from commit
5c5753b9ea5cc012586ae90d357d460dec4301a4)
Lennart Poettering [Wed, 24 Mar 2021 12:56:55 +0000 (13:56 +0100)]
mount-util: reorder a few things
Let's always query one property, check it, and then query the next,
preferring "cheap" ones over "slow" ones (i.e. cheap are the ones we can
check directly, and slow are the ones we need to check with some loop of
some kind).
(cherry picked from commit
d6bfab118d2e7c4c07566718175f4f7ec7a2387b)
Lennart Poettering [Wed, 24 Mar 2021 12:49:06 +0000 (13:49 +0100)]
path: drop simplification of path in bind_remount_recursive_with_mountinfo()
We only use path-aware comparisons and hashops, hence no need to
simplify, we can use the path as it is.
(cherry picked from commit
c6111b85f77fa6207c0ac50a99cf5d05c2aa33c9)
Lennart Poettering [Wed, 24 Mar 2021 12:47:17 +0000 (13:47 +0100)]
mount-until: make sure we'll exit bind_remount_recursive_with_mountinfo() loop eventually
Just some robustness given that /proc/self/mountinfo was previously
broken in the kernel.
(cherry picked from commit
670e8efd6083bfef6186d33fa3b7dc90810d14ca)
Lennart Poettering [Tue, 23 Mar 2021 21:28:16 +0000 (22:28 +0100)]
mountpoint-util: rebreak some comments
(cherry picked from commit
9d0619dee729b9b481efa512295cf70cb5887fe1)
Lennart Poettering [Tue, 23 Mar 2021 21:26:06 +0000 (22:26 +0100)]
mountpoint-util: a symlink is never a mount point
The various flavours of stat() basically tell us for free if something
is a symlink. If it is, then it's definitely not a mount point. Use
that.
All other inode types can be mount point, just symlinks cannot.
(cherry picked from commit
b898474fecda9e39aa06512ef7ba358c9685d84e)
Yu Watanabe [Wed, 5 May 2021 18:47:58 +0000 (03:47 +0900)]
test: drop log_trace() in test-random-util
It provides almost no inoformation. Moreover, it massively increases
logs, and firefox cannot show the results of Ubuntu CIs due to this.
(cherry picked from commit
3d396b2837445cf2fbe00c12aed2d9967d9e9d23)
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 15:02:49 +0000 (17:02 +0200)]
sd-device: reject empty driver name
If ":" was the last char in the string, we would call access() on ".../drivers/", which
would pass. It probably doesn't matter, but let's reject this anyway.
(cherry picked from commit
52a89a5f08230439f07c043d59ded1270842137b)
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 14:57:39 +0000 (16:57 +0200)]
sd-device: use memdupa_suffix0() where appropriate
No functional change intended.
(cherry picked from commit
3e2d0c6ab2abc0ab85440580931b2462bb73cfda)
Yu Watanabe [Sun, 7 Mar 2021 06:24:15 +0000 (15:24 +0900)]
sd-device: minor optimization for sd_device_new_from_device_id()
(cherry picked from commit
ff7a8d2938b24cb7ca7b69900395ecf837a43a23)
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 14:49:41 +0000 (16:49 +0200)]
sd-device: do no allocate strings of unknown length on the stack
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33881.
Not only we would duplicate unknown input on the stack, we would do it
over and over. So let's first check that the input has reasonable length,
but also allocate just one fixed size buffer.
(cherry picked from commit
e17c95af8e450caacde692875b30675cea75211f)
наб [Fri, 16 Apr 2021 11:00:37 +0000 (13:00 +0200)]
meson: don't fail if latest tag's commit is signed
Today this is v248 with
938bdfc0fa737d86eb3ecc70506e11e5f740e0dc, which,
if you don't know about the github webflow key fails to configure with
meson.build:724:8: ERROR: String "gpg: Signature made Tue 30 Mar 2021 22:59:02 CEST\ngpg: using RSA key
4AEE18F83AFDEB23\ngpg: Can't check signature: No public key\n1617137942\n" cannot be converted to int
or, if you do, with
meson.build:724:8: ERROR: String 'gpg: Signature made Tue 30 Mar 2021 22:59:02 CEST\ngpg: using RSA key
4AEE18F83AFDEB23\ngpg: Good signature from "GitHub (web-flow commit signing) <noreply@github.com>" [unknown]\ngpg: WARNING: This key is not certified with a trusted signature!\ngpg: There is no indication that the signature belongs to the owner.\nPrimary key fingerprint: 5DE3 E050 9C47 EA3C F04A 42D3 4AEE 18F8 3AFD EB23\n1617137942\n' cannot be converted to int
(cherry picked from commit
2d945027244c02fab8d388353f034a2d82ca151b)
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 08:52:30 +0000 (10:52 +0200)]
core: remove spurious % in dump string
(cherry picked from commit
0f6bb1ed05ceba91d8529c74379613ec9ebf50dc)
Ryan Hendrickson [Fri, 30 Apr 2021 16:47:10 +0000 (12:47 -0400)]
core: apply LogLevelMax to messages about units
This commit applies the filtering imposed by LogLevelMax on a unit's
processes to messages logged by PID1 about the unit as well.
The target use case for this feature is a service that runs on a timer
many times an hour, where the system administrator decides that writing
a generic success message to the journal every few minutes or seconds
adds no diagnostic value and isn't worth the clutter or disk I/O.
(cherry picked from commit
c2503e359a3a03b73acce0a92d27b1b8f54ff92c)
Yu Watanabe [Thu, 29 Apr 2021 22:00:45 +0000 (07:00 +0900)]
network: can: do not warn if link does not exist anymore
(cherry picked from commit
ed52cce33f588bbeb3d7f5d7f5e76a85cf6e4f89)
Yu Watanabe [Thu, 29 Apr 2021 21:57:15 +0000 (06:57 +0900)]
network: drop duplicated link_up_can()
(cherry picked from commit
f282ce20aaa767f5395b065f2be587cdef3e5491)
Yu Watanabe [Thu, 29 Apr 2021 19:00:02 +0000 (04:00 +0900)]
sd-bus: fix vtable named argument logic
Fixes #19468.
(cherry picked from commit
c068a17f6a18d3ebfabe88fc49e24a923d0bdd0a)
Steve Bonds [Thu, 25 Mar 2021 14:40:39 +0000 (07:40 -0700)]
Clarify that these values are in bytes
Similar to `ProcessSizeMax`. The defaults in percentages can be misunderstood to mean the values for these parameters will be in percentages.
(cherry picked from commit
88c2c8a0ba13de31061a22a352410c18ffacab9a)
syyhao1994 [Fri, 30 Apr 2021 07:55:50 +0000 (15:55 +0800)]
man: importd also provides the option of import-fs for machinectl (#19477)
(cherry picked from commit
96ae72ce1ad41674078e45b197df35ad18041dc2)
Alexander Sverdlin [Sun, 18 Apr 2021 23:53:45 +0000 (01:53 +0200)]
systemd-coredump: Add conflict with shutdown.target
Otherwise a coredump started at the inconvinient moment can stop
shutdown.target leaving the system in a halfway-down state:
Pulling in shutdown.target/start from systemd-poweroff.service/start
Added job shutdown.target/start to transaction.
...
Keeping job shutdown.target/start because of systemd-poweroff.service/start
...
[ OK ] Stopped target Remote File Systems.
shutdown.target: starting held back, waiting for: systemd-networkd.socket
sysinit.target: stopping held back, waiting for: remount_tmp.service
systemd-coredump.socket: Incoming traffic
...
systemd-coredump@0-243-0.service: Trying to enqueue job systemd-coredump@0-243-0.service/start/replace
Added job systemd-coredump@0-243-0.service/start to transaction.
Pulling in systemd-journald.socket/start from systemd-coredump@0-243-0.service/start
Added job systemd-journald.socket/start to transaction.
Pulling in system.slice/start from systemd-journald.socket/start
Added job system.slice/start to transaction.
Pulling in -.slice/start from system.slice/start
Added job -.slice/start to transaction.
Pulling in system-systemd\x2dcoredump.slice/start from systemd-coredump@0-243-0.service/start
Added job system-systemd\x2dcoredump.slice/start to transaction.
Pulling in system.slice/start from system-systemd\x2dcoredump.slice/start
Pulling in shutdown.target/stop from system-systemd\x2dcoredump.slice/start
Added job shutdown.target/stop to transaction.
...
Keeping job systemd-poweroff.service/stop because of umount.target/stop
Keeping job shutdown.target/stop because of systemd-coredump@0-243-0.service/start
(cherry picked from commit
4e947bd04944e58df4103eee4cb8180b5008f143)
Yu Watanabe [Wed, 28 Apr 2021 15:07:09 +0000 (00:07 +0900)]
network: dhcp4: downgrade log level when interface is removed
(cherry picked from commit
e558d4f47a9c01b007fc193cabcf0dea8370a5f1)
Yu Watanabe [Mon, 26 Apr 2021 14:55:09 +0000 (23:55 +0900)]
network: drop meaningless bitfield specifiers
(cherry picked from commit
4cbd379e018c15d2369287adee59d1484eaedcc4)
caoxia2008cxx [Thu, 29 Apr 2021 09:05:01 +0000 (17:05 +0800)]
set boot time from monotonic time (#19444)
utmp: calculate boot timestamp from monotonic timestamp instead of realtime timestamp
(cherry picked from commit
f813b62316395205f4c744cde43885081b5f88ae)
Yu Watanabe [Wed, 28 Apr 2021 13:26:48 +0000 (22:26 +0900)]
network: ndisc: fix ipv6 route preference for routes with Gateway=_ipv6ra
(cherry picked from commit
086a351ad9c39f49d050822b28e22aa461edec29)
Yu Watanabe [Wed, 28 Apr 2021 13:18:45 +0000 (22:18 +0900)]
network: neighbor: downgrade log level
As commented in the code, kernel sends messages about neighbors after
a link is removed.
(cherry picked from commit
27a213392f642fdd2a9dbce914bbfda9a72aafc1)
Yu Watanabe [Wed, 28 Apr 2021 13:17:39 +0000 (22:17 +0900)]
network: link: downgrade log level
The error is harmless, and will be ignored. Let's downgrade log level.
(cherry picked from commit
83e7c37b19bd36c78b235ac3047b758fcf82ad78)
William A. Kennington III [Tue, 27 Apr 2021 08:25:58 +0000 (01:25 -0700)]
network: neighbor: Always add neighbors with replace
We were duplicating setting flags for the message and a combination of
NLM_F_APPEND and NLM_F_CREATE which does not make sense. We should have
been using NLM_F_REPLACE and NLM_F_CREATE since the kernel can
dynamically create neighbors prior to us adding an entry. Otherwise, we
can end up with cases where the message will time out after ~25s even
though the neighbor still gets added. This delays the rest of the setup
of the interface even though the error is ultimately ignored.
(cherry picked from commit
192a9d95ea3e058afd824d38a9cea16ad0a84a57)
Franck Bui [Tue, 27 Apr 2021 08:59:24 +0000 (10:59 +0200)]
system-conf: drop reference to ShutdownWatchdogUsec=
Commit
65224c1d0e50667a87c2c4f840c49d4918718f80 renamed ShutdownWatchdogUsec
into RebootWatchdogUsec but left a reference of ShutdownWatchdogUsec in
system.conf.
(cherry picked from commit
45b1fc3a88b2f5102ecabfabdf0ee4f175aecd64)
Frantisek Sumsal [Mon, 26 Apr 2021 20:03:19 +0000 (22:03 +0200)]
systemctl: hide some empty properties without --all
Fixes: #19423
(cherry picked from commit
1ceaad69378272c64da4ecaab0d59ebb7a92ca0a)
Zbigniew Jędrzejewski-Szmek [Fri, 23 Apr 2021 10:37:09 +0000 (12:37 +0200)]
test-unit-serialize: add a very basic test that command deserialization works
We should test both serialization and deserialization works properly.
But the serialization/deserialization code is deeply entwined with the
manager state, and I think quite a bit of refactoring will be required before
this is possible. But let's at least add this simple test for now.
(cherry picked from commit
35243b77360c9cc7d1446617fe4fd304bfdecd4c)
Zbigniew Jędrzejewski-Szmek [Fri, 23 Apr 2021 10:40:07 +0000 (12:40 +0200)]
core/service: also reject deserialized commands with no argv[0]
I'm pretty sure that bad things would happen later on.
(cherry picked from commit
90204792461030dbc8645d8511e7ac8d1b4f1ca2)
Zbigniew Jędrzejewski-Szmek [Fri, 23 Apr 2021 10:39:03 +0000 (12:39 +0200)]
core/service: fix deserialization of non-absolute commands
We'd fail with:
Apr 23 10:58:26 systemd[1]: Deserializing state...
Apr 23 10:58:26 systemd[1]: testsuite-01.service: Failed to parse serialized command "ExecStart 0 sh "sh" "-e" "-x" "-c" "systemctl --state=failed --no-legend --no-pager >/failed ; systemctl daemon-reload ; echo OK >/testok"": Invalid argument
Apr 23 10:58:26 systemd[1]: testsuite-01.service: Reinstalled deserialized job testsuite-01.service/start as 209
This was missed in
5008da1ec1, and apparently nobody noticed until now :(
(cherry picked from commit
1a128a468ddd1070651478c36eae76e31f580b67)
Yu Watanabe [Mon, 26 Apr 2021 00:03:33 +0000 (09:03 +0900)]
network: update comment and log message
After
4b30f2e135ee84041bb597edca7225858f4ef4fb, reading stable_secret
sysctl property fails with -ENOMEM, instead of -EIO.
This is due to read_full_virtual_file() uses read() as the backend while
read_one_line_file() uses fgetc(). And each functions return different
error on fails.
Anyway, the failure is harmless here. So, the log message and comment is
updated.
Closes one of the issues in #19410.
(cherry picked from commit
0e27527170aa0179f2a4b3b55b78ddc049f815b9)
Peter Morrow [Tue, 13 Apr 2021 16:20:42 +0000 (17:20 +0100)]
core: allow services stuck in reloading state to exit
If a service is in reloading state but has exited do not delay
the final exit until the service reload timer expires. Instead allow
the service to exit immediately since we can't expect the service to
ever transition out of reloading state.
For example if a service sent RELOADING=1 but crashed before it could
send READY=1 then it should be restarted if the service had
Restart= configured.
Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
(cherry picked from commit
bbe19f68846bb3cd5fcf3e4f612268064df53b53)
Jóhann B. Guðmundsson [Wed, 21 Apr 2021 21:09:29 +0000 (21:09 +0000)]
fix: point to the correct drop-ins subdirectory for confs
(cherry picked from commit
eb34cce1787259de4cea1430fa017b6bd25bc4c1)
Igor Zhbanov [Tue, 20 Apr 2021 17:22:28 +0000 (17:22 +0000)]
journald: Retry if posix_fallocate returned -1 (EINTR)
On some conditions (particularly when mobile CPUs are going to sleep),
the posix_fallocate(), which is called when a new journal file is allocated,
can return -1 (EINTR). This is counted as a fatal error. So the journald
closes both old and journals, and simply throwing away further incoming
events, because of no log files open.
Introduce posix_fallocate_loop() that restarts the function in the case
of EINTR. Also let's make code base more uniform by returning negative
values on error.
Fix assert in test-sigbus.c that incorrectly counted positive values as
success. After changing the function return values, that will actually work.
Fixes: #19041
Signed-off-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
(cherry picked from commit
4c54768c9732532f4e56eab1be3e5474769e0d7a)
Zbigniew Jędrzejewski-Szmek [Mon, 19 Apr 2021 13:09:22 +0000 (15:09 +0200)]
man: dedent examples in sd-id128 to 2 columns
In man pages, horizontal space it at premium, and everything should
generally be indented with 2 spaces to make it more likely that the
examples fit on a user's screen.
C.f.
798d3a524ea57aaf40cb53858aaa45ec702f012d.
(cherry picked from commit
e0a41aa4c6674f04723388c05b7cd81cc2ffd613)
Yangyang Shen [Wed, 24 Mar 2021 13:23:01 +0000 (21:23 +0800)]
journald: enforce longer line length limit during "setup" phase of stream protocol
This PR made modification on Lennart Poettering's basis. Fix the LineMax's function failure problem.
Signed-off-by: Yangyang Shen <shenyangyang4@huawei.com>
(cherry picked from commit
80e9720616df0eeaba75874fd86fbfbe8b7a03a7)
Lennart Poettering [Tue, 20 Apr 2021 13:56:03 +0000 (15:56 +0200)]
sd-device: use right clock when comparing initialization usec
we actually use CLOCK_MONOTONIC for the timestamp, hence when
comparing/subtracting it from the current time, also use
CLOCK_MONOTONIC.
(cherry picked from commit
02ef01ade3b16c05dfc8698181d7f562f4934ef3)
Lennart Poettering [Tue, 20 Apr 2021 15:06:21 +0000 (17:06 +0200)]
sd-device: use right type for usec_initialized
(cherry picked from commit
a156eb89c827206ee5b51d53016ba63be0c90449)
Miroslav Suchý [Tue, 20 Apr 2021 08:23:01 +0000 (10:23 +0200)]
document DefaultOOMPolicy
the `man systemd.service` say:
Defaults to the setting DefaultOOMPolicy= in systemd-system.conf(5) is set to
but there is no such line in this config.
This is the default value I extracted from
systemctl show --property=DefaultOOMPolicy
(cherry picked from commit
0084d4f6b58f70c9955fa2259c29d65d87e1e855)
Yu Watanabe [Tue, 20 Apr 2021 00:23:33 +0000 (09:23 +0900)]
wifi-util: do not set zero errno to log_debug_errno()
(cherry picked from commit
66205cb3f597e43c8446d122fa4cc849c4f101d7)
Lennart Poettering [Mon, 19 Apr 2021 20:50:32 +0000 (22:50 +0200)]
mount-util: make umount_and_rmdir_and_freep() cleanup handler deal with NULL
(cherry picked from commit
4d686e6b0b12ffe9a1104ac23fee97c0de8a0730)
Lennart Poettering [Mon, 19 Apr 2021 20:47:33 +0000 (22:47 +0200)]
dissect: ext4 and loopback files are unimpressed by read-only access
Even if we set up a loopback device read-only and mount it read-only
this means nothing, ext4 will still write through to the backing storage
file.
Yes, I lost 6h debugging time on this.
Apparently, we have to specify "norecovery" when mounting such file
systems, to force them into truly read-only mode. Let's do so.
(cherry picked from commit
b620bf332f575ba9b8e4cd60c93446a0c35c23e8)
Lennart Poettering [Fri, 19 Mar 2021 21:45:15 +0000 (22:45 +0100)]
repart: deal with empty partition label sensibly
libfdisk appears to return NULL when encountering an empty partition
label, let's handle this sanely, and treat NULL and "" for the current
label as the same, but for the new label as distinct: there NULL means
nothing is set, and "" means an actual empty label.
(cherry picked from commit
be9ce0188ebb414319f0c003f805ea02b5eb473e)
Lennart Poettering [Fri, 19 Mar 2021 21:25:09 +0000 (22:25 +0100)]
repart: handle DISCARD failing with EBUSY gracefully
(cherry picked from commit
22163eb51b682afe969f9381d56315dade874ec1)
Lennart Poettering [Mon, 19 Apr 2021 15:35:54 +0000 (17:35 +0200)]
repart: fix incorrect error code propagation
(cherry picked from commit
a0ff9971802b664aaa12481c46cec11eae77ea51)
Peter Hutterer [Tue, 20 Apr 2021 07:09:48 +0000 (17:09 +1000)]
shell-completion: use base.lst, not xorg.lst
Since 2005 xorg.lst has been the legacy symlink to the real file base.lst.
(cherry picked from commit
7a4afd3a15f201a2230dce1f640fc37d18bc39ac)
Jason Francis [Mon, 19 Apr 2021 16:16:26 +0000 (12:16 -0400)]
sd-login: fix wrong constructor used in sd_login_monitor manpage example
(cherry picked from commit
941c5275eaaf8d22915eb876045d2173bdbb7d4c)
Jason Francis [Mon, 19 Apr 2021 16:13:03 +0000 (12:13 -0400)]
sd-login: correct prototype of sd_peer_get_cgroup
(cherry picked from commit
a8310e39e996b9b5f63d897879aecf8988261bdb)
Yu Watanabe [Fri, 16 Apr 2021 01:08:36 +0000 (10:08 +0900)]
fileio: use take_fdopen_unlocked()
This fixes maybe-uninitialized warning:
```
../src/basic/fileio.c: In function ‘chase_symlinks_and_fopen_unlocked’:
../src/basic/fileio.c:1026:19: warning: ‘f’ may be used uninitialized in this function [-Wmaybe-uninitialized]
1026 | *ret_file = f;
| ~~~~~~~~~~^~~
```
(cherry picked from commit
6604fb0207ee10e8dc05d67f6fe45de0b193b5c4)
Anita Zhang [Fri, 16 Apr 2021 07:42:44 +0000 (00:42 -0700)]
man: correct requirements for systemd-oomd.service
Fixes: #19331
(cherry picked from commit
169be51f94b7017fea1394dcb412d3afdfd7cea5)
Zbigniew Jędrzejewski-Szmek [Wed, 14 Apr 2021 20:06:02 +0000 (22:06 +0200)]
journald: fix %m usage
(cherry picked from commit
cf5a2ee82517429a34d9f5bef853cabe055e3e59)
Zbigniew Jędrzejewski-Szmek [Wed, 14 Apr 2021 15:10:36 +0000 (17:10 +0200)]
shared/module-util: fix errno value passed to log function
If r == 0, no harm done. But if r > 0, this would be interpreted as an
errno value, wrongly.
(cherry picked from commit
a2eb2267e44580446ecad37e7206e729cfd78155)
Zbigniew Jędrzejewski-Szmek [Wed, 14 Apr 2021 10:14:01 +0000 (06:14 -0400)]
partition, random-seed, logind: fix log messages with %m
We would print "...: Success", which is not too terrible, but not pretty
either.
(cherry picked from commit
111a3aae71fa019710216cc5b7aa95b7c8db0937)
Zbigniew Jędrzejewski-Szmek [Wed, 14 Apr 2021 09:54:17 +0000 (05:54 -0400)]
sd-device: improve log message and tweak style
We shouldn't say the attribute is missing right after ruling out ENOENT.
(cherry picked from commit
aca591ac55e5ee364905aec975388c5e30d0476c)
Lennart Poettering [Wed, 14 Apr 2021 14:02:35 +0000 (16:02 +0200)]
core: drop pointless assert()
We checked this literally two lines earlier, no point in checking so
quickly again.
(cherry picked from commit
5c9f1c68f032287da3fa7f5c4c08dfb0bf340c0b)
Luca Boccassi [Wed, 14 Apr 2021 20:26:50 +0000 (21:26 +0100)]
test: use systemd-run --wait in TEST-44-LOG-NAMESPACE
The test appears to be occasionally failing. It uses systemd-run to echo
'hello world' into a namespaced journal and then uses journalctl to look for it,
but it doesn't wait.
In the failed runs it can't find it, but the automated journal dump shows
the message at the end.
Use --wait to avoid races.
(cherry picked from commit
cf9844ffabd7fd51f22e729692b79d55cd7bdd76)
Zbigniew Jędrzejewski-Szmek [Wed, 14 Apr 2021 08:55:09 +0000 (04:55 -0400)]
libsystemd-network: fix dhcp option buffer confusion
We were writing to the wrong buffer with a wrong offset :(
Bug present since the original introduction of the code in
04b28be1a306fd2ba454d3ee333d63df71aa3873.
(cherry picked from commit
828b603a791edd04a5c3603456aa8caca44ce67e)
Sevan Janiyan [Wed, 14 Apr 2021 23:01:53 +0000 (00:01 +0100)]
meson.build: typo
(cherry picked from commit
d5b3e5104448ebfecd334c26dbdd3a8274440b1e)
Luca Boccassi [Mon, 12 Apr 2021 22:10:21 +0000 (23:10 +0100)]
tree-wide: avoid uninitialized warning on _cleanup_ variables
With some versions of the compiler, the _cleanup_ attr makes it think
the variable might be freed/closed when uninitialized, even though it
cannot happen. The added cost is small enough to be worth the benefit,
and optimized builds will help reduce it even further.
(cherry picked from commit
c2b2df604b845b4e1697d0911935e6644323c5a6)
Luca Boccassi [Tue, 13 Apr 2021 12:17:53 +0000 (13:17 +0100)]
rfkill: add some casts to silence -Werror=sign-compare
(cherry picked from commit
ab1aa6368a883bce88e3162fee2bea14aacedf23)
Fixes https://github.com/systemd/systemd-stable/issues/101.
Yu Watanabe [Sun, 11 Apr 2021 12:25:16 +0000 (21:25 +0900)]
network: add missing default setting in networkd.conf
(cherry picked from commit
6bfadad9bb6eaf614da92eba0a9b6243e8645018)
gaoyi [Tue, 13 Apr 2021 10:59:46 +0000 (18:59 +0800)]
udev: delete useless codes
It seems no one will touch queue.bin
(cherry picked from commit
993eb00016a75cf085eed85cf626a6995e96ab3d)
Francois Gervais [Mon, 12 Apr 2021 22:25:29 +0000 (18:25 -0400)]
load-fragment: parse specifiers in CPUAffinity= (#19281)
(cherry picked from commit
54cfe9a75f0e84d0604d39b87b1d919542336809)
Zbigniew Jędrzejewski-Szmek [Mon, 12 Apr 2021 12:03:32 +0000 (14:03 +0200)]
meson: do not fail if rsync is not installed with meson 0.57.2
https://github.com/mesonbuild/meson/issues/8641
Our CI started to fail. Even if the change is reverted in meson,
we need a quick workaround here.
(cherry picked from commit
7c5fd25119a495009ea62f79e5daec34cc464628)
Zbigniew Jędrzejewski-Szmek [Thu, 1 Apr 2021 08:09:11 +0000 (10:09 +0200)]
sd-device: header needs an include because it uses sd_device type
(cherry picked from commit
023e75df4c2904e493c4c8ff62df9fa99709d408)
Sergey Bugaev [Mon, 15 Feb 2021 17:18:34 +0000 (20:18 +0300)]
resolved: reply using unicast mDNS when appropriate
Fixes https://github.com/systemd/systemd/issues/18434
(cherry picked from commit
84b0ff0e327a4cf873791c74efc312c81400be70)
Sergey Bugaev [Fri, 19 Feb 2021 13:50:23 +0000 (16:50 +0300)]
resolved: fix mistaking QU bit for cache-flush bit
RFC 6762 defines the top bit in RRs to mean cache flush (section 10.2),
and the top bit in questions to mean that a unicast reply is wanted
(section 5.4).
dns_packet_read_key() is used for parsing both questions and RRs.
When called from dns_packet_extract_question(), the top bit being set
should not result in the packet being rejected as invalid.
Fixes https://github.com/systemd/systemd/issues/17973
(cherry picked from commit
82d39576462ba66a4316307ce1ded97272e1245f)
Sergey Bugaev [Sat, 20 Feb 2021 14:32:24 +0000 (17:32 +0300)]
resolved: add flags to DnsQuestion items
This adds DnsQuestionItem, which is to DnsQuestion what DnsAnswerItem is to
DnsAnswer.
No functional change.
(cherry picked from commit
ab715ddbaf9f45f352c4c018a648454df60b468b)
Julia Kartseva [Thu, 4 Feb 2021 06:15:27 +0000 (22:15 -0800)]
bpf-firewall: attach with BPF_F_ALLOW_MULTI if kernel supports
Reduced version of [0].
Use BPF_F_ALLOW_MULTI attach flag for bpf-firewall if kernel supports
it.
Aside from addressing security issue in [0] attaching with 'multi'
allows further attaching of cgroup egress, ingress hooks specified by
BPFProgram=.
[0] https://github.com/systemd/systemd/pull/17495/commits/
4e42210d40f96e185a55d43041dd6b962ea830dd
(cherry picked from commit
a442ccb4ebdbc3a9ff9d4504eb9724092149fd42)
gaoyi [Mon, 12 Apr 2021 08:09:47 +0000 (16:09 +0800)]
man: fix discriptions for --exec-delay
There are two ambiguity in the original description:
1. It will delay all RUN instructions, include builtin.
2. It will delay before running RUN, not each of RUN{program} instructions.
(cherry picked from commit
45f5efdea7e5e94bd47fc24b9bd404c77b5771a0)
Luca Boccassi [Fri, 9 Apr 2021 09:56:13 +0000 (10:56 +0100)]
test-repart: use cryptsetup and losetup autoclose
The test occasionally fails as the umount is not yet completed when
cryptsetup close is invoked.
Both cryptsetup and losetup have supported deferred cleanup for some
time now, so use it instead to avoid races.
++ losetup -P --show --find /tmp/test-repart.dMOfYQ8UUF/zzz
+ LOOP=/dev/loop6
+ VOLUME=test-repart-11882
+ touch /tmp/test-repart.dMOfYQ8UUF/empty-password
+ cryptsetup open --type=luks2 --key-file=/tmp/test-repart.dMOfYQ8UUF/empty*** test-repart-11882
+ mkdir /tmp/test-repart.dMOfYQ8UUF/mount
+ mount -t ext4 /dev/mapper/test-repart-11882 /tmp/test-repart.dMOfYQ8UUF/mount
+ diff -r /tmp/test-repart.dMOfYQ8UUF/mount/def /tmp/test-repart.dMOfYQ8UUF/definitions
+ umount /tmp/test-repart.dMOfYQ8UUF/mount
+ cryptsetup close test-repart-11882
Device test-repart-11882 is still in use.
+ rm -rf /tmp/test-repart.dMOfYQ8UUF
(cherry picked from commit
0efcbecd8b266526bf4a8fd06b9b7e7c5c43566d)
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 20:35:19 +0000 (22:35 +0200)]
TEST-22-TMPFILES: add reproducer for bug with X
(cherry picked from commit
1672be86021b5ae8e80d095409a4fffcba7cbb75)
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 16:26:15 +0000 (18:26 +0200)]
man: fix quickhelp listing in tmpfiles.d(5)
Unlike many other small/big letter combos, this one has the recursive
version attached to the lowercase letter.
(cherry picked from commit
3dd61ee5be0291380d341571e138713d2f89125a)
Masahiro Matsuya [Wed, 31 Mar 2021 02:44:24 +0000 (11:44 +0900)]
tmpfiles: use a entry in hashmap as ItemArray in read_config_file()
[zjs: squash commits and use size_t as appropriate.
Bug seems to have been introduced in
811a15877825da9e53f9a2a8603da34589af6bbb.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=
1944468.]
(cherry picked from commit
bec890e3cd6dac249cb12ce9430fdb78b6cf546b)
Luca Boccassi [Sat, 10 Apr 2021 19:13:02 +0000 (20:13 +0100)]
mkosi.arch: add rsync build dependency
Program rsync found: NO
man/meson.build:187:0: ERROR: Program 'rsync' not found
(cherry picked from commit
a7b7cab66df8c0a701bc6da3a309fa80c90a880b)