1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-18 10:04:04 +03:00

52380 Commits

Author SHA1 Message Date
Ivan Kruglov
22cd741ff1 machine: split operation initialization into two steps 2024-12-17 18:56:28 +01:00
Ivan Kruglov
bf4066ece0 machine: adjust operation callback logic for varlink
This is to simplyfy varlink callback. There is no use of this logic atm.
So, no harm.
2024-12-17 18:56:28 +01:00
Lennart Poettering
8d08f18b52
discover-image: modernize image discovery around O_PATH (#35513)
let's always pin the image fd as early as we can, then derive all
properties off it, to have a consistent view on things.
2024-12-17 17:39:59 +01:00
Lennart Poettering
00a415fc8f tree-wide: remove support for kernels lacking ambient caps
Let's bump the kernel baseline a bit to 4.3 and thus require ambient
caps.

This allows us to remove support for a variety of special casing, most
importantly the ExecStart=!! hack.
2024-12-17 17:34:46 +01:00
Daan De Meyer
96ec3911f3
machine: introduce io.systemd.Machine.{MapFrom, MapTo} methods (#35064)
This PR introduces varlink's alternatives to the following DBus methods:
- MapFromMachineUser
- MapToMachineUser
- MapFromMachineGroup
- MapToMachineGroup
2024-12-17 16:51:51 +01:00
Antonio Alvarez Feijoo
5aab7ad075 boot: do not build test-hwids-section.c if ukify is disabled
Otherwise the build fails:

```
[22/3075] Generating src/boot/test-hwids-section.c with a custom command (wrapped by meson to capture output)
FAILED: src/boot/test-hwids-section.c
/usr/bin/meson --internal exe --capture src/boot/test-hwids-section.c -- /usr/bin/python3.10 /mnt/work/systemd/upstream-fork/main/src/boot/generate-hwids-section.py /mnt/work/systemd/upstream-fork/main/src/boot/hwids
--- stderr ---
Traceback (most recent call last):
  File "/mnt/work/systemd/upstream-fork/main/src/boot/generate-hwids-section.py", line 12, in <module>
    import ukify
  File "/mnt/work/systemd/upstream-fork/main/src/boot/../ukify/ukify.py", line 61, in <module>
    import pefile  # type: ignore
ModuleNotFoundError: No module named 'pefile'
```

Follow-up for 640f8c3eb8dc21539500e92a5c69cdb6cbda3381
2024-12-17 11:15:39 +00:00
Ivan Kruglov
8351463f67 machine: introduce io.systemd.Machine.{MapFrom, MapTo} methods 2024-12-17 11:25:24 +01:00
Lennart Poettering
98e28335b7 discover-image: modernize image discovery around O_PATH
let's always pin the image fd as early as we can, then derive all
properties off it, to have a consistent view on things.
2024-12-17 11:21:57 +01:00
Lennart Poettering
476b7c3a68 discover-image: make sure quota logic works on O_PATH fds 2024-12-17 11:21:57 +01:00
Lennart Poettering
abeedbde90 btrfs-util: make sure btrfs_subvol_get_info_fd() works on O_PATH fds 2024-12-17 11:21:57 +01:00
Lennart Poettering
e837c257d0 chattr-util: move O_PATH conversion from read_attr_at() to read_attr_fd() 2024-12-17 11:19:55 +01:00
Yu Watanabe
c195fdba12
test: Add CHID matching test (#35532) 2024-12-17 13:21:04 +09:00
Yu Watanabe
47f58740aa
core: make ProtectHostname= optionally take a hostname (#35626)
Closes #35623.
2024-12-17 13:20:08 +09:00
Yu Watanabe
b58b00e4c3 systemctl-edit: ignore ENOENT from unit_is_masked()
If a specified unit does not exist, then it is definitely not masked.

Fixes #35632.
2024-12-17 13:19:35 +09:00
Yu Watanabe
a4d1891475 meson: allow to customize the access mode for tty/pts devices
Then, switch the default value to "0600", due to general security
concerns about terminals being written to by other users.

Closing #35599.
2024-12-16 21:36:07 +00:00
Lennart Poettering
0543b02cf8 networkd: show wireguard private key read error number
Noticed while looking at #35641
2024-12-16 18:54:57 +00:00
anonymix007
640f8c3eb8 test: Add test-chid-match 2024-12-16 21:02:54 +03:00
Yu Watanabe
7c4e351861 boot: introduce smbios_raw_info_get_cached() to cache populated SMBIOS raw info
Then, drop cache in smbios_info_populate().
No functional change, just refactoring and preparation for later commit.
2024-12-16 21:02:54 +03:00
anonymix007
f28cedfa31 boot: Add chid.c to libefitest
Also fix compilation for testing CHID matching in userspace
2024-12-16 21:02:54 +03:00
anonymix007
48acd7fe90 boot: Deduplicate efi.h and efi-fundamental.h
These definitions are needed for both userspace and EFI, so keep them in efi-fundamental.h
2024-12-16 21:02:54 +03:00
Yu Watanabe
e76fcd0e40 core: make ProtectHostname= optionally take a hostname
Closes #35623.
2024-12-16 23:55:44 +09:00
Yu Watanabe
0d298a771a core/exec-invoke: fix ProtectHostname= value in log message
Follow-up for cf48bde7aea52b18ac3fa218d3f60fd3d533ef66.
2024-12-16 23:55:44 +09:00
Federico Giovanardi
7fd45eec37 udev: add option to trigger parent devices despite filters
This commit add the `-i` option to `udevadm trigger` that force it to
match parent devices even if they're excluded from filters.
The rationale is that some embedded devices have a huge number of
platform devices ( ~ 4k for MX8 ) they are there because they're defined
in the device tree but there isn't any action or udev rules associated
with them.

So at boot a significant time is spend triggering and processing rules
for devices that don't produce any effect and we would like to filter
them by calling:

```
udevadm trigger --type=device --action=add -s block -s tty
```

instead of the normal

```
udevadm trigger --type=device --action=add
```

so we can use filter to filter out only subsystems for we we know that
we have rules in place that do something useful.

On the other side action / rules are not triggered until the parent is
triggered ( which is part of another subsystem), so the additional option
will allows udev to complete the coldplug with only the devices we care.

Example on iMX8:

.Without the new option
```
root@dev:~# udevadm trigger --dry-run  -s block --action=add -v
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0boot0
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0boot1
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p1
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p2
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p3
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p4
```

.With the new option
```
root@dev:~# udevadm trigger --dry-run -i -s block --action=add -v
/sys/devices/platform
/sys/devices/platform/bus@5b000000
/sys/devices/platform/bus@5b000000/5b010000.mmc
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0boot0
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0boot1
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p1
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p2
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p3
/sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p4
```
Boot time reduction with this is place is ~ 1 second.
2024-12-16 15:43:52 +01:00
Lennart Poettering
a0c314d6b0 terminal-util: temporarily turn on nonblocking mode when waiting for ANSI seq responses
We never know, maybe there's some spurious POLLIN and read() will fail
with EAGAIN even though we saw POLLIN. Handle that.

(this can happen if we area not the only process reading from the tty,
or in case of hups and such).

Fixes: #35499
2024-12-16 15:41:53 +01:00
Yu Watanabe
a763364cc9 ptyfwd: fix logic of OSC sequence termination
Previously, when an OSC sequence is terminated with \x1b\x5c, configured
OSC sequence would be inserted between the two characters, rather
than after the two.

Fixes a bug introduced by d848a9499830c530e804a41ffd8aa1bc942fa735.
Fixes #35631.
2024-12-16 19:21:43 +09:00
Yu Watanabe
9bc2acad8f ptyfwd: clean up logic of color state transition in pty_forward_ansi_process()
Drop all 'continue', to make the logic easy to understand.
No functional change, just refactoring and preparation for later commit.
2024-12-16 16:36:56 +09:00
Ronan Pigott
e803e95760 network: don't warn with no NSID assigned
This is nothing interesting to warn about. Also use the symbolic
constant name when testing for this condition.
2024-12-15 09:09:26 +09:00
Luca Boccassi
c5f95bc19b
udev: move several definitions (#35613) 2024-12-14 16:32:02 +00:00
Yu Watanabe
3f1d499964 test-time-util: fix truncation of usec to sec
Also
- use ASSERT_XYZ() macros,
- log tzname[] on failure.
2024-12-14 15:23:52 +00:00
Yu Watanabe
0bdcca5aee udev: move enums to udev-def.h
No functional change, just refactoring and preparation for later
commits.
2024-12-14 16:19:57 +09:00
Yu Watanabe
a2840b9599 udev: move listen_fds() to udev-manager.c
Also
- drop redundant error message when manager_init() failed,
- close unexpected fds.

No functional change, just refactoring.
2024-12-14 16:19:57 +09:00
Yu Watanabe
7ab25935f3 udev: several coding style fixes
- use 'type* func()' rather than 'type *func()',
- merge variable declarations,
- etc.
2024-12-14 06:50:59 +00:00
Daan De Meyer
61ecc410ea
udev: several trivial cleanups for builtins (#35612) 2024-12-14 06:48:50 +00:00
Yu Watanabe
7edb1b42fc test-udev-spawn: migrate to use ASSERT_XYZ() 2024-12-14 06:47:14 +00:00
Yu Watanabe
46d9f19465 udev-builtin-kmod: log about unloading only when already loaded 2024-12-14 11:29:05 +09:00
Yu Watanabe
9c6c4ad173 udev-builtin: drop unnecessary 'initialized' flag
All builtin _init() functions can be called multiple times gracefully,
and _exit() can be called without _init() called.
2024-12-14 11:29:05 +09:00
Yu Watanabe
975115321f udev-builtin: use FOREACH_ELEMENT() macro 2024-12-14 11:29:05 +09:00
David Härdeman
130698dc20 logind: allow wall messages to be controlled via config file
Right now, the sending of wall messages on reboot/shutdown/etc can be
controlled via DBus properties. This patch adds support for changing the
default via the logind.conf file as well.

Note that the DBus setting is lost if logind is restarted or reloaded,
but it was already the case before this patch that the setting is lost
upon restart.
2024-12-14 10:54:58 +09:00
Yu Watanabe
db09f8ad1b
Replace array with magic indices with normal variables in vconsole-setup (#35181) 2024-12-14 10:49:01 +09:00
Yu Watanabe
3fbc35bf9a
core: log disconnect on api and system busses, and dump list of subscribers (#35603)
Split out of #35406.
2024-12-14 10:20:35 +09:00
Yu Watanabe
beed1447b9
log: raise log level to LOG_DEBUG if $DEBUG_INVOCATION=1 is set (#35606)
Let's implement our own protocols, and raise the log level to debug if
DEBUG_INVOCATION=1 is set.

Follow-up for: 7d8bbfbe0852ec89590d1dc5e28afc95d6d44fa1
2024-12-14 10:16:53 +09:00
Lennart Poettering
3e32e5a4d2 log: raise log level to LOG_DEBUG if $DEBUG_INVOCATION=1 is set
Let's implement our own protocols, and raise the log level to debug if
DEBUG_INVOCATION=1 is set.

Follow-up for: 7d8bbfbe0852ec89590d1dc5e28afc95d6d44fa1
2024-12-13 19:53:55 +01:00
Zbigniew Jędrzejewski-Szmek
f393b2f99f vconsole-setup: drop impossible condition 2024-12-13 16:23:05 +00:00
Zbigniew Jędrzejewski-Szmek
a814fd7897 vconsole-setup: use normal variables instead of an array
We had this elaborate scheme with an array of strings instead of a bunch of a
normal string fields. If there were hundreds of those strings, this would make
sense. But we had just five and one was actually a bit different because it had
a fallback, so overall, the code is easier to read when normal fields are used.

The fallback was implemented in the accessor function, now it's actually
implemented in the place where it's used.

While at it, rename the variables so that they match the config keys for
legibility.
2024-12-13 16:23:05 +00:00
Zbigniew Jędrzejewski-Szmek
390bab5392 tmpfiles: reduce quoting in warning message
We printed:
systemd-tmpfiles[705]: /usr/lib/tmpfiles.d/20-systemd-shell-extra.conf:10: Unknown modifiers in command 'L$'.
systemd-tmpfiles[705]: /usr/lib/tmpfiles.d/systemd-network.conf:10: Unknown modifiers in command 'd$'.
systemd-tmpfiles[705]: /usr/lib/tmpfiles.d/systemd-network.conf:11: Unknown modifiers in command 'd$'.
...

There's a lot of additional characters here make the message harder to parse. We know
that the command is a word without any whitespace, so quoting isn't really necessary.

Change this to:
... unknown modifiers in command: L$
2024-12-13 16:23:05 +00:00
Yu Watanabe
10a768443a network: introduce MPLSRouting= to enable MPLS routing
Closing #35487.
2024-12-13 15:36:45 +00:00
Yu Watanabe
dcd333168e sysctl-util: support AF_MPLS
To support writing/reading e.g. /proc/sys/net/mpls/conf/eth0/input .
2024-12-13 15:36:45 +00:00
Daan De Meyer
d218ecc733 repart: Take configured minimum and maximum size into account for Minimize=
- Let's check if the minimum size we got is larger than the configured
maximum partition size and fail early if it is.
- Let's make sure for writable filesystems that we make the minimal
filesystem at least as large as the minimum partition size, to allow
creating minimal filesystems with a minimum size.
2024-12-13 15:10:29 +00:00
Daan De Meyer
12c29e5b3a Revert "repart: Drop unprivileged subvolumes logic for btrfs"
This adds back support for unprivileged btrfs subvolumes which
can be merged once btrfs-progs 6.12 is out.

This reverts commit 4d9ccdc9aec5728a6bfc66879420b2af25817e03.
2024-12-13 14:05:32 +00:00
Daan De Meyer
18bb30c3b2
core: Bind mount notify socket to /run/host/notify in sandboxed units (#35573)
To be able to run systemd in a Type=notify transient unit, the notify
socket can't be bind mounted to /run/systemd/notify as systemd in the
transient unit wants to use that as its own notify socket which
conflicts with systemd on the host.

Instead, for sandboxed units, let's bind mount the notify socket to
/run/host/notify as documented in the container interface. Since we
don't guarantee a stable location for the notify socket and insist users
use $NOTIFY_SOCKET to get its path, this is safe to do.
2024-12-13 13:48:07 +00:00