Matteo Croce [Sun, 6 Oct 2024 21:26:30 +0000 (23:26 +0200)]
network/sysctl-monitor: change variable type to avoid preverifier denial
The compiler clones the u32 i variable to another register, and fails to
calculate the range of possible values, so the verification fails.
libbpf: prog 'sysctl_monitor': BPF program load failed: Permission denied
libbpf: prog 'sysctl_monitor': -- BEGIN PROG LOAD LOG --
0: R1=ctx() R10=fp0
; int sysctl_monitor(struct bpf_sysctl *ctx) { @ sysctl-monitor.bpf.c:65
0: (bf) r6 = r1 ; R1=ctx() R6_w=ctx()
; if (bpf_current_task_under_cgroup(&cgroup_map, 0)) @ sysctl-monitor.bpf.c:69
1: (18) r1 = 0xffff892a0fda9c00 ; R1_w=map_ptr(map=cgroup_map,ks=4,vs=4)
3: (b7) r2 = 0 ; R2_w=0
4: (85) call bpf_current_task_under_cgroup#37 ; R0_w=scalar()
5: (55) if r0 != 0x0 goto pc+88 ; R0_w=0
; if (!ctx->write) @ sysctl-monitor.bpf.c:73
6: (61) r1 = *(u32 *)(r6 +0) ; R1_w=scalar(smin=0,smax=umax=0xffffffff,var_off=(0x0; 0xffffffff)) R6_w=ctx()
7: (15) if r1 == 0x0 goto pc+86 ; R1_w=scalar(smin=umin=umin32=1,smax=umax=0xffffffff,var_off=(0x0; 0xffffffff))
8: (b7) r1 = 1 ; R1_w=1
; we.version = 1; @ sysctl-monitor.bpf.c:81
9: (7b) *(u64 *)(r10 -480) = r1 ; R1_w=1 R10=fp0 fp-480_w=1
10: (b7) r8 = 0 ; R8_w=0
; we.path[0] = 0; @ sysctl-monitor.bpf.c:83
11: (73) *(u8 *)(r10 -440) = r8 ; R8_w=0 R10=fp0 fp-440=???????0
; we.newvalue[0] = 0; @ sysctl-monitor.bpf.c:86
12: (73) *(u8 *)(r10 -180) = r8 ; R8_w=0 R10=fp0 fp-184=???0????
; we.current[0] = 0; @ sysctl-monitor.bpf.c:85
13: (73) *(u8 *)(r10 -340) = r8 ; R8_w=0 R10=fp0 fp-344=???0????
; we.comm[0] = 0; @ sysctl-monitor.bpf.c:84
14: (73) *(u8 *)(r10 -456) = r8 ; R8_w=0 R10=fp0 fp-456=???????0
; we.pid = bpf_get_current_pid_tgid() >> 32; @ sysctl-monitor.bpf.c:89
15: (85) call bpf_get_current_pid_tgid#14 ; R0=scalar()
16: (77) r0 >>= 32 ; R0_w=scalar(smin=0,smax=umax=0xffffffff,var_off=(0x0; 0xffffffff))
17: (63) *(u32 *)(r10 -472) = r0 ; R0_w=scalar(id=1,smin=0,smax=umax=0xffffffff,var_off=(0x0; 0xffffffff)) R10=fp0 fp-472=????scalar(id=1,smin=0,smax=umax=0xffffffff,var_off=(0x0; 0xffffffff))
; we.cgroup_id = bpf_get_current_cgroup_id(); @ sysctl-monitor.bpf.c:90
18: (85) call bpf_get_current_cgroup_id#80 ; R0_w=s
libbpf: prog 'sysctl_monitor': failed to load: -13
libbpf: failed to load object 'sysctl_monitor_bpf'
libbpf: failed to load BPF skeleton 'sysctl_monitor_bpf': -13
Unable to load sysctl monitor BPF program, ignoring: Permission denied.
Change the type to u64 to fix it.
Lennart Poettering [Wed, 9 Oct 2024 13:39:30 +0000 (15:39 +0200)]
namespace: rename drop_unused_mounts() → sort_and_drop_unused_mounts()
The function sorts the listed mounts, and that's kinda key, hence
reflect that in the name.
Tobias Fleig [Tue, 8 Oct 2024 14:54:43 +0000 (07:54 -0700)]
stub: Add support for .initrd addon files
Teaches systemd-stub how to load additional initrds from addon files.
This is very similar to the support for .ucode sections in addon files,
but with different ordering. Initrds from addons have a chance to
overwrite files from the base initrd in the UKI.
Daan De Meyer [Wed, 9 Oct 2024 09:42:26 +0000 (11:42 +0200)]
Merge pull request #34679 from DaanDeMeyer/bus-log
Various logging improvements
Lennart Poettering [Wed, 9 Oct 2024 08:39:30 +0000 (10:39 +0200)]
Merge pull request #34656 from yuwata/private-users
core: drop implicit support of PrivateUsers=off
Lennart Poettering [Wed, 9 Oct 2024 08:35:19 +0000 (10:35 +0200)]
Merge pull request #34651 from yuwata/polkit-transient-unit
dbus: pass transient unit name metadata to polkit
Lennart Poettering [Wed, 9 Oct 2024 07:14:12 +0000 (09:14 +0200)]
hwdb: move key 66/65 handling from specific to generic HP laptop coverage
This takes the idea from #18595 and implements it based on our current
hwdb: the original PR suggested the keys 66/65 are a generic HP thing,
and not limited to specific laptops. The current specific laptop entries
do not contradict that claim.
Hence, let's move them from the specific sections matching some HP
laptops to the generic section matching all.
This uses the correct key names, which have long been fixed (which used
to be a problem our CI was tripped off by).
This is not tested, but I think fairly risk-less, and should allow us to
get rid of a really old PR.
Replaces: #18595
Daan De Meyer [Tue, 8 Oct 2024 14:28:25 +0000 (16:28 +0200)]
core: Log in more scenarios about which process initiated an operation
Exit/Reboot/Poweroff and similar operations are invasive enough that
logging about who initiated them is very useful to debug issues.
Daan De Meyer [Tue, 8 Oct 2024 14:25:52 +0000 (16:25 +0200)]
core: Bump log level of reexecute request to notice
A daemon-reload is important enough to deserve logging at notice
level.
Daan De Meyer [Tue, 8 Oct 2024 14:22:58 +0000 (16:22 +0200)]
bus-util: Log more information when connecting to a bus socket fails
Let's log about which bus we're trying to connect to and what transport
we're using to do it.
Lennart Poettering [Wed, 9 Oct 2024 08:25:30 +0000 (10:25 +0200)]
Merge pull request #34593 from Werkov/deprecate-aux-scopes
core/manager: Deprecate StartAuxiliaryScope() method
Lennart Poettering [Wed, 9 Oct 2024 08:24:10 +0000 (10:24 +0200)]
Merge pull request #34671 from yuwata/memory
tree-wide: several memory accounting cleanups
Lennart Poettering [Wed, 9 Oct 2024 07:03:29 +0000 (09:03 +0200)]
NEWS: announce the F20/F21/F22/F23 key mangling removal scheduled for v258
As per: https://github.com/systemd/systemd/pull/34325
And: https://github.com/systemd/systemd/issues/34323
Lennart Poettering [Wed, 9 Oct 2024 06:52:30 +0000 (08:52 +0200)]
update TODO
Yu Watanabe [Tue, 8 Oct 2024 20:49:00 +0000 (05:49 +0900)]
core: drop implicit support of PrivateTmp=off
Follow-up for
0e551b04efb911d38b586cca1a6a462c87a2cb1b.
Similar to the previous commit, but for PrivateTmp=.
Renjaya Raga Zenta [Tue, 1 Oct 2024 04:34:51 +0000 (11:34 +0700)]
core/dbus: pass transient unit name metadata to polkit
Fixes #17224
Yu Watanabe [Tue, 8 Oct 2024 21:57:06 +0000 (06:57 +0900)]
core/dbus: add assertions
Yu Watanabe [Tue, 8 Oct 2024 21:28:06 +0000 (06:28 +0900)]
core/dbus: introduce bus_verify_manage_units_async_impl()
Then, make bus_verify_manage_units_async() and _full() inline.
Co-authored-by: Renjaya Raga Zenta <ragazenta@gmail.com>
Yu Watanabe [Tue, 8 Oct 2024 21:08:11 +0000 (06:08 +0900)]
core/dbus: move bus_verify_xyz() to dbus-util.c
Chen Guanqiao [Wed, 2 Oct 2024 05:10:21 +0000 (13:10 +0800)]
mount: optimize mountinfo traversal by decoupling device discovery
In mount_load_proc_self_mountinfo(), device_found_node() is synchronously called
during the traversal of mountinfo entries. When there are a large number of
mount points, and the device types are not significantly different, this results
in excessive time consumption during device discovery, causing a performance
bottleneck. This issue is particularly prominent on servers with a large number
of cores in IDC.
This patch decouples device discovery from the mountinfo traversal process,
avoiding redundant device operations. As a result, it significantly improves
performance, especially in environments with numerous mount points.
Signed-off-by: Chen Guanqiao <chen.chenchacha@foxmail.com>
Yu Watanabe [Mon, 7 Oct 2024 04:40:55 +0000 (13:40 +0900)]
core: drop implicit support of PrivateUsers=off
Follow-up for
fa693fdc7e17618958c505af4b2f39ecd1c3363e.
The documentation says the option takes a boolean or one of the "self"
and "identity". But the parser uses private_users_from_string() which
also accepts "off". Let's drop the implicit support of "off".
Yu Watanabe [Tue, 8 Oct 2024 03:27:44 +0000 (12:27 +0900)]
oomd: separate entries with comma for readability
Yu Watanabe [Tue, 8 Oct 2024 03:26:52 +0000 (12:26 +0900)]
oomd: update system context when oomctl is invoked
Otherwise, oomctl shows 0 memory and swap usage when swap monitoring
is not enabled.
=======
$ oomctl
Dry Run: no
Swap Used Limit: 90.00%
Default Memory Pressure Limit: 60.00%
Default Memory Pressure Duration: 20s
System Context:
Memory: Used: 0B Total: 0B
Swap: Used: 0B Total: 0B
Swap Monitored CGroups:
Memory Pressure Monitored CGroups:
...
======
Yu Watanabe [Tue, 8 Oct 2024 03:12:25 +0000 (12:12 +0900)]
oomd: drop unused usec_now
Yu Watanabe [Tue, 8 Oct 2024 02:07:47 +0000 (11:07 +0900)]
systemctl: separate memory usage with comma
Just for readability.
Before:
$ build/systemctl status -n 0 systemd-networkd.service | grep Memory:
Memory: 4.7M (peak: 14.3M swap: 1M swap peak: 1.1M)
After:
$ build/systemctl status -n 0 systemd-networkd.service | grep Memory:
Memory: 4.7M (peak: 14.3M, swap: 1M, swap peak: 1.1M)
Yu Watanabe [Mon, 7 Oct 2024 21:19:04 +0000 (06:19 +0900)]
core: suppress one debugging log
Otherwise, the log is shown even when getting properties.
Even though it is in the debug level, that's quite noisy.
[ 338.785847] TEST-55-OOMD.sh[1624]: Oct 07 16:35:15 H systemd[1]: TEST-55-OOMD-testmunch.service: Unit not running in private mount namespace, cannot live mount
[ 338.786985] TEST-55-OOMD.sh[1624]: Oct 07 16:35:17 H systemd[1]: TEST-55-OOMD-testmunch.service: Unit not running in private mount namespace, cannot live mount
[ 338.787412] TEST-55-OOMD.sh[1624]: Oct 07 16:35:20 H systemd[1]: TEST-55-OOMD-testmunch.service: Unit not running in private mount namespace, cannot live mount
[ 338.791776] TEST-55-OOMD.sh[1624]: Oct 07 16:35:22 H systemd[1]: TEST-55-OOMD-testmunch.service: Unit not running in private mount namespace, cannot live mount
[ 338.792938] TEST-55-OOMD.sh[1624]: Oct 07 16:35:24 H systemd[1]: TEST-55-OOMD-testmunch.service: Unit not running in private mount namespace, cannot live mount
[ 338.793225] TEST-55-OOMD.sh[1624]: Oct 07 16:35:26 H systemd[1]: TEST-55-OOMD-testmunch.service: Unit not running in private mount namespace, cannot live mount
[ 338.793424] TEST-55-OOMD.sh[1624]: Oct 07 16:35:28 H systemd[1]: TEST-55-OOMD-testmunch.service: Unit not running in private mount namespace, cannot live mount
[ 338.796448] TEST-55-OOMD.sh[1624]: Oct 07 16:35:31 H systemd[1]: TEST-55-OOMD-testmunch.service: Unit not running in private mount namespace, cannot live mount
[ 338.797997] TEST-55-OOMD.sh[1624]: Oct 07 16:35:33 H systemd[1]: TEST-55-OOMD-testmunch.service: Unit not running in private mount namespace, cannot live mount
[ 338.799206] TEST-55-OOMD.sh[1624]: Oct 07 16:35:35 H systemd[1]: TEST-55-OOMD-testmunch.service: Unit not running in private mount namespace, cannot live mount
Luca Boccassi [Tue, 8 Oct 2024 18:30:57 +0000 (19:30 +0100)]
Merge pull request #34675 from poettering/dupfd-query
fd-util: use F_DUPFD_QUERY for same_fd()
Luca Boccassi [Tue, 8 Oct 2024 18:27:43 +0000 (19:27 +0100)]
Merge pull request #34674 from yuwata/reallocarray
tree-wide: replace reallocarray() with GREEDY_REALLOC()
Luca Boccassi [Tue, 8 Oct 2024 18:21:28 +0000 (19:21 +0100)]
Merge pull request #34672 from yuwata/timestamp
analyze: fix timestamp
Michal Koutný [Mon, 30 Sep 2024 17:27:29 +0000 (19:27 +0200)]
core/manager: Deprecate StartAuxiliaryScope() method
The method was added with migration of resources in mind (e.g. process's
allocated memory will follow it to the new scope), however, such a
resource migration is not in cgroup semantics. The method may thus have
the intended users and others could be guided to StartTransientUnit().
Since this API was advertised in a regular release, start the removal
with a deprecation message to callers.
Eventually, the goal is to remove the method to clean up DBus API and
simplify code (removal of cgroup_context_copy()).
Part of DBus docs is retained to satisfy build checks.
Luca Boccassi [Tue, 8 Oct 2024 14:44:55 +0000 (15:44 +0100)]
Merge pull request #34678 from kalrish/documentation-fixes
Fix little errors in man pages `machinectl(1)` and `systemd-nspawn(1)`
David Joaquín Shourabi Porcel [Tue, 8 Oct 2024 13:20:26 +0000 (15:20 +0200)]
man: `machinectl(1)`: Fix description of subcommand `poweroff`
David Joaquín Shourabi Porcel [Fri, 12 Apr 2024 20:14:47 +0000 (22:14 +0200)]
man: `systemd-nspawn(1)`: Fix some typos
Lennart Poettering [Tue, 8 Oct 2024 11:26:59 +0000 (13:26 +0200)]
Merge pull request #34556 from ryantimwilson/extra-fds
Add ExtraFileDescriptor property to StartTransientUnit dbus API
Lennart Poettering [Tue, 8 Oct 2024 08:01:22 +0000 (10:01 +0200)]
fd-util: use F_DUPFD_QUERY for same_fd()
Catch up with the nice little toys the kernel fs developers have added
for us. Preferably, let's make use of the new F_DUPFD_QUERY fcntl() call
that checks whether two fds are just duplicates of each other
(duplicates as in dup(), not as in open() of the same inode, i.e.
whether they share a single file offset and so on).
This API is much nicer, since it is a core kernel feature, unlike the
kcmp() call we so far used, which is part of the (optional)
checkpoint/restore stuff.
F_DUPFD_QUERY is available since kernel 6.10.
Lennart Poettering [Tue, 8 Oct 2024 09:51:48 +0000 (11:51 +0200)]
fd-util: introduce fd_validate() helper
It just uses F_GETFD to validate an fd. it's a bit easier to read
though, and handles the < 0 case internally.
Yu Watanabe [Tue, 8 Oct 2024 06:26:02 +0000 (15:26 +0900)]
tree-wide: replace reallocarray() with GREEDY_REALLOC()
Yu Watanabe [Tue, 8 Oct 2024 06:25:13 +0000 (15:25 +0900)]
sd-bus: introduce bus_process_cmsg()
- Close all fds on failure.
- Close pidfd on success.
Yu Watanabe [Tue, 8 Oct 2024 04:55:56 +0000 (13:55 +0900)]
analyze: use RET_GATHER()
Yu Watanabe [Tue, 8 Oct 2024 04:52:40 +0000 (13:52 +0900)]
test: add test cases for timestamp with time zone
Yu Watanabe [Tue, 8 Oct 2024 04:50:02 +0000 (13:50 +0900)]
time-util: copy input string before fork()
Fixes #34670.
Yu Watanabe [Tue, 8 Oct 2024 09:59:37 +0000 (18:59 +0900)]
time-util: fix parsing timestamp with NZ timezone
Fixes a bug caused by
ef658a63f8163607d9e04f710cd26c0d36ff68ce.
Yu Watanabe [Mon, 7 Oct 2024 10:34:08 +0000 (19:34 +0900)]
core: use memdup_suffix0() at one more place
Yu Watanabe [Mon, 7 Oct 2024 10:26:55 +0000 (19:26 +0900)]
prioq: use GREEDY_REALLOC() and structured initializer
No functional change, just refactoring.
Yu Watanabe [Tue, 8 Oct 2024 05:42:26 +0000 (14:42 +0900)]
Merge pull request #34669 from bluca/semaphore
Update mkosi debian ref and try to speed up semaphore build
Luca Boccassi [Mon, 7 Oct 2024 15:48:55 +0000 (16:48 +0100)]
mkosi: mark test as skipped when QEMU crashes
On Ubuntu/Debian infrastructure QEMU crashes a lot, so mark the test
as skipped in that case as there's nothing we can do about it and
we shouldn't mark runs as failed
Luca Boccassi [Mon, 7 Oct 2024 18:40:31 +0000 (19:40 +0100)]
semaphore: do not build docs
There are other CI runs that build manpages, speed up build which is close to 1hr limit
Luca Boccassi [Mon, 7 Oct 2024 18:38:16 +0000 (19:38 +0100)]
semaphore: stop building and running extra unit tests
This slows down the build, which is often near the 1hr limit. There are
other jobs running the extra unit tests.
Luca Boccassi [Mon, 7 Oct 2024 18:38:31 +0000 (19:38 +0100)]
mkosi: update debian commit reference
*
51389fefca Upstream profile: skip dh_strip_nondeterminism
*
647fd0d40c Install kernel-install uki.conf example
*
ddfeb24f55 autopkgtest: skip gdm3 on armel for smoke tests
Ryan Wilson [Mon, 30 Sep 2024 16:58:34 +0000 (09:58 -0700)]
Add ExtraFileDescriptor property to StartTransientUnit dbus API
This adds the ExtraFileDescriptor property to StartTransient dbus API
with format "a(hs)" - array of (file descriptor, name) pairs. The FD
will be passed to the unit via sd_notify like Socket and OpenFile.
systemctl show also shows ExtraFileDescriptorName for these transient
units. We only show the name passed to dbus as the FD numbers will
change once passed over the unix socket and are duplicated, so its
confusing to display the numbers.
We do not add this functionality for systemd-run or general systemd
service units as it is not useful for general systemd services.
Arguably, it could be useful for systemd-run in bash scripts but we
prefer to be cautious and not expose the API yet.
Fixes: #34396
Daan De Meyer [Mon, 7 Oct 2024 15:22:31 +0000 (17:22 +0200)]
Merge pull request #34472 from ikruglov/ikruglov/io-systemd-Machine
machine: implement varlink interfaces io.systemd.Machine.{List, Unregister, Terminate, Kill}
Luca Boccassi [Mon, 7 Oct 2024 10:23:32 +0000 (11:23 +0100)]
Semaphore: switch from /tmp to /var/tmp to avoid disk space issues
Builds have been failing as we run out of space in /tmp/, move to
/var/tmp
Ivan Kruglov [Mon, 7 Oct 2024 09:35:32 +0000 (11:35 +0200)]
machine: tests for varlink interfaces
- io.systemd.Machine.List
- io.systemd.Machine.Kill
- io.systemd.Machine.Terminate
- io.systemd.Machine.Register
- io.systemd.Machine.Unregister
Ivan Kruglov [Tue, 24 Sep 2024 08:21:46 +0000 (10:21 +0200)]
machine: extend io.systemd.Machine.List output with sshPrivateKeyPath field
Effectivelly, this is an implementation of GetMachineSSHInfo in dbus.
Ivan Kruglov [Mon, 7 Oct 2024 12:39:32 +0000 (14:39 +0200)]
machine: use JSON_BUILD_PAIR_STRING_NON_EMPTY() in io.systemd.Machine.List output
Ivan Kruglov [Mon, 7 Oct 2024 09:27:41 +0000 (11:27 +0200)]
machine: introduce io.systemd.Machine.Kill varlink method
Ivan Kruglov [Mon, 7 Oct 2024 09:27:16 +0000 (11:27 +0200)]
machine: introduce io.systemd.Machine.Terminate varlink method
Ivan Kruglov [Mon, 7 Oct 2024 09:26:02 +0000 (11:26 +0200)]
machine: introduce io.systemd.Machine.Unregister varlink method
Ivan Kruglov [Mon, 7 Oct 2024 09:22:11 +0000 (11:22 +0200)]
machine: io.systemd.Machine.List supports 'pid' filter
Luca Boccassi [Mon, 7 Oct 2024 11:17:28 +0000 (12:17 +0100)]
Merge pull request #34644 from yuwata/udev-node-diskseq
udev-node: do not create stack directory for by-diskseq symlink
Thomas Blume [Thu, 19 Sep 2024 10:02:27 +0000 (12:02 +0200)]
test: set TEST_NESTED_KVM as default
Daan De Meyer [Mon, 7 Oct 2024 07:49:38 +0000 (09:49 +0200)]
mkosi: Switch to Fedora 41
It's due for release soon and will fix the flakyness of TEST-58-REPART
so let's bump the Fedora 40 job to Fedora 41.
Yu Watanabe [Mon, 7 Oct 2024 04:27:37 +0000 (13:27 +0900)]
sd-json: use sd_json_dispatch_const_string() in sd_json_dispatch_string()
Also, do similar for json_dispatch_user_group_name().
Yu Watanabe [Mon, 7 Oct 2024 03:47:57 +0000 (12:47 +0900)]
tree-wide: drop doubled empty lines
Yu Watanabe [Mon, 7 Oct 2024 03:39:27 +0000 (12:39 +0900)]
network: use Network.name for bus path
No functional change, just refactoring.
Yu Watanabe [Mon, 7 Oct 2024 03:18:54 +0000 (12:18 +0900)]
networkctl: sort ifindexes in status command
Before:
$ networkctl status
● Interfaces: 372, 368, 373, 375, 376, 377, 378, 379, 381, 391, 3, 1201, 1202, 1184, 1610, 9, 8, 1340, 2, 1, 1256, 7
After:
$ networkctl status
● Interfaces: 1, 2, 3, 7, 8, 9, 368, 372, 373, 375, 376, 377, 378, 379, 381, 391, 1184, 1201, 1202, 1256, 1340, 1610
Yu Watanabe [Mon, 7 Oct 2024 04:45:46 +0000 (13:45 +0900)]
homectl: drop unnecessary brackets
Follow-up for
164ca24d7464253e5f8375226b792ef8f6eaffd0.
Yu Watanabe [Mon, 7 Oct 2024 06:38:58 +0000 (15:38 +0900)]
Merge pull request #34491 from AdrianVovk/sysupdate-fixups
Quick sysupdate fixups
ButterflyOfFire [Mon, 7 Oct 2024 04:52:46 +0000 (06:52 +0200)]
po: Translated using Weblate (Kabyle)
Currently translated at 3.1% (8 of 253 strings)
Co-authored-by: ButterflyOfFire <butterflyoffire@protonmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/kab/
Translation: systemd/main
Yu Watanabe [Mon, 7 Oct 2024 05:05:44 +0000 (14:05 +0900)]
Merge pull request #34408 from Werkov/fix-device-limits
core/cgroup: Apply IODevice*= directives in configured order
Lukas Nykryn [Fri, 4 Oct 2024 08:51:02 +0000 (10:51 +0200)]
core: warn if a generator is world-writable
... because that is obviously a security risk.
Joshua Grisham [Mon, 7 Oct 2024 01:41:30 +0000 (03:41 +0200)]
hwdb: add SCAI SKU prefix for Samsung keyboard mapping (#34648)
Yu Watanabe [Sun, 6 Oct 2024 05:41:23 +0000 (14:41 +0900)]
udev-node: introduce node_remove_symlink()
Also
- make the failure propagated,
- remove /dev/block or /dev/char if empty.
Hopefully, no effective functionality changed. Just refactoring.
Yu Watanabe [Sun, 6 Oct 2024 05:39:46 +0000 (14:39 +0900)]
udev-node: rename node_symlink() -> node_create_symlink()
Also adds short comment for the NULL arguments.
No functional change, just refactoring.
Yu Watanabe [Sun, 6 Oct 2024 06:39:36 +0000 (15:39 +0900)]
test: add test case for issue #34637
Yu Watanabe [Sun, 6 Oct 2024 05:43:45 +0000 (14:43 +0900)]
udev-node: skip stack directory creation for diskseq
The disk/by-diskseq symlink should not be shared with multiple block
devices. Hence, it is not necessary to create stack directory for the
symlink that manages which device owns the symlink.
This is not just a optimization.
If a service unit tries to mount a disk image but the service fails, then
the diskseq of the loop device for the image may be continuously increased
during restart, and inodes in /run may increase rapidly, as the stack
directories are cleaned up only when udev queue is empty.
Fixes #34637.
Yu Watanabe [Mon, 7 Oct 2024 00:53:57 +0000 (09:53 +0900)]
Yu Watanabe [Mon, 7 Oct 2024 00:31:47 +0000 (09:31 +0900)]
Merge pull request #34432 from YHNdnzj/path-lookup-refactor
path-lookup: several cleanups
Ryan Wilson [Mon, 30 Sep 2024 16:52:55 +0000 (09:52 -0700)]
busctl: Support file descriptors in busctl
Previously using file descriptors as input arguments in busctl was
unsupported with "UNIX file descriptor not supported as type."
We fix this by parsing the file descriptor as an integer and verifying
it is an available file descriptor in busctl.
Fixes: #14954
Replaces: #34551
Benjamin ROBIN [Sun, 6 Oct 2024 15:02:06 +0000 (17:02 +0200)]
shutdown: In sync_with_progress(), log first then send SIGKILL
The order of these 2 lines was swapped in commit
758760a3610e3c6674de8a1d51b12b991eafef7c. Put them in the right order,
and take yuwata's comment into account.
Zbigniew Jędrzejewski-Szmek [Fri, 4 Oct 2024 15:37:25 +0000 (17:37 +0200)]
sd-json: reorder enum so that SD_JSON_FORMAT_OFF is first
This doesn't really matter, all bits in a word are created equal, but having
the "off" value in the middle seems strange.
Mike Yuan [Sat, 14 Sep 2024 17:14:33 +0000 (19:14 +0200)]
path-lookup: move xdg_user_dirs() to xdg-autostart-generator
This is the only place where xdg_user_dir() is needed and
makes sense. All other invocations have been replaced with
user_search_dirs() - see previous commits for details.
Mike Yuan [Sat, 7 Sep 2024 17:12:58 +0000 (19:12 +0200)]
path-lookup: refactor lookup_paths_init() search paths handling
* Rename user_dirs() -> user_unit_search_dirs() and port to
user_search_dirs()
* Use STRV_IFNOTNULL to guard paths that could be NULL,
assert otherwise
Mike Yuan [Sat, 14 Sep 2024 17:02:32 +0000 (19:02 +0200)]
path-lookup: introduce user_search_dirs() (shall replace xdg_user_dirs())
xdg_user_dirs() doesn't seem well-organized currently.
In all other xdg_user_*() funcs we assume /etc/xdg/systemd
to be a symlink to /etc/systemd/, hence it is the odd one out.
Also, when the relevant envvar is unset, it only returns
the global search dirs.
sd_path_lookup() actually covers this nicely with SD_PATH_SEARCH_*,
where the combined search paths (from user home and system) are used.
Therefore, let's introduce a wrapper for that, and deprecate xdg_user_dirs()
(would be removed in later commits).
Mike Yuan [Sun, 6 Oct 2024 17:41:33 +0000 (19:41 +0200)]
path-lookup: assert that LOOKUP_PATHS_{EXCLUDE,TEMPORARY}_GENERATED are not used in conjunction
Mike Yuan [Sat, 7 Sep 2024 13:27:04 +0000 (15:27 +0200)]
path-lookup: unify *_generator_binary_paths()
Mike Yuan [Sun, 25 Aug 2024 18:32:18 +0000 (20:32 +0200)]
path-lookup: modernize get_paths_from_environ()
Use retval rather than additional param to indicate
whether the normal paths shall be appended.
Mike Yuan [Sun, 25 Aug 2024 18:18:58 +0000 (20:18 +0200)]
path-lookup: shortcut patch_root_prefix() if no root_dir
Mike Yuan [Sun, 25 Aug 2024 18:07:12 +0000 (20:07 +0200)]
path-lookup: unify acquire_{config,control,attached}_dir()
Note that -ENXIO reported by xdg_user_config_dir() is now properly
propagated rather than ignored, as unlike XDG_RUNTIME_DIR, XDG_CONFIG_HOME
has a default value hence ENXIO is not really expected.
Mike Yuan [Sun, 15 Sep 2024 16:53:22 +0000 (18:53 +0200)]
path-lookup: use path_strv_contains() rather than strv_contains()
Mike Yuan [Sun, 25 Aug 2024 17:42:59 +0000 (19:42 +0200)]
path-lookup: clean up acquire_{generator,transient}_dirs() a bit
Mike Yuan [Sat, 24 Aug 2024 13:33:53 +0000 (15:33 +0200)]
path-lookup: modernize runtime_directory() too
Mike Yuan [Fri, 23 Aug 2024 16:55:24 +0000 (18:55 +0200)]
path-lookup: deduplicate xdg_user_*() with sd_path_lookup()
While at it, place ret param at last.
Mike Yuan [Sun, 15 Sep 2024 18:57:03 +0000 (20:57 +0200)]
path-lookup: move from basic/ to libsystemd/
So that sd_path_lookup() can be utilized to replace
duplicate functions.
Mike Yuan [Fri, 4 Oct 2024 10:57:23 +0000 (12:57 +0200)]
path-lookup: move find_portable_profile() to portable-util
Mike Yuan [Fri, 4 Oct 2024 10:56:34 +0000 (12:56 +0200)]
path-lookup: move NETWORK_DIRS to network-util.h
Mike Yuan [Thu, 19 Sep 2024 11:53:25 +0000 (13:53 +0200)]
unit-file: make unit_type_may_{alias_template} static inline
Mike Yuan [Thu, 19 Sep 2024 11:48:05 +0000 (13:48 +0200)]
basic/unit-file: move to shared/
Preparation for later commits, where path-lookup would be
moved into libsystemd.
Note that it currently includes sd-id128.h, hence shared/
seems more appropriate anyway.
Daniel Martinez [Sun, 6 Oct 2024 03:39:43 +0000 (23:39 -0400)]
Use case insensitive comparison for the machine's architechture
boot loader specification states:
architecture: refers to the architecture this entry is for. The argument
should be an architecture identifier, using the architecture vocabulary
defined by the EFI specification (i.e. IA32, x64, IA64, ARM, AA64, …).
If specified and it does not match the local system architecture this
entry should be hidden. The comparison should be done case-insensitively.
Example: architecture aa64
https://uapi-group.org/specifications/specs/boot_loader_specification/#type-1-boot-loader-entry-keys
Yu Watanabe [Sun, 6 Oct 2024 04:50:11 +0000 (13:50 +0900)]
Merge pull request #34638 from YHNdnzj/laccess-error-check
various: correct laccess() error check