Commit Graph

79591 Commits

Author SHA1 Message Date
Lennart Poettering
40e22609e8 ptyfwd-tool: don't segfault if called without arguments 2025-02-20 18:12:13 +01:00
Lennart Poettering
a932d2f23e test: fix racy machined test
Previously, one of the io.systemd.Machine.Open() tests would invoke a
command line via machined, and then check if it ran properly. This was
implemented in a racy fashion: the client side would immediately close
the pty fd allocated for the operation, thus triggering an immediate
SIGHUP on the other side. Now, depending whether this client was quicker
in closing or the server was quicker in executing the command line this
was a race.

Fix this comprehensively: let's first wait for the varlink operation to
complete via the new "systemd-notify --fork" logic (because varlinkctl
sends out READY=1 once handing off to --exec). Secondly let's use
varlinkctl's --exec logic to invoke a process which keeps open the open
pty until we kill it (we just use sleep for that).

(Also add some more tests for the varlinkctl --exec stuff)
2025-02-20 18:12:13 +01:00
Lennart Poettering
fd2d435d97 varlinkctl: introduce new --exec switch
This new switch makes it possible to process fds attached to a varlink
reply: if specified it will execute a command line specified by the
caller, will pass the response json as stdin, and any fds acquired as
fd3, fd4, …
2025-02-20 18:12:12 +01:00
Lennart Poettering
4389e4c2ae notify: add a new --fork verb that implements a minimal receiver side for sd_notify() messages 2025-02-20 18:11:31 +01:00
Lennart Poettering
30999dd5cf notify: introduce arg_action enum 2025-02-20 18:11:31 +01:00
Lennart Poettering
060c4b99bd nspawn: port to notify_recv() 2025-02-20 18:11:31 +01:00
Lennart Poettering
cc19df7c76 sysupdated: port to notify_recv() 2025-02-20 18:11:31 +01:00
Lennart Poettering
ee26ad44d7 sysupdate: port to notify_recv() 2025-02-20 18:11:31 +01:00
Lennart Poettering
41e49f3724 importd: port to notify_recv() 2025-02-20 18:11:31 +01:00
Lennart Poettering
7f6af95dab notify-recv: add generic implementation of sd_notify() server side dgram recv code
The code is not trivial, and we implemented this at various places
already, introduce a common implementation for this we can reuse.
2025-02-20 18:11:31 +01:00
Lennart Poettering
59f5836e71 sd-varlink: add new sd_varlink_get_n_fds() helper
This new call returns how many fds have been associated with the current
incoming message.
2025-02-20 18:11:31 +01:00
Lennart Poettering
cfeeaebafe homed: explicitly set access mode of private/public signing key pair
So far we relied that the temporary file logic would create the key
files with 0600 mode, but let's set the access mode explicitly:

1. Tighten private key file access from 0600 to 0400, after all we never
   want to write it again, it's not a mutable file.

2. Relaxed public key file access mode from 0600 to 0444, after all it's
   a public key file, and people should be able to see it if they want
   This is useful for propagating the key onto other systems if needed.
2025-02-20 17:35:12 +01:00
Lennart Poettering
9df18e4bee tree-wide: initialize row/column explicitly before calling sd_json_parse_file()
The variables are error return parameters, i.e. only initialized on some errors,
not all. Let's hence always zero initialize them.
2025-02-20 17:34:36 +01:00
Lennart Poettering
2cf95e5178 homed: return the correct error if an image file is not present when we try to activate it
We already return BUS_ERROR_HOME_ABSENT when we detect the image being
absent before we fork off the homework worker. Let's also return the
same error if the homework process notices the same condition while
actually doing something.

This mostly fixes a race, that the same condition seen at different
points in time results in the same errors.
2025-02-20 17:34:02 +01:00
Lennart Poettering
6828cc112a resolve: cleanups for validating query flags and fix resolving service with record type filter (#36398)
Follow-up for 81ae2237c1.
Fixes
https://github.com/systemd/systemd/pull/36353#issuecomment-2659558382.
2025-02-20 17:31:19 +01:00
Daan De Meyer
4d65c9f70c mkosi: Enable userdb tmpfiles dropin on Fedora/CentOS
It's disabled by default in the Fedora spec, but still available
as an example file. Let's symlink it to the proper name in the images
to enable it again.
2025-02-20 16:57:22 +01:00
Lennart Poettering
b3adb7cd63 user-runtime-dir: use right accessor got get GID of account 2025-02-20 16:44:41 +01:00
Lennart Poettering
06d77db6fb homed: make "register" call more friendly
Let's accept full user records (including status and so on) and simply
eat up the parts we don't care about, instead of refusing the whole
record wholesale.

This makes it easier to just copy a user record from one machine and
registering it at another, without stripping the irrelevant parts first.
2025-02-20 16:44:10 +01:00
Lennart Poettering
a971e6603f update TODO 2025-02-20 15:24:19 +01:00
Pavithra Barithaya
6a12c90ca3 timedated: Send error when time set is past build date time
When the user/customer sets the time on the system which is prior
than that of the systemd build time, as systemd doesn't allow time
before it's build date after a reboot, systemd is resetting it but
there is no error or exception present in the setTime method due
to which user/customer is unaware of why the time is reset back to
the systemd-build time.

Added a condition check in the set_time() method to return an
error when tried to set time past the systemd build date.

Tested: Verified that it throws an error when we try to set the
time prior to systemd build date.

Change-Id: Ia6b58320bdb7234a21885a44af8fd3bda64c3789
2025-02-20 15:22:15 +01:00
Daan De Meyer
4ce6b7d2b6 mkosi: Install systemd-boot in opensuse initrd
This contains the systemd-stub tmpfiles snippet which we need to
copy stuff from /.extra to /run/systemd/stub which
TEST-86-MULTI-UKI-PROFILE depends on to work properly.
2025-02-20 15:18:14 +01:00
Daan De Meyer
a102b28ad4 mkosi: Do not run unit tests during build by default (#36450) 2025-02-20 13:25:03 +01:00
Ahmad Fatoum
6f8a9d0917 man: fix typo in systemd.watchdog_device kernel option
The option that systemd actually looks for has an underscore and no dash
as can be seen in src/core/main.c.

The man/kernel-command-line.xml documentation also gets it right with
this file being the only instance of watchdog-device being used.

Fixes: c75396c30b ("documentation: add description for watchdog device path")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
2025-02-20 12:18:45 +00:00
Luca Boccassi
c6a932fd0d tools/dbus_exporter: set LD_ORIGIN_PATH if procfs is not available
The script runs the binaries which try to find the internal libs via /proc/self/exe due
to glibc's RPATH resolution and fail:

/var/cache/src/systemd/tools/dbus_exporter.py interfaces
 /var/cache/src/systemd/build/systemd
 /var/cache/src/systemd/build/systemd-homed
 /var/cache/src/systemd/build/systemd-hostnamed
 /var/cache/src/systemd/build/systemd-importd
 /var/cache/src/systemd/build/systemd-localed
 /var/cache/src/systemd/build/systemd-logind
 /var/cache/src/systemd/build/systemd-machined
 /var/cache/src/systemd/build/systemd-networkd
 /var/cache/src/systemd/build/systemd-oomd
 /var/cache/src/systemd/build/systemd-portabled
 /var/cache/src/systemd/build/systemd-resolved
 /var/cache/src/systemd/build/systemd-sysupdated
 /var/cache/src/systemd/build/systemd-timedated
execve("/var/cache/src/systemd/build/systemd", ["/var/cache/src/systemd/build/sys"..., "--bus-introspect", "list"], 0x7ffc7ab68600 /* 20 vars */) = 0
brk(NULL)                               = 0x56265bf70000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f56ced7f000
readlinkat(AT_FDCWD, "/proc/self/exe", 0x7ffedeaa7a90, 4096) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=20293, ...}) = 0
mmap(NULL, 20293, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f56ced7a000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v4/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v4/", 0x7ffedeaa80b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v3/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v3/", 0x7ffedeaa80b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v2/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v2/", 0x7ffedeaa80b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/lib/x86_64-linux-gnu/", {st_mode=S_IFDIR|0755, st_size=19312, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v4/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v4/", 0x7ffedeaa80b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v3/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v3/", 0x7ffedeaa80b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v2/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v2/", 0x7ffedeaa80b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/", {st_mode=S_IFDIR|0755, st_size=19312, ...}, 0) = 0
openat(AT_FDCWD, "/lib/glibc-hwcaps/x86-64-v4/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/lib/glibc-hwcaps/x86-64-v4/", 0x7ffedeaa80b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/glibc-hwcaps/x86-64-v3/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/lib/glibc-hwcaps/x86-64-v3/", 0x7ffedeaa80b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/glibc-hwcaps/x86-64-v2/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/lib/glibc-hwcaps/x86-64-v2/", 0x7ffedeaa80b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/lib/", {st_mode=S_IFDIR|0755, st_size=642, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib/glibc-hwcaps/x86-64-v4/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/glibc-hwcaps/x86-64-v4/", 0x7ffedeaa80b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/glibc-hwcaps/x86-64-v3/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/glibc-hwcaps/x86-64-v3/", 0x7ffedeaa80b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/glibc-hwcaps/x86-64-v2/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/glibc-hwcaps/x86-64-v2/", 0x7ffedeaa80b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/libsystemd-core-258.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/", {st_mode=S_IFDIR|0755, st_size=642, ...}, 0) = 0
writev(2, [{iov_base="/var/cache/src/systemd/build/sys"..., iov_len=36},
           {iov_base=": ", iov_len=2},
           {iov_base="error while loading shared libra"..., iov_len=36},
           {iov_base=": ", iov_len=2},
           {iov_base="libsystemd-core-258.so", iov_len=22},
           {iov_base=": ", iov_len=2},
           {iov_base="cannot open shared object file", iov_len=30},
           {iov_base=": ", iov_len=2},
           {iov_base="No such file or directory", iov_len=25},
           {iov_base="\n", iov_len=1}],
           10/var/cache/src/systemd/build/systemd: error while loading shared libraries: libsystemd-core-258.so: cannot open shared object file: No such file or directory
) = 158
2025-02-20 10:46:23 +00:00
Daan De Meyer
bddfcd9629 mkosi: Do not run unit tests during build by default
We want the incremental builds to be as fast as possible, so let's
not run the unit tests locally during the image build by default.
2025-02-20 10:31:19 +01:00
Daan De Meyer
75ace9fd84 docs: Document how to run the unit tests in HACKING.md 2025-02-20 10:31:19 +01:00
Luca Boccassi
5dbc4f37c5 tree-wide: tweaks to mount point inode creation (#36308)
Some love for make_mount_point_inode_from_xyz() and ports PID 1 over to
it for mount units.

Alternative to #36290
2025-02-19 22:09:52 +00:00
Luca Boccassi
4225242149 repart: add parameter to attach offline verity signature (#36405)
Add --join-signature=hash:sig - when a verity signature partition
has been deferred in a previous run, this allows attaching a signature
that was created offline, for example on a build system like OBS where
the private key is not available to the build process.

Can be specified multiple times, the right partition to act upon will
be selected by matching the data+verity partitions UUIDs with the
provided roothash(es)
2025-02-19 18:12:19 +00:00
Luca Boccassi
09fd125059 repart: add parameter to attach offline verity signatures
Add --join-signature=hash:sig - when a verity signature partition
has been deferred in a previous run, this allows attaching a signature
that was created offline, for example on a build system like OBS where
the private key is not available to the build process.

Can be specified multiple times, the right partition to act upon will
be selected by matching the data+verity partitions UUIDs with the
provided roothash(es)
2025-02-19 16:26:05 +00:00
xinpeng wang
df1ff1c0a0 logind: save seat before applying acl
udev will trigger the uaccess program in 73-seat-late.rules, which
may modify the device's acl permissions. In some cases, udev triggers
the uaccess program when logind is started and active is being set.
At this time, 1) logind sets the user's acl permissions, 2) uaccess
obtains active and sets acl permissions; 3) logind updates seat's
stat_file and writes active. This situation will cause the device to
not have the correct acl permissions, resulting in abnormal situations
such as a black screen. Therefore, it is necessary to write active to
seat's stat file before setting acl.
2025-02-19 16:38:33 +01:00
Lennart Poettering
6750629c2e issue: add trailing empty line
(Make this more alike the version actually shipped in Fedora)
2025-02-19 16:08:39 +01:00
Lennart Poettering
52cd94b9e4 update TODO 2025-02-19 16:08:39 +01:00
Daan De Meyer
049e9587bb mkosi: Update distribution packaging specs for arch, opensuse and fedora (#36428) 2025-02-19 14:42:52 +01:00
Jan Macku
de99f5fbb4 github: bump versions in issue forms 2025-02-19 13:29:48 +00:00
Daan De Meyer
759abb6d52 mkosi: update fedora commit reference
* 6c7c4a510d Do not use dynamic spec generation for non-upstream builds
* 6201755b36 Allow co-installation of systemd-sysusers-standalone and systemd
* eba1721678 Split out -sysusers and -shared
* ac9c438e27 Use dynamic spec generation for triggers
* 3671a5cc79 Move more auxiliary files into subpackages
* 5c40e08728 Remove patch that is already upstream
* 49ec9f3286 Move some files into subpackages
* 2c0b984bf4 Version 257.3
* d66f997915 Add explicit BR: libxcrypt-devel
* 1ffa7bf7c7 Make Georgian mapping patch downstream-only
* de4ae54a34 Backport PR #36194 to add Georgian mapping to kbd-model-map
* cc9bce7893 Drop override of $PATH in the user manager
* d0973df863 Backport patch to emit audit events from systemd-sysusers
* e54ec2f978 Trim changelog entries that are not relevant to users
2025-02-19 13:46:47 +01:00
Luca Boccassi
599750eb51 obs: trigger systemd-suse instead of systemd-fedora
The suse recipe is the odd one out, so now fedora builds with
arch/debian/ubuntu and suse is in its own package
2025-02-18 23:10:00 +00:00
Luca Boccassi
7b0403bef9 network: drop old kernel support (#36402) 2025-02-18 22:39:36 +00:00
Luca Boccassi
6a6d4c3f3c shell completion: add kernel-identify/inspect verbs for bootctl
Follow-up for a05255981b
Follow-up for 3e0a3a0259
2025-02-18 21:40:29 +00:00
Lennart Poettering
47cb765b86 update TODO 2025-02-18 22:33:23 +01:00
Yu Watanabe
18f2d38d5f Journal-remote: modernize source_free() and fix memleak (#36430)
- modernize source_free().
- fix memleak introduced by cfaf78001c. Fixes CID#1591182.
2025-02-19 04:56:15 +09:00
Yu Watanabe
a6eb22968c terminal-util: fix possible NULL pointer dereference
Fixes a bug introduced by 94a2b1cd25.
Fixes CID#1591787.
2025-02-18 18:34:39 +01:00
Yu Watanabe
134bb7bfdf nspawn: unconditionally enable FUSE and use FOREACH_ARRAY() (#36407)
- FUSE is unconditionally enabled in the container, as our kernel base
line (v5.4) supports userns-safe FUSE, which is supported since v4.18.
- Create /dev/net/tun only when it is accessible.
- Replaces several loops with FOREACH_ARRAY().
2025-02-19 02:09:58 +09:00
Yu Watanabe
011a83e42b network: fix KeepConfiguration=yes (#36414)
Fixes a regression in dd6d53a8dc (v257).
Fixes #36411.
2025-02-19 02:09:09 +09:00
Steve Ramage
a4750ae156 network: doc and code typo fixes (#36422)
This fixes some typos in the documentation, both grammar as well as
incorrect field names.
It also changes the casing of CheckSum to Checksum in L2TP to match
other casings.
2025-02-19 02:08:16 +09:00
Yu Watanabe
54258df829 journal-remote: fix memleak
Fixes a bug introduced by cfaf78001c.
Fixes CID#1591182.
2025-02-19 01:00:20 +09:00
Yu Watanabe
ca25c8a5e2 journal-remote: modernize source_free()
- make it return NULL,
- suppress log message about reference counter of writer unless trace
  logging is enabled,
- introduce cleanup function for RemoteSource.
2025-02-19 00:58:24 +09:00
Luca Boccassi
b7a2f8715e dissect: add helper functions to use VeritySettings in hash/set 2025-02-18 14:44:51 +00:00
Yu Watanabe
114d191a17 nspawn: move the accessibility check for device nodes into copy_devnode_one() 2025-02-18 23:35:13 +09:00
Yu Watanabe
c51e472bd4 nspawn: drop unused argument for copy_devnode_one() 2025-02-18 23:24:20 +09:00
Yu Watanabe
9fff6bf59e nspawn: create /dev/net/tun only when it is accessible
Follow-up for 985ea98e7f.

When DevicePolicy= is enabled, but DeviceAllow= for /dev/net/tun is not
specified, bind-mounting the device node from the host system is
meaningless, as it cannot be used in the container anyway.

Let's check the device node is accessible before creating or
bind-mounting.
2025-02-18 23:24:20 +09:00