]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agodissect: use a switch statements where appropriate 26747/head
Lennart Poettering [Fri, 10 Mar 2023 10:33:23 +0000 (11:33 +0100)] 
dissect: use a switch statements where appropriate

2 years agodissect: share dissected_image_decrypt_interactively() invocation between actions
Lennart Poettering [Fri, 10 Mar 2023 10:32:20 +0000 (11:32 +0100)] 
dissect: share dissected_image_decrypt_interactively() invocation between actions

Let's invoke dissected_image_decrypt_interactively() at once place only,
instead of in each function separately.

No actual changes, just some minor refactoring.

2 years agoMerge pull request #26331 from ddstreet/tpm2_pcr_read
Lennart Poettering [Fri, 10 Mar 2023 09:24:39 +0000 (10:24 +0100)] 
Merge pull request #26331 from ddstreet/tpm2_pcr_read

Tpm2 pcr read

2 years agosocket-util: fix socket_get_family()
Lennart Poettering [Tue, 7 Mar 2023 21:50:41 +0000 (22:50 +0100)] 
socket-util: fix socket_get_family()

Function didn't actually return anything useful. Quite a shame.

2 years agoMerge pull request #26693 from poettering/udev-loop-links
Lennart Poettering [Fri, 10 Mar 2023 08:34:31 +0000 (09:34 +0100)] 
Merge pull request #26693 from poettering/udev-loop-links

udev: add /dev/loop/by-inode/… + /dev/loop/by-ref/… loopback block device symlinks

2 years agoMerge pull request #26704 from poettering/mnt-nosymlinks
Lennart Poettering [Fri, 10 Mar 2023 08:34:04 +0000 (09:34 +0100)] 
Merge pull request #26704 from poettering/mnt-nosymlinks

Set MS_NOSYMFOLLOW for ESP + XBOOTLDR and many mount option clean-ups

2 years agorepart: Add support for reading mkfs options from environment
Daan De Meyer [Thu, 9 Mar 2023 19:33:04 +0000 (20:33 +0100)] 
repart: Add support for reading mkfs options from environment

2 years agoMerge pull request #26741 from poettering/acquire-fd-fixes
Lennart Poettering [Fri, 10 Mar 2023 08:33:20 +0000 (09:33 +0100)] 
Merge pull request #26741 from poettering/acquire-fd-fixes

trivial fixes to acquire_data_fd()

2 years agoload-fragment: add user credential specifiers to user.conf
Ronan Pigott [Tue, 28 Feb 2023 05:57:06 +0000 (22:57 -0700)] 
load-fragment: add user credential specifiers to user.conf

This enables the ManagerEnvironment= settings in the user's user.conf to
reference some user data like $HOME for the purpose of setting
environment variables derived from these values.

2 years agoMerge pull request #26734 from mrc0mmand/test-followups
Luca Boccassi [Fri, 10 Mar 2023 00:03:48 +0000 (00:03 +0000)] 
Merge pull request #26734 from mrc0mmand/test-followups

Assorted test tweaks

2 years agoMerge pull request #26731 from yuwata/mempressure-follow-ups
Luca Boccassi [Thu, 9 Mar 2023 22:35:29 +0000 (22:35 +0000)] 
Merge pull request #26731 from yuwata/mempressure-follow-ups

Mempressure follow ups

2 years agodata-fd-util: use fd_reopen() a bit more 26741/head
Lennart Poettering [Thu, 9 Mar 2023 21:56:53 +0000 (22:56 +0100)] 
data-fd-util: use fd_reopen() a bit more

2 years agofd-util: move ACQUIRE_NO_XYZ flags to the header the function using them is in
Lennart Poettering [Tue, 7 Mar 2023 21:50:02 +0000 (22:50 +0100)] 
fd-util: move ACQUIRE_NO_XYZ flags to the header the function using them is in

Follow-up for: b25a930f0e2ebe77bc8b0f0acfac8a3b27ef1f0a

2 years agomempress: change default PSI window duration to 2s
Lennart Poettering [Thu, 9 Mar 2023 11:34:23 +0000 (12:34 +0100)] 
mempress: change default PSI window duration to 2s

This changes the PSI window duration we default to for watching memory
pressure events from 1s to 2s. This is because apparently the kernel
will soon disallow window durations other than 2s for unprivileged
processes.

Hence, we'll bump the threshold from 100m to 200ms, and the window from
1s to 2s.

2 years agoupdate TODO 26693/head
Lennart Poettering [Mon, 6 Mar 2023 11:13:57 +0000 (12:13 +0100)] 
update TODO

2 years agotest: test new systemd-dissect --attach/--detach/--loop-ref= and /dev/loop/* symlinks
Lennart Poettering [Mon, 6 Mar 2023 12:23:48 +0000 (13:23 +0100)] 
test: test new systemd-dissect --attach/--detach/--loop-ref= and /dev/loop/* symlinks

Let's test that everything we just added works in combination.

2 years agomountpoint-util: add comment explaining why fstype_can_discard() can't use mount_opti... 26704/head
Lennart Poettering [Tue, 7 Mar 2023 11:21:10 +0000 (12:21 +0100)] 
mountpoint-util: add comment explaining why fstype_can_discard() can't use mount_option_supported()

2 years agomountpoint-util: add new fstype_can_umask() helper
Lennart Poettering [Tue, 7 Mar 2023 10:29:38 +0000 (11:29 +0100)] 
mountpoint-util: add new fstype_can_umask() helper

2 years agomountpoint-util: move 'norecovery' detection into its own helper call
Lennart Poettering [Tue, 7 Mar 2023 10:24:00 +0000 (11:24 +0100)] 
mountpoint-util: move 'norecovery' detection into its own helper call

And let's also ask the kernel explicitly for support.

2 years agomountpoint-util: use mount_option_supported() to detect if 'discard' is support for...
Lennart Poettering [Tue, 7 Mar 2023 10:19:56 +0000 (11:19 +0100)] 
mountpoint-util: use mount_option_supported() to detect if 'discard' is support for an fs

2 years agomountpoint-util: generalize mount_option_supported()
Lennart Poettering [Tue, 7 Mar 2023 10:19:35 +0000 (11:19 +0100)] 
mountpoint-util: generalize mount_option_supported()

2 years agogpt-auto-generator: port to partition_pick_mount_options() too
Lennart Poettering [Tue, 7 Mar 2023 09:52:01 +0000 (10:52 +0100)] 
gpt-auto-generator: port to partition_pick_mount_options() too

This way we'll have the same mount options in place if we boot via the
gpt generator, or if we mount a DDI locally.

Note that this will also enable MS_NOSYMFOLLOW on ESP and XBOOTLDR now,
if booted via gpt-auto-generator.

2 years agodissect-image: set MS_NOSYMFOLLOW for ESP/XBOOTLDR
Lennart Poettering [Tue, 7 Mar 2023 09:18:09 +0000 (10:18 +0100)] 
dissect-image: set MS_NOSYMFOLLOW for ESP/XBOOTLDR

When we mount a DDI, let's set MS_NOSYMFOLLOW for ESP/XBOOTLDR. They are
generally untrusted territory, (i.e. outside of
encryption/authentication via dm-crypt/dm-verity). Moreover they are
generally FAT, where symlinks don't exist anyway. Let's hence disable
symlinks for them.

This slightly refactors how we put together mount options for mounts,
splitting this out into a new helper call
dissected_partition_pick_options(), which we should be able to reuse
later in gpt-auto-generator, to ensure mounts via loopback as DDI and
those on bare metal get the same options.

2 years agotpm2: add tpm2_pcr_read() 26331/head
Dan Streetman [Tue, 21 Feb 2023 21:31:59 +0000 (16:31 -0500)] 
tpm2: add tpm2_pcr_read()

2 years agotest/test-tpm2: add tests for pcr selection functions
Dan Streetman [Tue, 28 Feb 2023 22:16:43 +0000 (17:16 -0500)] 
test/test-tpm2: add tests for pcr selection functions

2 years agotpm2: add/rename functions to manage pcr selections
Dan Streetman [Mon, 6 Feb 2023 16:31:59 +0000 (11:31 -0500)] 
tpm2: add/rename functions to manage pcr selections

This renames some functions to match other to/from_string() naming,
and allows better management of TPML_PCR_SELECTION and TPMS_PCR_SELECTION
structs.

2 years agotpm2: add TPM2_PCR_VALID()
Dan Streetman [Mon, 27 Feb 2023 11:44:13 +0000 (06:44 -0500)] 
tpm2: add TPM2_PCR_VALID()

2 years agotpm2: add tpm2_get_policy_digest()
Dan Streetman [Fri, 16 Dec 2022 21:33:08 +0000 (16:33 -0500)] 
tpm2: add tpm2_get_policy_digest()

2 years agotest/test-bitfield: add tests for bitfield macros
Dan Streetman [Thu, 2 Feb 2023 21:00:11 +0000 (16:00 -0500)] 
test/test-bitfield: add tests for bitfield macros

2 years agoudev: add /dev/loop/ symlinks
Lennart Poettering [Mon, 6 Mar 2023 11:55:59 +0000 (12:55 +0100)] 
udev: add /dev/loop/ symlinks

This adds symlinks that allow accessing loopback block devices via stable
names that reference their backing block devices, make the unpredictable
naming of loopback devices less of an issue.

Example:

1. Create a loopback block device for a file $F

   losetup --find $F

2. Reference the backing block device via its inode:

   L="$(stat -c '/dev/loop/by-inode/%Hd:%Ld-%i' $F)"
   fdisk $L

In the above the loop device name (which might be /dev/loop47 or any
other name) is not used at all.

2 years agodissect: shorten code a bit
Lennart Poettering [Mon, 6 Mar 2023 11:04:44 +0000 (12:04 +0100)] 
dissect: shorten code a bit

2 years agodissect: allow setting "lo_file_name" field of loopback block devices
Lennart Poettering [Mon, 6 Mar 2023 11:00:45 +0000 (12:00 +0100)] 
dissect: allow setting "lo_file_name" field of loopback block devices

When attaching a loopback file this allows us to set an explicit name
for it. This is useful since it allows a caller to pre-select a string
that is directly attached to the loopback file. Via udev rules we'l
later make the device accessible through this name.

Note that "lo_file_name" is supposed to carry a file name of the backing
file, but the kernel actually does not care or enforce any of that, it
just stores the filename and returns it later. This makes it so useful,
as userspace has total control of that field.

"lo_file_name" should not be confused with the sysattr
"loop/backing_file" which is actually maintained by the kernel itself,
and always shows the file to the backing inode without userspace having
direct control over the returned string. Because the sysattr is
generated by the kernel it is subject to file system namespacing and
everything, while "lo_file_name" is not, it's really just a string
passed through the kernel.

2 years agodissect: add commands for attaching/detaching loopback devices
Lennart Poettering [Mon, 6 Mar 2023 10:59:16 +0000 (11:59 +0100)] 
dissect: add commands for attaching/detaching loopback devices

Sometimes it is useful attaching DDIs without mounting them. We could
use "losetup" for that, but doing this in systemd-dissect has various
benefits:

1. we superficially validate the DDI first
2. we set the sector size depending on what we determine
3. we synchronously create the per-partition block devices

2 years agoloop-util: add API for selecting "lo_file_name" field for a loopback device
Lennart Poettering [Mon, 6 Mar 2023 11:07:57 +0000 (12:07 +0100)] 
loop-util: add API for selecting "lo_file_name" field for a loopback device

2 years agoloop-util: add call for setting the autoclear flag at arbitrary times
Lennart Poettering [Mon, 6 Mar 2023 11:07:18 +0000 (12:07 +0100)] 
loop-util: add call for setting the autoclear flag at arbitrary times

2 years agoloop-util: keep track of inode/devnum of backing file
Lennart Poettering [Mon, 6 Mar 2023 11:06:21 +0000 (12:06 +0100)] 
loop-util: keep track of inode/devnum of backing file

2 years agoudev-builtin-blkid: pick up info of backing file
Lennart Poettering [Mon, 6 Mar 2023 10:53:26 +0000 (11:53 +0100)] 
udev-builtin-blkid: pick up info of backing file

This adds support for retrieving info about the inode backing a loopback
file to udev-builtin-blkid. It will pick up the inode number and device
of the backing inode, as well as the lo_file_name[] array that the
loopback device maintains.

A later patch uses this information to create block device symlinks in
/dev/ that allow refering block devices by their backing inodes. This is
useful when separate tools set up a loopback device from those which
ultimately shall mount them, and there shall be a stable reference be
passed along. For example, we can add a new kernel option setuploop= or
so which allows setting up a block device via a generator, and still
have a way to safely reference later.

And yes, this doesn't directly have anything to do with the probing
libblkid does, but it's close enough, and we have the device open anyway
here, so the additional ioctl() here should not hurt.

2 years agoudev: add new udev_builtin_add_propertyf() helper
Lennart Poettering [Mon, 6 Mar 2023 10:52:33 +0000 (11:52 +0100)] 
udev: add new udev_builtin_add_propertyf() helper

2 years agodissect: add new helper dissected_partition_fstype()
Lennart Poettering [Tue, 7 Mar 2023 13:39:47 +0000 (14:39 +0100)] 
dissect: add new helper dissected_partition_fstype()

Initially we only have one user, but following patches will add more.

2 years agomountpoint-util: add helper that checks if MS_NOSYMFOLLOW is supported
Lennart Poettering [Mon, 6 Mar 2023 21:49:30 +0000 (22:49 +0100)] 
mountpoint-util: add helper that checks if MS_NOSYMFOLLOW is supported

2 years agomissing: add more defines to fsopen() definitions
Lennart Poettering [Tue, 7 Mar 2023 13:36:22 +0000 (14:36 +0100)] 
missing: add more defines to fsopen() definitions

2 years agomissing: add fsmount() syscall fallback definition
Lennart Poettering [Tue, 7 Mar 2023 13:36:03 +0000 (14:36 +0100)] 
missing: add fsmount() syscall fallback definition

2 years agobasic/bitfield: add bitfield operations
Dan Streetman [Thu, 2 Feb 2023 20:58:10 +0000 (15:58 -0500)] 
basic/bitfield: add bitfield operations

Add macros to manage bits in a bitfield (e.g. uint32_t, uint64_t, etc),
such as setting, clearing, checking bits, and iterating all set bits.

These are similiar to the bitmap operations, but operate on basic types
instead of requiring a Bitmap object.

2 years agosystem.conf: add default for memory pressure settings 26731/head
Yu Watanabe [Thu, 9 Mar 2023 12:58:42 +0000 (21:58 +0900)] 
system.conf: add default for memory pressure settings

Follow-up for #26393.

2 years agocore: add missing MemoryPressureWatch= and MemoryPressureThresholdSec= setting
Yu Watanabe [Thu, 9 Mar 2023 12:49:32 +0000 (21:49 +0900)] 
core: add missing MemoryPressureWatch= and MemoryPressureThresholdSec= setting

Follow-up for #26393.

Addresses https://github.com/systemd/systemd/pull/26393#issuecomment-1458655798.

2 years agotest: fall back to /sys/fs/cgroup/systemd if necessary 26734/head
Frantisek Sumsal [Thu, 9 Mar 2023 14:27:48 +0000 (15:27 +0100)] 
test: fall back to /sys/fs/cgroup/systemd if necessary

Necessary for some CI setups where we boot an nspawn container on a host
with older systemd with legacy hierarchy, so systemd mounts its stuff
under /sys/fs/cgroup/systemd.

2 years agoman: fix typo in ukify page
Jeidnx [Thu, 9 Mar 2023 13:43:39 +0000 (14:43 +0100)] 
man: fix typo in ukify page

2 years agotest: force mkfs.btrfs to overwrite any existing file systems
Frantisek Sumsal [Thu, 9 Mar 2023 12:50:15 +0000 (13:50 +0100)] 
test: force mkfs.btrfs to overwrite any existing file systems

mkfs.btrfs (unlike mkfs.ext4) checks if the target already contains
a file system and refuses to continue if so. This causes spurious fails
in case the random garbage on the temporary device matches a valid FS
header:

[   19.723806] testsuite-64.sh[355]: + udevadm lock --device=/dev/mapper/encbtrfs0 --device=/dev/mapper/encbtrfs1 --device=/dev/mapper/encbtrfs2 --device=/dev/mapper/encbtrfs3 mkfs.btrfs -M -d raid1 -m raid1 -L btrfs_mencdisk -U deadbeef-dead-dead-beef-000000000003 /dev/mapper/encbtrfs0 /dev/mapper/encbtrfs1 /dev/mapper/encbtrfs2 /dev/mapper/encbtrfs3
[   19.918934] testsuite-64.sh[2494]: ERROR: /dev/mapper/encbtrfs0 appears to contain an existing filesystem (hfsplus)
[   19.920490] testsuite-64.sh[2494]: ERROR: use the -f option to force overwrite of /dev/mapper/encbtrfs0

Let's force mkfs.btrfs to overwrite the file system in such case.

2 years agomanager: in dump, show controllers in "Delegate:"
Zbigniew Jędrzejewski-Szmek [Thu, 9 Mar 2023 08:27:31 +0000 (09:27 +0100)] 
manager: in dump, show controllers in "Delegate:"

After Delegate= was converted from boolean to a controller list, the dump
output was changed to have a separate line about the delegated controllers:

  ...
  DevicePolicy: auto
  DisableControllers:
  Delegate: yes
  ManagedOOMSwap: auto
  ManagedOOMMemoryPressure: auto
  ManagedOOMMemoryPressureLimit: 0.00%
  ManagedOOMPreference: none
  DelegateControllers: cpu memory pids
  ...

The line with "Delegate:" is redundant, it effectively shows if
"DelegateControllers:" is non-empty. It is nicer to keep the lines
about controllers adjacent. And to avoid duplicate output, Delegate:
will now show which controllers are enabled. This makes the output
for that line again match the configuration stanza Delegate=:

  DisableControllers:
  Delegate: cpu io memory pids
  ManagedOOMSwap: auto
  ManagedOOMMemoryPressure: auto
  ManagedOOMMemoryPressureLimit: 0.00%
  ManagedOOMPreference: none
  MemoryPressureWatch: auto
  MemoryPressureThresholdSec: 100ms

Dump output is for debugging, we don't need to maintain strict
backwards-compat.

2 years agojournalctl: fix when --since, --until and --lines are used altogether
Mike Yuan [Thu, 9 Mar 2023 08:51:24 +0000 (16:51 +0800)] 
journalctl: fix when --since, --until and --lines are used altogether

This is a follow-up for #26669 (81fb5375b3b3bfc22d023d7908ad9eee4b3c1ffb).

After the mentioned commit, we stopped checking if the
entry is within the range of --until if --lines is used.

However, when --since, --until and --lines=N are used
altogether, and the number of lines between --since
and --until is smaller than N, we would seek to --since
later (f58269510727964cb5c10e7d2f9849c442ea1f80).
This breaks the assumption that if --lines is set,
the boundary is never exceeded because the counter of
outputs gets us covered.

2 years agotests: merge test-tmpfiles.c into test-tmpfile-util.c
Zbigniew Jędrzejewski-Szmek [Thu, 9 Mar 2023 10:04:20 +0000 (11:04 +0100)] 
tests: merge test-tmpfiles.c into test-tmpfile-util.c

The former was added in 65b3903ff576488eaabb51d3c4fbf9c73d867d7c,
but the name is confusing: the test has nothing to do with systemd-tmpfiles.
It had one function that mostly tested functions from tmpfile-util.c, so
just move it into the latter.

2 years agotest: don't fail if we can't remove the scsi_debug module
Frantisek Sumsal [Thu, 9 Mar 2023 12:32:56 +0000 (13:32 +0100)] 
test: don't fail if we can't remove the scsi_debug module

Let's make the cleanup 'best effort' operation, as sometimes we might
not be able to remove the scsi_debug module, and we don't really care
if it stays loaded:

[   88.521333] testsuite-17.sh[1827]: ID_TEST=test
[   88.522015] testsuite-17.sh[1679]: + rmmod scsi_debug
[   88.524795] testsuite-17.sh[1828]: rmmod: ERROR: Module scsi_debug is in use
[   88.527786] testsuite-17.sh[1679]: + cleanup_17_10

2 years agotest: bump the D-Bus related timeouts to 120s
Frantisek Sumsal [Thu, 9 Mar 2023 12:27:57 +0000 (13:27 +0100)] 
test: bump the D-Bus related timeouts to 120s

Let's attempt to reduce the amount of flakes further when the AWS region
we run in is under heavy load and the hypervisor stars stealing our CPU
time.

Follow-up to e0cbb73911 and c78d18215b.

2 years agotest/test-macro: add tests for FOREACH_VA_ARGS()
Dan Streetman [Sun, 26 Feb 2023 13:02:16 +0000 (08:02 -0500)] 
test/test-macro: add tests for FOREACH_VA_ARGS()

2 years agobasic/macro: add macro to iterate variadic args
Dan Streetman [Thu, 2 Feb 2023 20:58:10 +0000 (15:58 -0500)] 
basic/macro: add macro to iterate variadic args

2 years agotest: ignore `busctl tree` fails
Frantisek Sumsal [Thu, 9 Mar 2023 10:34:14 +0000 (11:34 +0100)] 
test: ignore `busctl tree` fails

As the test runs during machine bootup where jobs run in parallel,
busctl might attempt to introspect a job that already finished and fail.
Since in this case we're more interested in crashes/leaks, let's ignore
the exit code.

Follow-up to 16600a8661.

2 years agoMerge pull request #26038 from lilyinstarlight/fix/fstab-generator-sysroot-without...
Zbigniew Jędrzejewski-Szmek [Thu, 9 Mar 2023 07:51:31 +0000 (08:51 +0100)] 
Merge pull request #26038 from lilyinstarlight/fix/fstab-generator-sysroot-without-cmdline

fstab-generator: use correct targets when /sysroot is specificied in fstab only

2 years agomacro: support the case that the number of elements has const qualifier
Yu Watanabe [Thu, 9 Mar 2023 04:14:12 +0000 (13:14 +0900)] 
macro: support the case that the number of elements has const qualifier

Follow-up for 5716c27e1f52d2aba9dd02916c01d6271d9d0b16.

Addresses https://github.com/systemd/systemd/pull/26303#issuecomment-1460712007.

2 years agoMerge pull request #26698 from ldv-alt/udevadm-verify
Yu Watanabe [Thu, 9 Mar 2023 04:05:57 +0000 (13:05 +0900)] 
Merge pull request #26698 from ldv-alt/udevadm-verify

Implement a udev rules syntax checker in the form of
`udevadm verify [OPTIONS] FILE...` command that is based on
`udev_rules_parse_file` interface and would apply further checks
on top of it in the future.

Resolves: #26606

2 years agolocaled: print a custom message if libxkbcommon.so is unvailable
Zbigniew Jędrzejewski-Szmek [Wed, 8 Mar 2023 17:59:14 +0000 (18:59 +0100)] 
localed: print a custom message if libxkbcommon.so is unvailable

Follow-up for 82c2095a5e407bcf041dc7bde84791deec95ff9c.

> I feel like the logging here may be a bit confusing on the new path.
> Previously you did get a message that explained what was going on. Now you get
> an info message that the layout could not be compiled, and … that's all. I can
> imagine this being a confusing red herring if someone was trying to debug a
> problem and saw this message. Perhaps we should log something else instead/as
> well, on the case where libxkbcommon isn't present, to say that's what we're
> logging about and it just means we can't validate the configuration, not that
> it's definitely invalid?

2 years agoMerge pull request #26119 from kraxel/uki.install
Luca Boccassi [Wed, 8 Mar 2023 21:25:25 +0000 (21:25 +0000)] 
Merge pull request #26119 from kraxel/uki.install

kernel-install: improve uki handling

2 years agoMerge pull request #26656 from yuwata/mkdir-error-code
Luca Boccassi [Wed, 8 Mar 2023 21:23:07 +0000 (21:23 +0000)] 
Merge pull request #26656 from yuwata/mkdir-error-code

mkdir: fix error code

2 years agoCODING_STYLE: note that 'unsigned' form is preferred over 'unsigned int'
Dmitry V. Levin [Wed, 8 Mar 2023 20:00:00 +0000 (20:00 +0000)] 
CODING_STYLE: note that 'unsigned' form is preferred over 'unsigned int'

2 years agoMerge pull request #26711 from keszybz/man-page-stuff
Luca Boccassi [Wed, 8 Mar 2023 20:29:18 +0000 (20:29 +0000)] 
Merge pull request #26711 from keszybz/man-page-stuff

Man page tweaks

2 years agoudev_rules_parse_file: issue diagnostics about line continuation at EOF 26698/head
Dmitry V. Levin [Wed, 8 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
udev_rules_parse_file: issue diagnostics about line continuation at EOF

When udev rules file ends with a line continuation, the parser
used to silently ignore the line without any diagnostics at all.
It's time to break the vow of silence and let the parser issue some
error diagnostics.

2 years agoMerge pull request #26716 from mrc0mmand/more-tests
Luca Boccassi [Wed, 8 Mar 2023 18:55:40 +0000 (18:55 +0000)] 
Merge pull request #26716 from mrc0mmand/more-tests

test: add a couple of tests for systemd-escape and systemd-id128

2 years agotest: check udevadm verify diagnostics of unused labels
Dmitry V. Levin [Mon, 6 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
test: check udevadm verify diagnostics of unused labels

2 years agoudevadm-verify: check for unused labels
Dmitry V. Levin [Sun, 5 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
udevadm-verify: check for unused labels

Check for unused labels in the specified udev rules files, report such
labels and exit with a non-zero exit code if any unused labels are
found.

2 years agotest: add a test for udevadm verify
Dmitry V. Levin [Sat, 4 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
test: add a test for udevadm verify

2 years agomeson.build: check udev rules using udevadm verify
Dmitry V. Levin [Fri, 3 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
meson.build: check udev rules using udevadm verify

Although udev rules are already being checked by rule-syntax-check.py
script, also check them using udevadm verify which performs more
thorough checks.

2 years agorules: do not use blkid builtin if built without blkid support
Dmitry V. Levin [Tue, 7 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
rules: do not use blkid builtin if built without blkid support

When built without blkid, then udev-builtin-blkid is not built,
and the verifier warns about the unknown builtin:

60-persistent-storage.rules:114 Unknown builtin command: blkid --hint=session_offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}
60-persistent-storage.rules:117 Unknown builtin command: blkid --noraid
60-persistent-storage.rules:120 Unknown builtin command: blkid
60-persistent-storage.rules: udev rules check failed

2 years agoudevadm: introduce new 'verify' command
Dmitry V. Levin [Thu, 2 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
udevadm: introduce new 'verify' command

We seem to have no tool to verify udev rule files.  There is a simple
udev rules syntax checker in the tree, test/rule-syntax-check.py, but
it is too simple to detect less trivial issues not detected by udev,
e.g. redundant comparisons (#26593) or labels without references.

Such a tool would be beneficial not only for maintaining udev rules
distributed along with udev, but also and even more so for maintaining
third party udev rules that are more likely to have issues with syntax
and semantic correctness.

Implement a udev rules syntax and semantics checker in the form of
'udevadm verify [OPTIONS] FILE...' command that is based on
udev_rules_parse_file() interface and would apply further checks
on top of it in subsequent commits.

Resolves: #26606

2 years agoudev_rules_parse_file: mark logged issues
Dmitry V. Levin [Wed, 1 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
udev_rules_parse_file: mark logged issues

Traditionally, all issues found in udev rules by udev_rules_parse_file()
are logged and ignored, so there was no mechanism to propagate the
information about these issues back to the caller.

Introduce such a mechanism by adding a new member to UdevRuleFile.
This new member is a bitmask describing which log levels were used
in messages logged with regards to the rule file.

This mechanism is going to be used by udevadm verify in subsequent
commits.

2 years agoMerge pull request #26678 from yuwata/foreach_array
Zbigniew Jędrzejewski-Szmek [Wed, 8 Mar 2023 18:06:20 +0000 (19:06 +0100)] 
Merge pull request #26678 from yuwata/foreach_array

macro: introduce FOREACH_ARRAY() macro

2 years agocore: log message when reloading finishes
Luca Boccassi [Wed, 8 Mar 2023 12:59:40 +0000 (12:59 +0000)] 
core: log message when reloading finishes

Reloading might be slow, especially when under memory pressure, and watchdogs
might be triggered. It is useful to have timestamped telemetry in the journal
to see how long a reload takes.

2 years agotest: add a couple of tests for systemd-id128 26716/head
Frantisek Sumsal [Wed, 8 Mar 2023 15:18:09 +0000 (16:18 +0100)] 
test: add a couple of tests for systemd-id128

2 years agotest: add a couple of tests for systemd-escape
Frantisek Sumsal [Wed, 8 Mar 2023 14:40:34 +0000 (15:40 +0100)] 
test: add a couple of tests for systemd-escape

2 years agorandom-seed: drop extraneous "we"
Frantisek Sumsal [Wed, 8 Mar 2023 11:58:28 +0000 (12:58 +0100)] 
random-seed: drop extraneous "we"

2 years agoMerge pull request #26713 from keszybz/man-getenv
Yu Watanabe [Wed, 8 Mar 2023 15:16:30 +0000 (00:16 +0900)] 
Merge pull request #26713 from keszybz/man-getenv

Add note to docs that setenv() cannot be called in parallel with getenv()

2 years agoman: use more references 26713/head
Zbigniew Jędrzejewski-Szmek [Tue, 7 Mar 2023 19:26:20 +0000 (20:26 +0100)] 
man: use more references

2 years agoman: add mention that libsystemd uses getenv()
Zbigniew Jędrzejewski-Szmek [Tue, 7 Mar 2023 19:25:58 +0000 (20:25 +0100)] 
man: add mention that libsystemd uses getenv()

See #26688: getenv() is not thread-safe, and could a possible source of
problems when a multi-threaded program calls setenv()/putenv()/unsetenv() in
parallel. It is not possible to avoid getenv() calls in general, since $PATH,
$LANG, $SHELL, $USER, $HOME, $TZ may need to be accessed at any time.
Add a warning to our docs so that people are aware of the issue.

Closes #26688. (Real fixes will need to be in glibc and gnome-shell or other
programs.)

The text is added to threads-aware.xml to be included in various places. By
including it in libsystemd-pkgconfig.xml, it is automatically added to all sd-*
pages. The text is also included explicitly in pages for a few other functions
which are call getenv().

2 years agotimesync: stop re-sync on network configuration change when no link servers are confi...
Chitoku [Wed, 8 Mar 2023 10:52:55 +0000 (19:52 +0900)] 
timesync: stop re-sync on network configuration change when no link servers are configured (#26708)

This commit fixes an issue where systemd-timesyncd re-synchronizes the
system clock every time the network configuration is updated, no matter
whether link servers are actually changed.

Fixes a bug introduced by e05dd7718d0b32e039c9e0f7bf3875079d1a359d.

2 years agolocaled: skip verification when libxkbcommon is not installed
Zbigniew Jędrzejewski-Szmek [Wed, 8 Mar 2023 08:11:22 +0000 (09:11 +0100)] 
localed: skip verification when libxkbcommon is not installed

When compliled without libxkbcommon, we do no verification and accept the
arguments as given. When compliled against with, if dlopen() works, we do the
verification. But if dlopen() fails, we would refuse the call and return
SD_BUS_ERROR_INVALID_ARGS. 5de344704df64d8f31448f1222432bc87ddcfbef added things
this way when converting to dlopen(), but it seems not very useful: it can be
expected that when the library is supported but missing at runtime, we degrade
softly, and that the behaviour is something inbetween the cases of hard disable
at compilation time and full support. But right now we behave more strictly then
if disabled at compilation. Change the code to just warn if dlopen fails, but
accept the arguments.

(There are various minimization scenarios where forcing the installation of
libxkbcommon is not useful. E.g. a small installation where we want to set the
keymap via logind, but the configuration is managed by a configuration
management system and is known to be valid. Verification via libxkbcommon is
just overhead in this case.)

800f65f827c9828d4c872d44b19ca8a008505690 moved the check earlier, so now even
a noop case of setting the values that were already in place can fail.
C.f. https://bugzilla.redhat.com/show_bug.cgi?id=2175244.

2 years agoMerge pull request #26685 from yuwata/man-missing-services
Zbigniew Jędrzejewski-Szmek [Wed, 8 Mar 2023 08:35:03 +0000 (09:35 +0100)] 
Merge pull request #26685 from yuwata/man-missing-services

man: mention two missing services

2 years agotest: add a couple of tests for busctl
Frantisek Sumsal [Tue, 7 Mar 2023 17:44:20 +0000 (18:44 +0100)] 
test: add a couple of tests for busctl

2 years agoMerge pull request #26706 from jengelh/master
Luca Boccassi [Tue, 7 Mar 2023 21:34:03 +0000 (21:34 +0000)] 
Merge pull request #26706 from jengelh/master

doc: various orthographic fixes

2 years agoMerge pull request #26695 from poettering/dissect-mount-helper
Luca Boccassi [Tue, 7 Mar 2023 20:07:17 +0000 (20:07 +0000)] 
Merge pull request #26695 from poettering/dissect-mount-helper

make "systemd-dissect --mount" available as /sbin/mount.ddi

2 years agoman: adjust description of CPUAccounting= 26711/head
Zbigniew Jędrzejewski-Szmek [Tue, 7 Mar 2023 15:09:35 +0000 (16:09 +0100)] 
man: adjust description of CPUAccounting=

For any user on a semi-recent kernel, effectively this setting is pointless.
We should deprecate it once not needed anymore for the v1 hierarchy. For
now, adjust the description.

2 years agoman: add a note about session autogrouping
Zbigniew Jędrzejewski-Szmek [Tue, 7 Mar 2023 15:08:16 +0000 (16:08 +0100)] 
man: add a note about session autogrouping

When cpu controller is disabled, thing would often still behave as if
it was. And since the cpu controller can be enabled "magically" e.g. by
starting user@1000, add a note for users to be careful. Autogrouping
is described well in the man page, incl. how to enable or disable it,
so it should be enough to refer to that.

2 years agoman: tweak details in descriptions of pids and cpu configuration
Zbigniew Jędrzejewski-Szmek [Tue, 7 Mar 2023 15:06:23 +0000 (16:06 +0100)] 
man: tweak details in descriptions of pids and cpu configuration

For CPUWeight=: there is an important distinction between our default of
[not set], and the kernel default of "100". Let's not say that our default
is "100" because then 'systemctl show' output is hard to explain.

For task accounting, it's the kernel that does the accounting, not systemd.

2 years agoman: describe how cgroup controllers are turned on
Zbigniew Jędrzejewski-Szmek [Tue, 7 Mar 2023 15:02:14 +0000 (16:02 +0100)] 
man: describe how cgroup controllers are turned on

For a user, information which cgroup controllers are enabled based on
the unit configuration is rather important. Not only because it determines
what resource control is peformed by the kernel, but also because controllers
have a non-negligible cost, especially for deep nesting, and users may want
to *not* have controllers enabled.

Our documentation did its best to avoid the topic so far. This was partially
caused by the support for cgroup v1, which meant that any discussion of
controllers had to be conditional and messy. But v1 is deprecated on its way
out, so it should be fine to just describe what happens with v2.

The text is extended with a discussion of how controllers are enabled and
disabled, and an example, and for various settings that enable controllers
the relevant controller is now mentioned.

2 years agoman: explain route-only domains a bit more
Zbigniew Jędrzejewski-Szmek [Tue, 7 Mar 2023 12:48:09 +0000 (13:48 +0100)] 
man: explain route-only domains a bit more

The details discussion of how search and route-only domains work is in
systemd-resolved.service(8). But users are more likely to look at
resolved.conf(5), because that's where Domains= is described. So let's add a
reference to the other man page there, and also strengthen the text a bit. In
particular, in systemd-resolved.service(8) we say "route-only", which makes
the distinction with search domains clearer. Let's use the same in the other
man page too.

This is based on feedback from Lukáš Nykrýn that the man page is not clear
enough.

2 years agoMerge pull request #26709 from DaanDeMeyer/mkosi-drop-debug
Daan De Meyer [Tue, 7 Mar 2023 14:49:06 +0000 (15:49 +0100)] 
Merge pull request #26709 from DaanDeMeyer/mkosi-drop-debug

mkosi: Various cleanups

2 years agomkosi: Fix locations of mkosi-check-and-shutdown files 26709/head
Daan De Meyer [Tue, 7 Mar 2023 14:24:13 +0000 (15:24 +0100)] 
mkosi: Fix locations of mkosi-check-and-shutdown files

2 years agomkosi: Drop debug logging
Daan De Meyer [Tue, 7 Mar 2023 14:23:35 +0000 (15:23 +0100)] 
mkosi: Drop debug logging

The spurious "connection timed out" errors from nspawn should be
fixed now that we're running the latest version.

2 years agomkosi: Drop kernel command line masking in CI
Daan De Meyer [Tue, 7 Mar 2023 14:22:59 +0000 (15:22 +0100)] 
mkosi: Drop kernel command line masking in CI

These services should be disabled by default and not need explicit
masking anymore.

2 years agomkosi: Update to latest
Daan De Meyer [Tue, 7 Mar 2023 14:25:02 +0000 (15:25 +0100)] 
mkosi: Update to latest

So that we don't enable services by default anymore on Debian.

2 years agodoc: correct wrong use "'s" contractions 26706/head
Jan Engelhardt [Tue, 7 Mar 2023 11:51:31 +0000 (12:51 +0100)] 
doc: correct wrong use "'s" contractions

2 years agodoc: replace wrong idiom in homed comment
Jan Engelhardt [Tue, 7 Mar 2023 12:06:14 +0000 (13:06 +0100)] 
doc: replace wrong idiom in homed comment

2 years agodoc: replace wrong á preposition by à
Jan Engelhardt [Tue, 7 Mar 2023 12:04:21 +0000 (13:04 +0100)] 
doc: replace wrong á preposition by à