Commit Graph

80688 Commits

Author SHA1 Message Date
Daan De Meyer
e2b01571d0 mkosi: Move TEST-24-CRYPTSETUP files to mkosi/ directory
If the integration tests have been installed in the systemd-tests
package, the path to these in mkosi.postinst.chroot will be wrong.
Let's fix the issue by moving these files into the mkosi/ directory
as they're only used by mkosi regardless so they make more sense to
be there anyway.
2025-04-10 15:09:29 +02:00
Daan De Meyer
8b1c66f72c mkosi: Rely on tmpfiles to put nsswitch.conf in place
Let's rely on tmpfiles to put our nsswitch.conf in place instead of
doing it in the post-install script. This moves us one step closer
to being able to build the mkosi image without having the source
tree available when NO_BUILD is used.
2025-04-10 15:09:29 +02:00
Daan De Meyer
5ec2ba5d2f mkosi: update debian commit reference to 11efce9445f987f1e588719c182a93794eba2565
* 11efce9445 Install /usr/share/factory for upstream profile
* 4c3d753649 d/t/upstream: copy mkosi key from mkosi/ subdir if it exists
* 00f2ab1bce Install etc.conf tmpfiles.d in upstream builds
* dcf5869729 Refresh patch for upstream review changes
* f94714d8cc d/copyright: use GPL URL instead of old FSF postal address
* bf005e69f5 Update changelog for 257.5-2 release
* 709e474e5b Backport new patch to workaround /lib64 symlink incompatibility
* fa6c61db40 Update changelog for 257.5-1 release
* 9c9ca29ceb Remove conflicts with dracut:arm64 and build nspawn:arm64 again
* 5899bcc55d Update changelog for 257.5-1 release
* dd5cb92d08 Drop backports, included in 257.5
* c1373fb99e d/t/upstream: run mkosi genkey before summary
* 223d7a412a Install new files for upstream
* b9d337abd9 Use Conflicts instead of Breaks/Replaces for file move
* 9379847813 d/t/upstream: write mkosi.local.conf in subdir if the rest of the configs are in subdir
* 86fc24b565 d/t/upstream: do not fail if 10-root.conf is not present
2025-04-10 15:09:13 +02:00
ZIHCO
1ab010cbad nspawn: replace prefix_roota() with chase() 2025-04-10 00:36:06 +02:00
Nick Labich
3b31b2e4cc vmspawn: fix --extra-drive= option
Follow-up for 369655330d.

Fixes #36807.
2025-04-10 04:38:51 +09:00
Mario Limonciello
9a224c307b backlight: Drop support for actual_brightness
Some AMD systems have support for features like custom brightness
curve or adaptive backlight management.  These features allow the
display driver to adjust the brightness based upon other factors
than just the user brightness request.

The user's brightness request is indicated in the 'brightness' file
but the effective result of the logic in the display driver is stored
in the 'actual_brightness' file.

This leads to problems when shutting the system down because the value
of 'actual_brightness' may be lower than 'brightness' and the wrong value
gets stored for the next boot.

For example if the brightness a user requested was 150, the actual_brightness
might be 130. So the next boot the brightness will be "set" to 130, but the
actual brightness might be 115. If the user reboots again it will be set to 115
for the next boot but the actual brightness might be 100. That is this gets worse
and worse each reboot cycle until the system eventually boots up at minimum
brightness.

Furthermore the kernel documentation indicates that the brightness and
actual_brightness files are not guaranteed to be the same values.

Due to this; drop the use of 'actual_brightness' when saving/restoring brightness
and instead rely only upon 'brightness'.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
2025-04-10 04:31:46 +09:00
Yu Watanabe
62146da6ce core,run0: fixlets/tweaks around $SHELL handling (#37052)
Fixes #35007
2025-04-10 04:29:30 +09:00
Daan De Meyer
a73ce47546 test: Two fixes for running the integration tests standalone (#37073) 2025-04-09 21:25:40 +02:00
Daan De Meyer
75a5ff01d3 test: Make sure symlinks in integration-tests are properly installed
meson follows symlinks by default, so make sure we use
follow_symlinks=False if meson is new enough and rsync otherwise like
we already do for other testdata subdirectories.
2025-04-09 20:47:30 +02:00
Daan De Meyer
c7eda25593 test: Drop version from standalone meson file
The file won't exist if we're running tests from the systemd-tests
package so let's drop it as it's not used for anything.
2025-04-09 20:23:26 +02:00
Daan De Meyer
c7bb07fff5 mkosi: update mkosi commit reference to 7e4ec15aee6b98300b2ee14265bc647a716a9f8a
* 7e4ec15aee Generate key-cert pair in config directory (fixes #3655)
* 5793e64958 Don't use gen_kernel_images() in run_depmod()
* bc497f1d17 Fix typing due to recent changes in typeshed
* e6a603a21a Add "plymouth" initrd profile
2025-04-10 02:51:37 +09:00
kmeaw
e4bb033e2f shared/calendarspec: fix normalization when DST is negative
When trying to calculate the next firing of 'hourly', we'd lose the
tm_isdst value on the next iteration.

On most systems in Europe/Dublin it would cause a 100% cpu hang due to
timers restarting.

This happens in Europe/Dublin because Ireland defines the Irish Standard Time
as UTC+1, so winter time is encoded in tzdata as negative 1 hour of daylight
saving.

Before this patch:
$ env TZ=IST-1GMT-0,M10.5.0/1,M3.5.0/1 systemd-analyze calendar --base-time='Sat 2025-03-29 22:00:00 UTC' --iterations=5 'hourly'
  Original form: hourly
Normalized form: *-*-* *:00:00
    Next elapse: Sat 2025-03-29 23:00:00 GMT
       (in UTC): Sat 2025-03-29 23:00:00 UTC
       From now: 13h ago
   Iteration #2: Sun 2025-03-30 00:00:00 GMT
       (in UTC): Sun 2025-03-30 00:00:00 UTC
       From now: 12h ago
   Iteration #3: Sun 2025-03-30 00:00:00 GMT  <-- note every next iteration having the same firing time
       (in UTC): Sun 2025-03-30 00:00:00 UTC
       From now: 12h ago
...

With this patch:
$ env TZ=IST-1GMT-0,M10.5.0/1,M3.5.0/1 systemd-analyze calendar --base-time='Sat 2025-03-29 22:00:00 UTC' --iterations=5 'hourly'
  Original form: hourly
Normalized form: *-*-* *:00:00
    Next elapse: Sat 2025-03-29 23:00:00 GMT
       (in UTC): Sat 2025-03-29 23:00:00 UTC
       From now: 13h ago
   Iteration #2: Sun 2025-03-30 00:00:00 GMT
       (in UTC): Sun 2025-03-30 00:00:00 UTC
       From now: 12h ago
   Iteration #3: Sun 2025-03-30 02:00:00 IST  <-- the expected 1 hour jump
       (in UTC): Sun 2025-03-30 01:00:00 UTC
       From now: 11h ago
...

This bug isn't reproduced on Debian and Ubuntu because they mitigate it by
using the rearguard version of tzdata. ArchLinux and NixOS don't, so it would
cause pid1 to spin during DST transition.

This is how the affected tzdata looks like:
$ zdump -V -c 2024,2025 Europe/Dublin
Europe/Dublin  Sun Mar 31 00:59:59 2024 UT = Sun Mar 31 00:59:59 2024 GMT isdst=1 gmtoff=0
Europe/Dublin  Sun Mar 31 01:00:00 2024 UT = Sun Mar 31 02:00:00 2024 IST isdst=0 gmtoff=3600
Europe/Dublin  Sun Oct 27 00:59:59 2024 UT = Sun Oct 27 01:59:59 2024 IST isdst=0 gmtoff=3600
Europe/Dublin  Sun Oct 27 01:00:00 2024 UT = Sun Oct 27 01:00:00 2024 GMT isdst=1 gmtoff=0

Compare it to Europe/London:
$ zdump -V -c 2024,2025 Europe/London
Europe/London  Sun Mar 31 00:59:59 2024 UT = Sun Mar 31 00:59:59 2024 GMT isdst=0 gmtoff=0
Europe/London  Sun Mar 31 01:00:00 2024 UT = Sun Mar 31 02:00:00 2024 BST isdst=1 gmtoff=3600
Europe/London  Sun Oct 27 00:59:59 2024 UT = Sun Oct 27 01:59:59 2024 BST isdst=1 gmtoff=3600
Europe/London  Sun Oct 27 01:00:00 2024 UT = Sun Oct 27 01:00:00 2024 GMT isdst=0 gmtoff=0

Fixes #32039.
2025-04-10 02:47:27 +09:00
Mike Yuan
aadb8f9784 test: add test case for PAMName= $SHELL acquisition for root 2025-04-09 19:31:58 +02:00
Mike Yuan
9c0d8b8c4f core/exec-invoke: consult NSS for root user creds if SetLoginEnvironment=/PAMName= 2025-04-09 19:31:58 +02:00
Mike Yuan
2fb438cc88 core/exec-invoke: never override acquired user cred with fallback one 2025-04-09 19:30:17 +02:00
Mike Yuan
ba7fb8cf5f run0: make sure we submit $SHELL to remote
Normally, the service manager sets $SHELL to the target user's
login shell, but run0 always overrides that with either
originating user's shell or value from --setenv=SHELL=. In both cases
$SHELL needs to be sent.

Fixes #35007
2025-04-09 19:30:17 +02:00
Daan De Meyer
2c885a0332 Two fixes to reduce the number of unnecessary rebuilds (#37069) 2025-04-09 17:12:07 +02:00
Daan De Meyer
aba3ef6616 mkosi: Set time-epoch= to fixed value
Turns out makepkg sets $SOURCE_DATE_EPOCH= to the current time for
every build if not set explicitly which causes full rebuilds if we
don't set time-epoch explicitly ourselves, so let's do that everywhere
to avoid unnecessary rebuilds.
2025-04-09 16:21:17 +02:00
Daan De Meyer
d6a29eee2b elf2efi: Deal properly with empty $SOURCE_DATE_EPOCH 2025-04-09 16:21:13 +02:00
Daan De Meyer
b2634bde3c meson: Use custom_target() instead of vcs_tag()
vsc_tag() always reruns even if the vcs-tag option is disabled. Let's
use custom_target() instead so that we can only enable build_always_stale
if the vcs-tag option is enabled.
2025-04-09 16:21:08 +02:00
Daan De Meyer
ad04dc4116 exec-invoke: Fix two log messages 2025-04-09 16:21:03 +02:00
Luca Boccassi
5e5f792193 mkosi: drop os-release symlink for minimal-base image
[  385s] ERROR: link target doesn't exist (neither in build root nor in installed system):
[  385s]   /usr/lib/systemd/tests/mkosi/mkosi.images/minimal-base/mkosi.extra/etc/os-release -> ../usr/lib/os-release

It shouldn't be even needed, everything should look in /usr/lib/os-release too

Follow-up for a0ce5e642f
2025-04-09 15:19:18 +01:00
Luca Boccassi
4dca06cba9 udev: several trivial cleanups (#37059) 2025-04-09 10:32:42 +01:00
Yu Watanabe
3861bfb99f test: drop unnecessary comparison and use correct assertion macros
Follow-up for 8951706784.
Fixes CID#1608873 and CID#1608874.
2025-04-09 17:16:57 +09:00
hsu zangmen
3d5f31c133 po: Translated using Weblate (Chinese (Traditional) (zh_TW))
Currently translated at 100.0% (257 of 257 strings)

Co-authored-by: hsu zangmen <chzang55@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/zh_TW/
Translation: systemd/main
2025-04-09 12:30:45 +09:00
Yu Watanabe
e2e37fd009 udev-manager: move functions to place related functions closer together
No functional change, just refactoring.
2025-04-09 08:57:27 +09:00
Yu Watanabe
9b6bf4e10e udev: merge manager_init() into manager_main()
It is not necessary to read cgroup path and passed fds earlier,
especially when legacy --daemon option is specified.
2025-04-09 08:57:21 +09:00
Yu Watanabe
4cd9f59b86 udev-config: restore log level set by systemd.log_level on reload
If previously log level was specified in udev.conf but not now,
then let's make 'udevadm control --reload' sets the log level
specified by systemd.log_level.
2025-04-09 08:57:12 +09:00
Yu Watanabe
a6c4a7098d shell-completion/udevadm: support dissect_image builtin
Follow-up for a8b2302bc1.
2025-04-09 08:56:40 +09:00
Busayo Dada
8951706784 test: Improve coverage in test-memfd-util and use ASSERT_OK() macro and friends 2025-04-09 06:45:12 +09:00
Yu Watanabe
73a0b247c8 udev-watch: add inotify watch by manager process (#37023)
This solves potential race in simultaneous addition of inotify watches
and removal of target device(s).
2025-04-09 06:43:24 +09:00
Yu Watanabe
511619087b udev: adjust event source priorities 2025-04-09 04:26:09 +09:00
Yu Watanabe
7e50402aa3 udev-watch: add inotify watch by manager process
Previously, inotify watch on a device node was added/removed by a
worker process processing the relevant uevent. However, that could not
avoid races. For example,
1. A device node X is removed by the kernel (e.g. unplug USB memory), and
   the kernel removes the inotify watch for the device node and produces
   IN_IGNORED event and 'remove' uevent for the device.
2. Before udevd processes the 'remove' uevent of the device, a worker
   process may try to add an inotify watch on another device node Y.
   As the inotify watch on X has been already removed, the worker may
   acquire the same watch handle that was previously assigned to X.
3. Since the 'remove' uevent for X is not processed yet, the symlink
   named with the watch handle still exists and points to X. So, the
   worker process for Y cannot add the symlink...

To avoid such races, let's sequentially add/remove inotify watch by the
manager process.

Note, this potentially reduces performance on boot when there exists
huge amount of disks and/or partitions.
2025-04-09 04:26:06 +09:00
Daan De Meyer
36645ec255 mkosi: Set mitigations=off
Might as well disable mitigations for these VMs. Who knows, maybe it'll
speed something up.
2025-04-08 20:54:57 +02:00
Michal Sekletar
8b5e3be88e basic/namespace-util: obtain uid and gid before unsharing user namespace
Getting user and group after unsharing user namespace is too late
because without any mapping, i.e. just after unshare(), we are mapped to
nobody.
2025-04-09 03:06:05 +09:00
Daan De Meyer
278d5bfd7e mkosi: Make MinimumVersion= a git commit
With the latest mkosi it's possible for MinimumVersion= to be a git
commit so let's start making use of that. This will make mkosi fail
if it's executed within the systemd repository and the checked out
commit is too old.

Putting the mkosi commit sha in mkosi/mkosi.conf also allows retrieving
it without having the full source tree available.

We also make a bunch of improvements to the fetch-mkosi.py script.
2025-04-08 18:35:04 +02:00
Daan De Meyer
a0ce5e642f test: Install files required to run integration tests standalone
Let's make it possible to run the integration tests without requiring
the sources by installing the mkosi and integration-tests directories.
2025-04-08 13:02:24 +02:00
Luca Boccassi
442d8c3f06 TEST-04-JOURNAL: include util.sh before calling cgroupfs_supports_user_xattrs() (#37039)
Fixes a bug introduced by 46322f2742
(v256).
Fixes #36991.
2025-04-08 09:52:13 +01:00
Yu Watanabe
f0cf0c9ba7 TEST-17-UDEV: several follow-ups (#37042) 2025-04-08 16:43:03 +09:00
Luca Boccassi
a088ab8d42 udev: fix potential stuck on exit (#37022)
If an event is requeued after termination is requested, previously
systemd-udevd never called sd_event_exit() and stuck.
2025-04-07 23:54:23 +01:00
Jules Lamur
06fadc4286 fstab-generator: fix options in systemd.mount-extra= arg
Fixes a bug introduced by 55365b0a23 (v254).

The arguments `(rd.)systemd.mount-extra` take a value that looks like
`WHAT:WHERE[:FSTYPE[:OPTIONS]]`. The `OPTIONS` were parsed into a nulstr
where a comma-separated c-string was expected. This leads to a bug where
only the first option was taken into account by the generator.

For example, if you passed `systemd.mount-extra=/x:/y:baz:ro,defaults`
to the kernel, `systemd-fstab-generator` would translate that into a
nulstr: `ro\0defaults\0`.
Since methods processing options in the generator expected a
comma-separated c-string, they would only see the first option, `ro` in
this case.
2025-04-08 07:10:07 +09:00
Luca Boccassi
5f8e5297b4 test: switch to new config keyword for bind9 >= 9.21
bind9 9.21 removed the deprecated 'managed-keys', swap it with
'trust-anchors' if the version is 9.21 or newer

[   20.654086] TEST-75-RESOLVED.sh[1217]: + delv -a /etc/bind.keys @ns1.unsigned.test signed.test
[   20.654425] TEST-75-RESOLVED.sh[1218]: + tee /tmp/tmp.D4LNomAKqY
[   20.672599] TEST-75-RESOLVED.sh[1218]: ;; /etc/bind.keys:1: option 'managed-keys' no longer exists
2025-04-08 07:09:26 +09:00
Yu Watanabe
9e372b643b TEST-04-JOURNAL: sync journal in test script, and find journal with invocation ID
Hopefully improve the stability of the test.
2025-04-08 06:56:52 +09:00
Yu Watanabe
86d59686b7 TEST-04-JOURNAL: include util.sh before calling cgroupfs_supports_user_xattrs()
Fixes a bug introduced by 46322f2742 (v256).
Fixes #36991.
2025-04-08 06:39:06 +09:00
Yu Watanabe
ae84aa286a TEST-17-UDEV: fd may be >= 10
Follow-up for db5d89309a.
2025-04-08 06:16:14 +09:00
Yu Watanabe
9f7ddd2955 TEST-17-UDEV: update rules filename
Follow-up for 40959dcc02.
2025-04-08 06:15:22 +09:00
Yu Watanabe
bd05126399 nspawn-oci: replace use of deprecated cgroup v1 properties with v2 ones (#37038) 2025-04-08 05:28:11 +09:00
Luca Boccassi
2a9f618276 base-filesystem: avoid creating /lib64 symlink on existing rootfs
While all distributions agree on where the basic rootfs symlinks
(/bin /sbin /lib) should point to, not all of them agree on the
target of /lib64. Debian and derivatives, expect something different
than Fedora et al. This is mostly due to the different way multiarch
vs multilib are designed.

This can lead to the situation where running systemd-nspawn on Fedora
to boot a Debian container creates an incompatible symlink in the guest
persistent, pre-created and pre-populated root filesystem, causing
issues due to these incompatibilities.

While it would be great if Debian and derivatives had the same
expectations as the rest of the world, this is baked in many places
and not likely to ever be fixable, as the multiarch vs multilib
behaviours are now very entrenched, and changing it would break
compatibilities left and right.

The core purpose of base-filesystem was to allow bringing up a system
with an empty/ephemeral/etc rootfs (and a /usr/ image on top). So as
a workaround, create /lib64 only if we detect that we have created
/bin /lib and /sbin, as that's a sure sign we are booting into an
empty rootfs that needs to be populated.
Conversely, if the filesystem _already_ has /bin /sbin and /lib,
it means it is not ephemeral and it is pre-prepared and persistent,
so it's a good idea to avoid second-guessing the image builder tool
or the package manager and override what it does, and just let them
carry on with the system however they configured it.

Reworked and reworded, original author: Helmut Grohne <helmut@subdivi.de>
2025-04-08 05:27:31 +09:00
Vitaly Kuznetsov
f501830595 man: mention "overlay" as a possible option for systemd.volatile
systemd.volatile=overlay is described in the text below, however, it
is missing in the enclosed list of possible options in the beginning.
2025-04-08 02:29:29 +09:00
Yu Watanabe
aed61aa382 nspawn/oci: replace use of deprecated BlockIOWeight/BlockIODeviceWeight with IOWeight/IODeviceWeight 2025-04-08 02:08:37 +09:00