Commit Graph
80673 Commits
Author SHA1 Message Date
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
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
Yu Watanabe 173ffdaffb nspawn/oci: replace use of deprecated CPUShares with CPUWeight 2025-04-08 02:08:37 +09:00
Yu Watanabe b7fb6ec34f nspawn/oci: also set CPUQuotaPeriodUSec DBus property 2025-04-08 02:08:37 +09:00
Yu Watanabe c019af5eed test-notify-recv: fix message string
Follow-up for 2351bc991e.
Addresses https://github.com/systemd/systemd/pull/37016#discussion_r2031363409.
2025-04-08 02:04:13 +09:00
Yu Watanabe b135cb321a udev: drop unnecessary discardment of queued events
With the previous commit, now on_post_exit() checks only events
currently being processed. Hence, it is not necessary to discard
queued events in manager_exit().

Also, as already SIGTERM is sent to all workers, kill workers timer
is not necessary anymore after manager_exit(), hence disable it.

This mostly does not change any behavior. Just refactoring and
preparation for later change.
2025-04-07 22:17:16 +09:00
Yu Watanabe 45e8c283d8 udev: do not wait for event queue being empty on exit
When the manager process is requested to terminate, if a worker process
try to lock a block device and failed, then the worker returns a
TRY_AGAIN notification and the event is requeued. Hence, the event queue
may have pending events even after manager_exit() is called. In such
situation, sd_event_exit() will never called, and udevd will stuck.

This makes, after termination is requested, it only checks whether there
are any events currently being processed.
2025-04-07 22:17:16 +09:00
Yu Watanabe b6ede8e275 udev: unconditionally send signals to workers
It is not necessary to wait for a worker processing an event before
sending SIGTERM. Workers will handle SIGTERM after they finish events
that they are currently processing. Let's send SIGTERM whenever it
necessary.
2025-04-07 22:17:16 +09:00
Yu Watanabe b75841029f udev: split out two functions from on_post()
No functional change, just refactoring and preparation for later change.
2025-04-07 22:17:16 +09:00
Daan De Meyer a94520dc78 mkosi: Update to latest 2025-04-07 13:31:37 +02:00
Yu Watanabe b5d68c6ded units: update comment
Follow-up for f89985ca49.
2025-04-07 17:34:08 +09:00
Yu Watanabe 4c697fdd9c docs/NETWORK_ONLINE: fix typo
Follow-up for 45b1321653.
2025-04-07 17:02:00 +09:00
Yu Watanabe 223be3e8cc docs/ARCHITECTURE: fix typo
Follow-up for e1c52cb271.
2025-04-07 17:00:35 +09:00
Yu Watanabe 3af3f30a01 man/tmpfile: fix typo
Follow-up for 007b77ac6c.
2025-04-07 16:58:43 +09:00
Yu Watanabe 05c7c8f65e man/gpt-auto: fix typo
Follow-up for c481605d0d.
2025-04-07 16:57:11 +09:00
Yu Watanabe 7cdff85eb3 man/nss-resolve: fix typo
Follow-up for 2b015ea4b2.
2025-04-07 16:56:09 +09:00
Yu Watanabe 7de438cdb5 NEWS,TODO: fix typo 2025-04-07 16:54:05 +09:00