Commit Graph
42069 Commits
Author SHA1 Message Date
Lennart Poettering 07d6072e0e 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
2023-03-09 16:40:55 +01:00
Lennart Poettering 999ac3e2b0 loop-util: add API for selecting "lo_file_name" field for a loopback device 2023-03-09 16:40:55 +01:00
Lennart Poettering d2430d5097 loop-util: add call for setting the autoclear flag at arbitrary times 2023-03-09 16:40:55 +01:00
Lennart Poettering 4d2a9e3ea6 loop-util: keep track of inode/devnum of backing file 2023-03-09 16:40:55 +01:00
Lennart Poettering be86e98350 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.
2023-03-09 16:40:55 +01:00
Lennart Poettering 85737dd378 udev: add new udev_builtin_add_propertyf() helper 2023-03-09 16:40:55 +01:00
Zbigniew Jędrzejewski-Szmek 7b3693e4e4 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.
2023-03-09 21:36:38 +09:00
Mike Yuan 5d2ab010df journalctl: fix when --since, --until and --lines are used altogether
This is a follow-up for #26669 (81fb5375b3).

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 (f582695107).
This breaks the assumption that if --lines is set,
the boundary is never exceeded because the counter of
outputs gets us covered.
2023-03-09 21:36:12 +09:00
Zbigniew Jędrzejewski-Szmek b2d3e2a0dc tests: merge test-tmpfiles.c into test-tmpfile-util.c
The former was added in 65b3903ff5,
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.
2023-03-09 21:35:53 +09:00
Zbigniew Jędrzejewski-Szmek ba0e70673c Merge pull request #26038 from lilyinstarlight/fix/fstab-generator-sysroot-without-cmdline
fstab-generator: use correct targets when /sysroot is specificied in fstab only
2023-03-09 08:51:31 +01:00
Yu Watanabe b9872fe1dd macro: support the case that the number of elements has const qualifier
Follow-up for 5716c27e1f.

Addresses https://github.com/systemd/systemd/pull/26303#issuecomment-1460712007.
2023-03-09 08:41:43 +01:00
Yu Watanabe 00aba43fe6 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
2023-03-09 13:05:57 +09:00
Zbigniew Jędrzejewski-Szmek 080ecabfd7 localed: print a custom message if libxkbcommon.so is unvailable
Follow-up for 82c2095a5e.

> 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?
2023-03-09 11:16:13 +09:00
Luca Boccassi 25a45b0dd1 Merge pull request #26119 from kraxel/uki.install
kernel-install: improve uki handling
2023-03-08 21:25:25 +00:00
Luca Boccassi 2ca6f09b30 Merge pull request #26656 from yuwata/mkdir-error-code
mkdir: fix error code
2023-03-08 21:23:07 +00:00
Luca Boccassi 79fb1d4e7e Merge pull request #26711 from keszybz/man-page-stuff
Man page tweaks
2023-03-08 20:29:18 +00:00
Dmitry V. Levin b27e5e2aca 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.
2023-03-08 18:55:40 +00:00
Luca Boccassi 82c63b0731 Merge pull request #26716 from mrc0mmand/more-tests
test: add a couple of tests for systemd-escape and systemd-id128
2023-03-08 18:55:40 +00:00
Dmitry V. Levin 7a771d1da6 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.
2023-03-08 18:55:40 +00:00
Dmitry V. Levin acdba85e0e 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
2023-03-08 18:55:40 +00:00
Dmitry V. Levin 4f5de15731 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.
2023-03-08 18:55:40 +00:00
Zbigniew Jędrzejewski-Szmek ad078f59fa Merge pull request #26678 from yuwata/foreach_array
macro: introduce FOREACH_ARRAY() macro
2023-03-08 19:06:20 +01:00
Luca Boccassi af2fb2f250 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.
2023-03-08 18:41:07 +01:00
Frantisek Sumsal 8fc58b35ea random-seed: drop extraneous "we" 2023-03-08 16:28:37 +01:00
Chitoku 0f9c8d0291 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 e05dd7718d.
2023-03-08 19:52:55 +09:00
Zbigniew Jędrzejewski-Szmek 82c2095a5e 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. 5de344704d 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.)

800f65f827 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.
2023-03-08 19:44:12 +09:00
Luca Boccassi e079120505 Merge pull request #26706 from jengelh/master
doc: various orthographic fixes
2023-03-07 21:34:03 +00:00
Luca Boccassi ce0cac4c8e Merge pull request #26695 from poettering/dissect-mount-helper
make "systemd-dissect --mount" available as /sbin/mount.ddi
2023-03-07 20:07:17 +00:00
Zbigniew Jędrzejewski-Szmek 695e39dd63 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.
2023-03-07 16:22:13 +01:00
Jan Engelhardt 18fe76eba5 doc: correct wrong use "'s" contractions 2023-03-07 13:39:31 +01:00
Jan Engelhardt e6faa51a84 doc: replace wrong idiom in homed comment 2023-03-07 13:06:43 +01:00
Jan Engelhardt 3ff1721c21 doc: replace wrong á preposition by à 2023-03-07 13:06:43 +01:00
Luca Boccassi 0531ac585a Merge pull request #26648 from bluca/kernel_install_guid
kernel-install: also try to find $BOOT by partition GUID
2023-03-07 11:26:12 +00:00
Yu Watanabe 9d0d39ee53 conf-files: fix potential memleak in conf_files_list_strv_internal() on failure
This also changes the used hash_ops from path_hash_ops to
string_hash_ops, as the key is not a path, but a filename.
2023-03-07 18:43:34 +09:00
Gerd Hoffmann 3d5f0bfe4e kernel-install: handle uki installs automatically
Detect image type using "bootctl kernel-identify $kernel",
store result in KERNEL_INSTALL_IMAGE_TYPE.

Extend layout autodetection to check the kernel image type
and pick layout=uki for UKIs.

Resolves: #25822
2023-03-07 08:14:46 +01:00
Gerd Hoffmann c7314ee7e2 90-uki-copy.install: create $BOOT/EFI/Linux directory if needed
Do not consider a missing 'Linux' subdirectory an error.
Just create it instead.
2023-03-07 08:14:46 +01:00
Gerd Hoffmann 78088b8f43 bootctl: tweak DOS header magic check
Read the magic first, try reading the full DOS exe header only in case
the magic check succeeds.

This avoids throwing an header read error on small dummy files as used
by test-kernel-install.
2023-03-07 08:14:46 +01:00
Yu Watanabe 9ecacf1eae systemctl: port FOREACH_ARRAY() to systemctl-list-units.c 2023-03-07 13:27:18 +09:00
Yu Watanabe 5716c27e1f macro: introduce FOREACH_ARRAY() macro
The pattern that runs all array element is quite common.
But, sometimes, the number of element may be in a signed integer, or the
array may be NULL.
2023-03-07 13:27:16 +09:00
Yu Watanabe 9200e520ad Merge pull request #26669 from YHNdnzj/journalctl-lines-since-until
journalctl: fix output when --lines is used with --since or --until
2023-03-07 12:02:47 +09:00
Joshua Goins ebc03f5d7a udev: Don't mark as tablet if device has relative coordinates
Tablets don't typically have relative coordinates (they are separated on
the kernel device layer). However, some Logitech mice report similar
supported events, so use the existence of EV_REL to determiner whether or
not the device is really a tablet.

Fixes bug introduced by 0855ce6772.

Fixes: #26600
2023-03-07 09:42:11 +09:00
Lennart Poettering a164d9d5aa dissect: implement external helper plugin interface for /bin/mount
With this change we'll install a symlink /sbin/mount.ddi →
systemd-dissect. If invoked that way we'll do the equivalent of
systemd-dissect --mount.

This makes DDIs mountable directly via the "mount" command, by
specifying the "-t ddi" pseudo file system type. Moreover you can now
mount DDIs directly via /etc/fstab, by specifying "ddi" in the file
system column (3rd column).
2023-03-06 22:52:20 +01:00
Luca Boccassi df40b7ef5a Merge pull request #26686 from yuwata/iovec
tree-wide: replace IOVEC_INIT with IOVEC_MAKE
2023-03-06 21:00:04 +00:00
Josef Miegl 417283c5c3 network: geneve: add InheritInnerProtocol flag 2023-03-06 20:58:30 +00:00
Adrian Vovk 27e695840c base-filesystem: Support Arch-style multilib
On distros like Arch and on carbonOS, libraries end up in /usr/lib.
Thus, /lib64 should point to /usr/lib. This commit adds this
functionality as a final fallback (if neither Debian-style nor
Fedora-style multilib can be detected)
2023-03-06 20:53:43 +00:00
Luca Boccassi db73b9d2ab Merge pull request #26502 from DaanDeMeyer/chase-symlinks-additions
Several chase_symlinks() additions
2023-03-06 20:51:06 +00:00
Luca Boccassi 52bdfbf7d7 Merge pull request #26687 from yuwata/c2x
C2X support
2023-03-06 20:50:17 +00:00
Yu Watanabe 84d0dc53ac time-util: drop redundant call of tzset()
It is also called at the beginning of `parse_timestamp_maybe_with_tz()`.
2023-03-06 20:39:37 +00:00
Adrian Vovk d249c23211 gpt-auto: Check for /boot before putting ESP there
We prefer /efi as a mount point for the ESP, and use /boot as a fallback
if /efi doesn't exist. However, when root=tmpfs, neither /efi nor /boot
exist. gpt-auto should mount to /efi in this case, but it mounted to
/boot instead. This is because gpt-auto didn't check for the existence
of /boot. Here, we correct this
2023-03-06 20:37:57 +00:00
Daan De Meyer 9a98c0f2b1 chase-symlinks: Add chase_symlinks_at_and_open() 2023-03-06 13:53:01 +01:00