1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-10 17:57:40 +03:00

69019 Commits

Author SHA1 Message Date
Luca Boccassi
3dfbddf3ee
Merge pull request #30216 from poettering/loginctl-table-tweaks
loginctl: minor tweaks to tabular output
2023-11-28 15:33:35 +00:00
Luca Boccassi
5ff5250787
Merge pull request #30220 from yuwata/journald-vs-soft-reboot
unit: stop journald before SIGKILL on soft-reboot
2023-11-28 15:32:08 +00:00
Lennart Poettering
febfec0849 loginctl: show null fields for unset seat/tty fields of sessions 2023-11-28 11:33:01 +01:00
Lennart Poettering
8bfa22f079 loginctl: set appropriate ersatz strings for all tables 2023-11-28 11:33:01 +01:00
Lennart Poettering
082dd188d2 logind: align columns of a table 2023-11-28 11:13:14 +01:00
Yu Watanabe
1568430c65 utmp-wtmp: fix wrong suffix assignment on putting dead process
Fixes a bug introduced by f1d553e9dfd56f95b7564dd20a0b56e6a0d6492c.

Fixes #30213.
2023-11-28 17:46:01 +08:00
Yu Watanabe
14338cca99 core/cgroup: fix compile error
With gcc-13,
```
CFLAGS="-O3 -fno-semantic-interposition" meson setup build
```
triggers the following error:
```
../src/core/cgroup.c: In function ‘cgroup_context_dump’:
../src/core/cgroup.c:633:44: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  633 |                         "%sDeviceAllow: %s %s\n",
      |                                            ^~
cc1: some warnings being treated as errors
```

Fixes #30223.
2023-11-28 10:35:52 +01:00
Yu Watanabe
5edb35ef7a test: check journal files are not corrupted after soft-reboot 2023-11-28 18:28:18 +09:00
Yu Watanabe
f89985ca49 unit: make journald stopped on soft-reboot before broadcasting SIGKILL
Workaround for #30195.
2023-11-28 18:28:17 +09:00
Yu Watanabe
2601482b85 man: also SIGKILL is sent on soft-reboot 2023-11-28 18:28:17 +09:00
Yu Watanabe
698da597e1 varlinkctl: add short comment 2023-11-28 18:28:17 +09:00
Yu Watanabe
e521898d83 capability-util: avoid false-positive use-of-uninitialized-value error
fuzzers randomly fail with the following:
```
==172==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f41169cb39b in update_argv /work/build/../../src/systemd/src/basic/argv-util.c:96:13
    #1 0x7f41169cb39b in rename_process /work/build/../../src/systemd/src/basic/argv-util.c:210:16
    #2 0x7f4116b6824e in safe_fork_full /work/build/../../src/systemd/src/basic/process-util.c:1516:21
    #3 0x7f4116bffa36 in safe_fork /work/build/../../src/systemd/src/basic/process-util.h:191:16
    #4 0x7f4116bffa36 in parse_timestamp /work/build/../../src/systemd/src/basic/time-util.c:1047:13
    #5 0x4a61e6 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-time-util.c:16:16
    #6 0x4c4a13 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #7 0x4c41fa in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
    #8 0x4c58c9 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19
    #9 0x4c6595 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:895:5
    #10 0x4b58ff in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
    #11 0x4def52 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #12 0x7f4115ea3082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: e678fe54a5d2c2092f8e47eb0b33105e380f7340)
    #13 0x41f5ad in _start (build-out/fuzz-time-util+0x41f5ad)

DEDUP_TOKEN: update_argv--rename_process--safe_fork_full
  Uninitialized value was created by an allocation of 'fv' in the stack frame of function 'have_effective_cap'
    #0 0x7f41169d3540 in have_effective_cap /work/build/../../src/systemd/src/basic/capability-util.c:21
```
2023-11-28 10:22:39 +01:00
Zbigniew Jędrzejewski-Szmek
78b95ccad8 test-time-util: suppress timestamp conversion failures for Africa/Khartoum timezone
Our timestamp conversion roundtrip test was failing. But I think that this
is not our bug:

$ TZ='Africa/Khartoum' date --date='@1509482094'
Tue Oct 31 23:34:54 EAT 2017
$ TZ='Africa/Khartoum' date --date='Tue Oct 31 23:34:54 EAT 2017' +%s
1509485694
$ TZ='Africa/Khartoum' date --date='@1509485694'
Tue Oct 31 23:34:54 CAT 2017
$ echo $[1509485694 - 1509482094]
3600

This is essentially the same as what happens in our test. After a round-trip, we
end up one hour ahead.

> For 1509482094632752, from the change log of tzdata:
>
> Release 2017c - 2017-10-20 14:49:34 -0700
>
>  Changes to future timestamps
>    Sudan will switch from +03 to +02 on 2017-11-01.

Fixes https://github.com/systemd/systemd/issues/28472.
2023-11-27 16:22:09 +00:00
Luca Boccassi
04fc5b6047
Merge pull request #30170 from bluca/exec_bpf_fd
core: pass bpf_outer_map_fd to sd-executor only if RestrictFileSystems was set
2023-11-27 15:44:50 +00:00
Adam Goldman
6a42bdb37e hwdb: ieee1394-unit-function: add Sony DVMC-DA1
This commit adds a hwdb entry for the Sony DVMC-DA1. This media converter
works with video capture software such as dvgrab, but it doesn't support
the AV/C command set and doesn't match the general entry.
2023-11-26 20:51:10 +00:00
Yu Watanabe
54f3b3d2a4
Merge pull request #30200 from mrc0mmand/test-tweaks
A couple of assorted fixes
2023-11-26 09:10:09 +09:00
Frantisek Sumsal
7a2d6c2d08 test: drop 'noearly' from crypttab
It's a Debian thing, we don't support it.

[   30.639971] testsuite-64.sh[475]: + systemctl restart cryptsetup.target
[   30.697667] systemd-cryptsetup[3389]: Encountered unknown /etc/crypttab option 'noearly', ignoring.
[   30.700529] systemd-cryptsetup[3390]: Encountered unknown /etc/crypttab option 'noearly', ignoring.
[   30.700594] systemd-cryptsetup[3391]: Encountered unknown /etc/crypttab option 'noearly', ignoring.
[   30.704638] systemd-cryptsetup[3392]: Encountered unknown /etc/crypttab option 'noearly', ignoring
2023-11-25 22:30:01 +01:00
Frantisek Sumsal
d1ac1aa5ca test: drop invalid LogTarget= assignment
It's been there since the test was introduced and I'm not really sure
what was the original intention behind it, but it makes systemd sad:

[    4.909056] systemd[1]: /usr/lib/systemd/tests/testdata/units/testsuite-44.service:13: Unknown key name 'LogTarget' in section 'Service', ignoring.
2023-11-25 21:59:57 +01:00
Frantisek Sumsal
538291b0d8 systemctl: include unit ID in the property map
Otherwise we get a not very nice message when trying to display a
non-existent man page:

~# systemctl cat test.service
[Unit]
Description=Hello
[Service]
ExecStart=true
~# systemctl help test.service
Documentation for (null) not known.
2023-11-25 21:36:10 +01:00
Frantisek Sumsal
a986de6899 import: append % to X_IMPORT_PROGRESS=
Since we parse it on the other side via parse_percent() which requires
that, otherwise we get an error:

[    8.133131] testsuite-13.sh[649]: + machinectl import-raw /tmp/container.raw container-raw
[    8.175035] machinectl[1143]: Enqueued transfer job 1. Press C-c to continue download in background.
[    8.182130] machinectl[1143]: Importing '/tmp/container.raw', saving as 'container-raw'.
[    8.182377] systemd-importd[1144]: Got invalid percent value '0', ignoring.
[    8.182451] machinectl[1143]: Imported 0%.
[    8.282669] systemd-importd[1144]: Got invalid percent value '40', ignoring.
[    8.282746] machinectl[1143]: Imported 40%.
[    8.366448] machinectl[1143]: Wrote 64.0M.
[    8.366519] machinectl[1143]: Operation completed successfully.
[    8.366617] machinectl[1143]: Exiting.
2023-11-25 20:42:13 +01:00
Frantisek Sumsal
60f9c49b16 test: remove the reboot counter just before spawning container/VM
Doing that in test_run() is not enough, since it's called only once and
spawns all QEMU/nspawn jobs.
2023-11-25 20:22:24 +01:00
Yu Watanabe
8add4a9801
Merge pull request #30196 from YHNdnzj/fchmodat2-no-symlink
Revert "nspawn-patch-uid: try fchmodat2() to restore mode of symlink"
2023-11-26 03:30:58 +09:00
Yu Watanabe
22be476571
Merge pull request #30197 from keszybz/vconsole-restart-no-limit
Drop restart limit for systemd-vconsole-setup.service and some man page tweaks
2023-11-26 02:28:06 +09:00
Zbigniew Jędrzejewski-Szmek
4704176795 units: disable start rate limit for systemd-vconsole-setup.service
The unit will be started or restarted a few times during boot, but but it has
StartLimitBurst = DefaultStartLimitBurst = 5, which means that the fifth
restart will already fail. On my laptop, I have exactly 4 restarts, so I don't
hit the limit, but on a slightly different system we will easily hit the limit.
In https://bugzilla.redhat.com/show_bug.cgi?id=2251394, there are five reloads
and we hit the limit.

Since 6ef512c0bb7aeb2000588d7d05e23b4681da8657 we propagate the start counter
over switch-root and daemon reloads, so it's easier to hit the limit during
boot.

In principle there might be systems with lots of vtcon devices, so let's just
allow the unit to be restarted without a limit.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2251394.
2023-11-25 13:27:17 +01:00
Zbigniew Jędrzejewski-Szmek
467cd9f0a5 man/systemd-vconsole-setup: improve markup 2023-11-25 13:15:31 +01:00
Mike Yuan
0cdffada3d
nspawn-patch-uid: clarify that changing mode of symlink is unsupported 2023-11-25 19:12:20 +08:00
Mike Yuan
677e644530
Revert "nspawn-patch-uid: try fchmodat2() to restore mode of symlink"
This reverts commit 30462563b19b92d8c6ed196d30d3cf7de90e8131.

fchmodat2(), while accepting AT_SYMLINK_NOFOLLOW as a valid flag,
always returns EOPNOTSUPP when operating on a symlink. The Linux kernel
simply doesn't support changing the mode of a symlink.

Fixes #30157
2023-11-25 19:12:15 +08:00
Yu Watanabe
6ba7c72910
Merge pull request #30119 from mrc0mmand/test-console
test: don't redirect stdout/stderr to console
2023-11-25 12:54:11 +09:00
Paymon MARANDI
b99e4922ea ukify: be more explicit about where to find ukify
when KERNEL_INSTALL_UKIFY is not supplied we set ukify to $PWD/ukify

that will fail (perhaps only for manual installations):
FileNotFoundError: [Errno 2] No such file or directory: '/usr/src/linux-6.7-rc1/ukify'

this will make sure we have a sane default for UKIFY

Signed-off-by: Paymon MARANDI <paymon@utubeipod.xyz>
2023-11-25 12:53:29 +09:00
huyubiao
c00b446d93 udevadm: exiting udevadm monitor normally under SIGTERM or SIGINT
Under SIGTERM or SIGINT, exit event and release resources, and exit udevadm monitor normally.
2023-11-25 12:53:10 +09:00
Yu Watanabe
33d11a2b69 analyze: return earlier when there is no path to be prepended
Follow-up for 2f6181ad4d6c126e3ebf6880ba30b3b0059c6fc8.

Addresses the post-merge comment:
https://github.com/systemd/systemd/pull/30172#discussion_r1404209035
2023-11-25 12:52:59 +09:00
Yu Watanabe
fd097a79d5
Merge pull request #30188 from YHNdnzj/memory-accounting-followup
core: a few fixes and improvements for memory accounting
2023-11-25 12:52:48 +09:00
Yu Watanabe
2c29813da3 run: escape command for description
The command arguments may contain spurious characters, e.g. line-break.
When we use command arguments as a description of a unit, we should
escape them.

Fixes #30187.
2023-11-25 12:52:35 +09:00
Lennart Poettering
50f4469ed7 rules: don't condition usb-gadget.target target on 'add' action
The dependency should exist continously, like all our similar deps do.
Hence drop the "add" conditionalization.
2023-11-25 12:52:23 +09:00
Frantisek Sumsal
fa6f37c043 test: don't redirect stdout/stderr to console
Turns out that redirecting a lot of output to the console can have some
funny effects, like random kernel soft lockups. I spotted this in
various CIs, but it remained almost entirely hidden thanks to
`softlockup_panic=1`, until 1a36d2672f which introduced a couple of
tests that log quite a lot in a short amount of time. This, in
combination with newer kernel version, which, for some reason, seem to
be more susceptible to such soft lockups, made the Arch Linux jobs soft
lockup quite a lot, see [0].

While debugging this I also noticed that runs which don't redirect
stdout/stderr to the console are noticeably faster, e.g.:

    # TEST-71 nspawn + QEMU (KVM), StandardOutput=journal+console
    Elapsed (wall clock) time (h:mm:ss or m:ss): 0:24.64
    # TEST-71 nspawn + QEMU (KVM), StandardOutput=journal
    Elapsed (wall clock) time (h:mm:ss or m:ss): 0:17.95

    # TEST-71 nspawn + QEMU, StandardOutput=journal+console
    Elapsed (wall clock) time (h:mm:ss or m:ss): 2:04.70
    # TEST-71 nspawn + QEMU, StandardOutput=journal
    Elapsed (wall clock) time (h:mm:ss or m:ss): 1:44.48

    # TEST-04 QEMU, StandardOutput=journal+console
    Elapsed (wall clock) time (h:mm:ss or m:ss): 4:22.70
    # TEST-04 QEMU, StandardOutput=console
    Elapsed (wall clock) time (h:mm:ss or m:ss): 5:04.67

Given all this, let's effectively revert ba7abf79a5, and dump the
testsuite-related journal messages only after the test finishes, so they
don't go through the slow console.

Resolves: systemd/systemd-centos-ci#660

[0] https://github.com/systemd/systemd-centos-ci/issues/660
2023-11-24 18:00:07 +01:00
Frantisek Sumsal
4a43c2b3a1 test: add a couple of tests for RestrictFileSystems= 2023-11-24 17:49:28 +01:00
Mike Yuan
f17b07f4d7
core/cgroup: use the cached memory accounting value when cgroup is gone
Follow-up for 9824ab1f009e99b0b9d273ace4c98cc687a4c1d7

Fixes https://github.com/systemd/systemd/issues/28542#issuecomment-1825413237
2023-11-25 00:38:49 +08:00
Mike Yuan
bfb6b1214a
bus-print-properties: prettify more unset properties 2023-11-25 00:38:49 +08:00
Mike Yuan
3f362012ce
bus-print-properties: ignore CGROUP_LIMIT_MAX for Memory*{Current,Peak}
MemoryCurrent and MemoryAvailable are shown as "[not set]" when UINT64_MAX
(unset). Let's do the same for the newly-added Memory*{Current,Peak} properties.
2023-11-24 23:22:41 +08:00
Mike Yuan
35c08a56a1
core/dbus-unit: don't log cgroup v1 property name 2023-11-24 23:22:40 +08:00
Zbigniew Jędrzejewski-Szmek
963ea30a5d man: reword the list of PE sections in systemd-stub
Let's put the section name at the beginning of each sentence. This way we
can avoid awkward constructs like "kernel is looked for in the .linux section".
Also, since the paragraph above says that this is a list of "PE sections", we
can just say "section". In other places, it is often useful to say "PE section"
to avoid ambiguity.

Also fix the off-by-one in the count of sections.
2023-11-24 15:21:58 +01:00
Lennart Poettering
ed272a9ff5 update TODO 2023-11-24 15:17:46 +01:00
Frantisek Sumsal
c5035a30e2 test: don't make the final vacuum multiple of 8M
As this would usually mean we'd nuke everything, since there are two
open journals - system and user - both being 8M in size.
2023-11-24 11:51:27 +01:00
Frantisek Sumsal
09bdb9f121 test: clean up the save_journal() stuff a bit
Let's save all journals from the test machine instead of calling export
on each journal file separately, which makes the code less complicated
(and probably faster).
2023-11-24 11:51:27 +01:00
Luca Boccassi
36f4476361
Merge pull request #30172 from yuwata/analyze-verify-unit-path
analyze: do not prepend CWD to SYSTEMD_UNIT_PATH needlessly
2023-11-24 10:35:28 +00:00
Lennart Poettering
c7896cecea pcrextend: fix minor memory leak
Also, simplify the code a bit by using json_dispatch_unbase64_iovec().
2023-11-24 12:21:43 +09:00
Yu Watanabe
2bab4caaf9 login: do not clear wall message before shutting down
This fixes a regression caused by 5ed73478e1b1560274038ef30ec6f89022b4d8f6
and aa6123e85e0baea21b6daad175da43ffea30629f.

With these commits, when Reboot dbus method or friends is called,
reset_scheduled_shutdown() is called before shutting down the system,
so the wall message was cleared.

As the wall message itself is unrelated to the scheduling of shutting
down systems, let's keep the message.

Fixes #30167.
2023-11-24 11:11:57 +08:00
Yu Watanabe
2f6181ad4d analyze: do not prepend the current working directory to SYSTEMD_UNIT_PATH needlessly
If the requested unit is not in the current working directory, it is not
necessary to include the current working directory in SYSTEMD_UNIT_PATH.

Follow-up for 45519d13a4f2a3c3585e672595762ca621abe65e.

Fixes #30166.
2023-11-24 05:28:14 +09:00
Yu Watanabe
ff7af46edb analyze: set SYSTEMD_UNIT_PATH in verify_generate_path()
Then, rename verify_generate_path() -> verify_set_unit_path().
2023-11-24 05:20:13 +09:00
Yu Watanabe
c131e8b706 analyze: shorten code a bit
No functional change, just refactoring.
2023-11-24 05:19:14 +09:00