Commit graph

71165 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 0615abef62 analyze: always recommend saving the output to a file
The command will refuse to write to a TTY, so give a strong hint
that redirecting to a file is recommended. This makes the synopsis,
man page text, and --help output consistent.

Also drop the space after the redirection operator everywhere.
2024-02-20 19:35:58 +00:00
Mike Yuan 8e94bb62a5 core/mount: if umount(8) fails but mount disappeared, assume success
Fixes #31337
2024-02-20 16:22:27 +01:00
Zmyeir 8a461c572b hwdb: Add support for MetawillBook01 to 60-sensor.hwdb
Add accel orientation quirk for the METAPHYUNI MetawillBook01 2-in-1 laptop
2024-02-20 15:10:47 +01:00
MrSmör 8b6cfbd2b8 boot: padding for default arrow at too long lines
If the default boot entry name doesnt leave enough space for the
indicator arrow, it overwrote the first two characters of the entry

Now every line will always have enough padding.
2024-02-20 14:36:52 +01:00
Luca Boccassi ce3fa3863d
Merge pull request #31388 from keszybz/bitfield-cleanup
Bitfield cleanup
2024-02-20 12:15:24 +00:00
Yu Watanabe 142f0e9517 analyze: skip to check ExecCommand for .mount and .swap units
They are not set by a unit file, but dynamically generated.

Fixes a bug caused by abf0ccc1c6.

Fixes #31396.
2024-02-20 11:59:10 +00:00
Zbigniew Jędrzejewski-Szmek 6169bb19a9 logind: drop bitfield annotations
As in other cases, this is simpler but better.

pahole:
-	/* size: 336, cachelines: 6, members: 50 */
-	/* sum members: 316, holes: 4, sum holes: 19 */
-	/* sum bitfield members: 4 bits, bit holes: 1, sum bit holes: 4 bits */
-	/* last cacheline: 16 bytes */
+	/* size: 328, cachelines: 6, members: 50 */
+	/* sum members: 320, holes: 3, sum holes: 8 */
+	/* last cacheline: 8 bytes */
2024-02-20 10:42:36 +01:00
Zbigniew Jędrzejewski-Szmek d53017292e timesyncd: reorder structs instead of useless bitfields
Because of alignment, those bitfields were not doing anything useful,
and were causing the generated code to be more complicated. But in this
case, at least potentially there might be a number of copies of those
structs (if we have a bunch of time servers configured), so let's actually
implement the intended space savings by reording the fields to reduce the
size of holes.
2024-02-20 10:41:09 +01:00
Zbigniew Jędrzejewski-Szmek 611a6d15cb systemctl: drop pointless bitfield 2024-02-20 10:41:09 +01:00
Zbigniew Jędrzejewski-Szmek 6e2be1d97a sysupdate: drop pointless bitfields
Again, even without considering how many copies of the struct there
can be, this bitfield is useless because of alignment.
2024-02-20 10:41:09 +01:00
Zbigniew Jędrzejewski-Szmek 0a35e7f6be core/kmod-setup: drop another pointless bitfield annotation
We have two bools followed by a func pointer, which is aligned to e.g. 8 bytes,
so whether the two bools take one bit, one byte, or even a full word, makes no
difference in storage size. But the code generated to service a bitfield is
more complicated.

Also switch to FOREACH_ARRAY().
2024-02-20 10:40:59 +01:00
runiq 793166aea5 udev: String substitutions can be done in ENV, too
Precedence for example in ac63c8df30/rules.d/99-systemd.rules.in (L75).

Add ENV to the list of keys where string substitutions can be used.

While I'm at it, also sort the list in that paragraph alphabetically.
2024-02-20 13:10:30 +09:00
Yu Watanabe 4b6d8de09c home: fix typo
Follow-up for 25c89b8977 and
a4d72746c7.
2024-02-20 09:25:30 +09:00
Yu Watanabe 5ad2874b24 vconsole-setup: fix typo
Follow-up for 190ff0d0a8.
2024-02-20 09:23:18 +09:00
Yu Watanabe c6c7c461a3 resolve: several follow-ups for resolving service via varlink
Follow-ups for e1634bb832.

- Allow to call the method without "name" and "type".
- Allow to specify SD_RESOLVE_NO_TXT and SD_RESOLVE_NO_ADDRESS.
- Allow to provide multiple services, and fix memory leak.
- Rearrange the return value format.
- Encode TXT field with octescape() to make the field matches with the
  io.systemd.Resolve.Monitor interface.

Fixes #31371.
2024-02-19 22:13:07 +01:00
Antonio Alvarez Feijoo d0a0059c21 gpt-auto-generator: fix argument passed to parse_image_policy_argument
Otherwise:

```
Feb 19 16:35:34 localhost systemd-gpt-auto-generator[188]: Assertion 's' failed at src/shared/image-policy.c:656, function parse_image_policy_argument(). Aborting.
```

Fixes 06e78680e3
2024-02-19 19:24:25 +00:00
Luca Boccassi f927b872d6
Merge pull request #31351 from YHNdnzj/exit-status-no-executable
core/exec-invoke: record correct exit status when failed to locate executable
2024-02-19 19:17:31 +00:00
Daan De Meyer 5b54fe8d6d pkcs11-util: Explicitly initiaiize variable to avoid warning
Avoid the following warning on C9S by explicitly initializing
"object".

"""
[389/2801] Compiling C object src/shared/libsystemd-shared-256-devel.a.p/pkcs11-util.c.o
../src/src/shared/pkcs11-util.c: In function ‘pkcs11_token_find_private_key’:
../src/src/shared/pkcs11-util.c:983:21: warning: ‘object’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  983 |         *ret_object = object;
      |         ~~~~~~~~~~~~^~~~~~~~
"""
2024-02-19 18:37:36 +00:00
Lennart Poettering 33b9337130 cgroup: typo fix initial_restric_ifaces_link_fds → initial_restrict_ifaces_link_fds 2024-02-19 19:18:21 +01:00
Luca Boccassi 4086a16742
Merge pull request #31357 from keszybz/cleanups-vmspawn
Cleanups vmspawn
2024-02-19 16:45:42 +00:00
David Tardon dfdcc7c987 test: add a test for #31384 2024-02-19 16:45:19 +00:00
Mike Yuan 210ca71cb5
core/execute: clean up log_exec_full_errno and friends
Also drop unused log_exec_struct_iovec().
2024-02-19 23:12:59 +08:00
Mike Yuan b159680db0
core/exec-invoke: raise the log level of missing executable to notice
Suggested in
https://github.com/systemd/systemd/pull/31351#discussion_r1494450831:

> one above just informational, but also not a warning yet.
2024-02-19 23:12:59 +08:00
Mike Yuan 80b18d217a
core/exec-invoke: record correct exit status when failed to locate executable
Follow-up for 4d8b0f0f7a

After the mentioned commit, when the ExecCommand executable is missing,
and failure will be ignored by manager, we exit with EXIT_SUCCESS at executor
side too. The behavior however contradicts systemd.service(5), which states:

> If the executable path is prefixed with "-", an exit code of the command
> normally considered a failure (i.e. non-zero exit status or abnormal exit
> due to signal is _recorded_, but has no further effect and is considered
> equivalent to success.

and thus makes debugging unexpected failures harder. Therefore, let's still
exit with EXIT_EXEC, but just skip LOG_ERR level log.
2024-02-19 23:12:59 +08:00
Jan Macku 12af0efba5 ci(labeler): add policy for escape labeler 2024-02-19 16:09:15 +01:00
Daan De Meyer 88d4b97a24 Set SYSTEMD_LOG_LEVEL=info explicitly in test-sysusers
If we're looking for output on stderr, let's make sure it's not
littered with debug logs if SYSTEMD_LOG_LEVEL=debug.
2024-02-19 15:19:37 +01:00
Frantisek Sumsal ef22a3233f
Merge pull request #31386 from mrc0mmand/test-tweaks
Revert "test: use btrfs by default on Arch as well"
2024-02-19 14:53:31 +01:00
Luca Boccassi b6e4445424
Merge pull request #30840 from AdrianVovk/homed-bulk-v2
Homed bulk directories v2
2024-02-19 13:39:26 +00:00
Adrian Vovk fd93a16e7d update TODO 2024-02-19 11:18:11 +00:00
Adrian Vovk bbdd9c8d97 TEST-46-HOMED: Add tests for blob directories 2024-02-19 11:18:11 +00:00
Adrian Vovk 25c89b8977 homectl: Add flags to edit blob directories
This makes it possible to edit blob directories using homectl. The
following syntax is available:

* `--blob-directory=/path/somewhere`: Replaces the entire blob directory
with the contents of /path/somewhere

* `--blob-directory=foobar=/path/somewhere`: Replaces just the file
foobar in the blob directory with the contents of /path/somewhere

* `--blob-directory=foobar=`: Deletes the file foobar from the blob
directory

* `--blob-directory=`: Resets all previous flags

* `--avatar=`, etc: Shortcuts for `--blob-directory=FILENAME=` for the
known files in the blob directory
2024-02-19 11:18:11 +00:00
Adrian Vovk a4d72746c7 homework: Handle Update & Create w/ blob dir
Introduces new extended variants of the various incarnations of
Create and Update, which take a map of filenames to FDs. This map is
then used to populate the bulk directory.

FDs are used to prevent the client from abusing homed's blob directory
permissions (everything is made world-readable by homed) to open files
that they normally aren't allowed to open. Passing along an FD ensures
that the client has read access to the file it wants homed to make
world-readable.

Internally, homework uses the map to overwrite the system blob dir.
Later, homework's existing blob dir reconciliation logic will propagate
the new contents from the system blob dir into the embedded blob
dir
2024-02-19 11:18:11 +00:00
Adrian Vovk 17ac40e4cd homework: Reconcile blob directories
Whenever the host & embedded records are reconciled, the host & embedded
blob directories are now reconciled too in the same direction.
Reconciling the blob directories serves exactly the same purpose as
reconciling the user records, and thus should behave in the same way.
2024-02-19 11:18:11 +00:00
Adrian Vovk c3d50255fc homed: Create & advertise blob directory
This ensures that a user-specific blob directory exists in
/var/cache/systemd/homed for as long as the user exists, and gets
deleted if the user gets deleted.

It also advertises this blob directory via the user record, so that
clients can find and use it.
2024-02-19 11:18:11 +00:00
Adrian Vovk 1b466c0940 user-record: Add blobDirectory and blobManifest
These fields are used to connect a JSON user record to its blob
directory, and to include the directory's contents in the record's
signature
2024-02-19 11:18:11 +00:00
Adrian Vovk 4006b98da6 Document blob directory behavior
We're documenting the behavior of blob directories here. These docs
refer to things that aren't yet implemented at the time of the commit, but will be later in the same PR.
2024-02-19 11:18:11 +00:00
Adrian Vovk 85f660d46b fd-util: Expose helper to pack fds into 3,4,5,...
This is useful for situations where an array of FDs is to be passed into
a child process (i.e. by passing it through safe_fork). This function
can be called in the child (before calling exec) to pack the FDs to all
be next to each-other starting from SD_LISTEN_FDS_START (i.e. 3)
2024-02-19 11:18:11 +00:00
Luca Boccassi 034569150f
Merge pull request #31364 from bluca/vpick_ext
core: add support for vpick for ExtensionImages=/ExtensionDirectories=
2024-02-19 11:15:54 +00:00
Zbigniew Jędrzejewski-Szmek 68a7ab7d8d journal: use the usual spelling of "serialize" 2024-02-19 11:56:28 +01:00
Zbigniew Jędrzejewski-Szmek 7e2c6c74cf vmspawn: rework --help
In this context, "VM" doesn't need explaining. Make the texts more precise
and try to make them fit in one line. Help output is much easier to read
when it's not wrapped.
2024-02-19 11:56:28 +01:00
Zbigniew Jędrzejewski-Szmek 9eb195701e man: reword paragraph about --forward-journal= and adjust spacing
The previous text did not look right when rendered.

The text is much easier to read when paragraphs are separated by an empty
line, latex-style.
2024-02-19 11:56:28 +01:00
Zbigniew Jędrzejewski-Szmek 64ec25cbd3 test-journald-config: indentation 2024-02-19 11:56:28 +01:00
Zbigniew Jędrzejewski-Szmek 8f9e3ea090 journald: shorten code a bit and return error where it's useful
Follow-up for f31cff849d.
2024-02-19 11:56:28 +01:00
Frantisek Sumsal bbac11c993 test: temporarily enable session lingering for the test user
So the user daemon with the long-running service is not killed while we
test the journal:

[  834.077080] testsuite-04.sh[10937]: Running as unit: user-sleep.service; invocation ID: b1f2c9c9a14a40ce836c867139d14dc8
[  834.077687] systemd[10943]: Started user-sleep.service.
[  834.078437] (sd-pam)[10952]: pam_unix(login:session): session closed for user testuser
[  834.078643] systemd[1]: run-u3.service: Deactivated successfully.
[  834.078710] testsuite-04.sh[10930]: + for _ in {0..9}
[  834.078710] testsuite-04.sh[10930]: + journalctl --rotate
...
[  834.081253] systemd[1]: session-7.scope: Deactivated successfully.
...
[  844.602065] testsuite-04.sh[10930]: + journalctl --rotate
[  844.630414] testsuite-04.sh[10930]: + journalctl --sync
[  844.632005] systemd[1]: Stopping user@4711.service...
[  844.634179] systemd[10943]: Activating special unit exit.target...
[  844.635769] systemd[10943]: Stopped target default.target.
[  844.636136] systemd[10943]: Stopped target timers.target.
[  844.636479] systemd[10943]: Stopping user-sleep.service...
[  844.636998] systemd[10943]: Stopped user-sleep.service.
...
[  844.758893] testsuite-04.sh[10930]: + systemctl stop --user -M testuser@ user-sleep.service
[  845.213399] systemctl[11066]: Failed to stop user-sleep.service: Unit user-sleep.service not loaded.
2024-02-19 11:43:54 +01:00
Frantisek Sumsal 18c769b0ff Revert "test: use btrfs by default on Arch as well"
There's something very wrong going on when using btrfs for the test
images, namely:
  - there's a significant performance hit, i.e. the Arch Linux run is
    ~20% slower, in the coverage run the situation is even worse
  - intermittent boot failures
  - intermittent "No space left on device" errors (even though there's
    enough free space)

Since debugging this might take a while, let's temporarily revert back
to ext4 to make the CI stable again.

This reverts commit 7eb7e3ec4f.
2024-02-19 11:43:54 +01:00
Yu Watanabe ac63c8df30 sd-radv: fix potential buffer overflow
Fixes a bug in 1925f829ab and
6a6d27bc5b (v255).
2024-02-19 10:16:36 +00:00
Yu Watanabe b5b2510800 pam-util: include cache ID of bus connection in the log message
To make it easier to debug issues like #31375.
2024-02-19 10:15:33 +00:00
Yu Watanabe d42b81f93f core/exec: do not crash with UtmpMode=user without User= setting
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2264404.

Replaces #31356.
2024-02-19 10:51:00 +01:00
Franck Bui 190ff0d0a8 vconsole-setup: don't fail if the only found vc is already used by plymouth
During the boot process, systemd-vconsole-setup can be started when the only
allocated VC is already taken by plymouth.

This case is expected when a boot splash is displayed hence
systemd-vconsole-setup.service should not fail if it happens.

However rather than doing nothing, the sysfs utf8 flag is set before exiting
early.
2024-02-19 09:25:14 +01:00
Frantisek Sumsal 78bbc7d5d4 test: make testcase_owneridmap() compatible with coverage runs
Follow-up for 614d09a.
2024-02-18 13:44:24 +00:00