Commit Graph

73799 Commits

Author SHA1 Message Date
Luca Boccassi
eb56b564a0 logind: do not fail creating a session when request is not from a unit
When running inside an LXC container the 'su' process will not be part of
any unit or slice.

manager_get_user_by_pid() which was used until v255 (included) does not fail
if it cannot find a unit/slice, but simply returns 'not found'. Do the same
in manager_get_session_by_pidref().

This was not detected as Semaphore CI does not reboot the testbed before
the logind test, so the session is started by the old logind from the base
distro, instead of the one being tested.

Follow-up for 8494f562c8
Follow-up for 5099a50d43

Fixes https://github.com/systemd/systemd/issues/32929
2024-05-20 13:14:50 +01:00
Luca Boccassi
c275e01d99 logind: add one more debug log
Helped track down issue with session tracking
2024-05-20 13:14:50 +01:00
Luca Boccassi
5002b576d8 semaphore: use variable for Salsa repo URL
Makes it easier to switch for debuggin
2024-05-20 13:14:50 +01:00
drewbug
2fa7626e18
man: fix grammar for Name= option in systemd.link 2024-05-20 11:11:22 +01:00
Luca Boccassi
eb0c2da89e
Merge pull request #32915 from yuwata/machine-id-setup
machine-id-setup: acquire machine ID from /run/machine-id if possible
2024-05-20 00:16:16 +02:00
Yu Watanabe
bb84142513 test: sync journal before starting test
Follow-up for c22a112883.

Hopefully fixes #32712.
2024-05-19 22:56:37 +02:00
Luca Boccassi
290766d72b
Merge pull request #32907 from yuwata/image-fix
several fixes for os image handling
2024-05-19 21:10:40 +02:00
Yu Watanabe
16718dcf78 machine-id-setup: acquire machine ID from /run/machine-id if possible
If machine ID is previously stored at /run/machine-id, then let's reuse
it. This is important on switching root and /etc/machine-id was previously
a mount point.

Fixes #32908.
2024-05-20 02:17:57 +09:00
Yu Watanabe
ba540e9f1c machine-id-setup: use empty_or_root() 2024-05-20 01:05:23 +09:00
Yu Watanabe
3b1b2d4e3d machine: fix use-after-free in Rename() DBus method
Fixes a bug introduced by 1ddb263d21.

Note, this requires the previous two commits, and cannot backport without them.

Note, before the previous commit, the use-after-free could be triggered
only by Rename() DBus method, and could not by RenameImage(), as we did not
cache Image object when RenameImage() method is called. And machinectl
always uses RenameImage(). Hence, the issue could be triggered only when
Rename() DBus method is explicitly called by e.g. busctl.

With the previous commit, the Image object passed to the function is
always cached. Hence, the issue could be triggered even with machinectl
command, and this fix is important.
2024-05-20 01:03:14 +09:00
Yu Watanabe
c6aeb9b596 machine: also acquire Image object from cache when a dbus method in the main interface is called
Previously, Image objects were only cached when reading properties or
methods in the org.freedesktop.machine1.Image interface are called.

This makes that, when a method in the main interface (org.freedesktop.machine1)
for an image is called, also acquire the Image object from the cache,
and if not cached, create Image object and put into the cache, like we
do for org.freedesktop.machine1.Image.

Otherwise, if some properties of an image are updated by methods in the main
interface, e.g. MarkImageReadOnly(), the changes do not applied to the cached
Image object, and subsequent read of proerties through the interface for the
image, e.g. ReadOnly property, may provide outdated values.

Follow-up for 1ddb263d21.

Fixes #32888.
2024-05-20 01:03:14 +09:00
Yu Watanabe
6d917da140 machine: split out manager_acquire_image() from image_object_find()
Preparation for the next commit. No functional change.
2024-05-20 01:03:14 +09:00
Yu Watanabe
96ac6d3fcc discover-image: also update Image.limit in image_set_limit()
Same as the previous commit, but for SetLimit DBus method vs Limit
property and friends.
2024-05-20 01:03:14 +09:00
Yu Watanabe
608c321f23 discover-image: update Image.read_only flag in image_read_only()
Otherwise, ReadOnly DBus property in org.freedesktop.machine1.Image or
org.freedesktop.portable1.Image will not be updated by MarkReadOnly DBus
method.
2024-05-20 01:03:14 +09:00
Luca Boccassi
d4d6a9e4ae
Merge pull request #32917 from YHNdnzj/ptyfwd-cleanup
ptyfwd: a few fixes/cleanups
2024-05-19 14:44:54 +02:00
Yu Watanabe
a610ba00d9 test: sync journal before read
Workaround for #32834 and #32890.
2024-05-19 13:54:28 +02:00
Mike Yuan
28459ba1f4
run: pass the pty slave fd to transient service
The rationale is similar to 40e1f4ea74.

Currently, we only pass TTYPath=/dev/pts/... to
the transient service spawned by systemd-run.
This is a bit problematic though, when ExecStartPre=
or ExecStopPost= is used. Since when these control
processes get to run, the main process is not yet
started/has already exited, hence the slave suffers
from the same vhangup problem as the mentioned commit.

By passing the slave fd in, the service manager will
hold the fd open as long as the service is alive.

Fixes #32916
2024-05-19 09:18:48 +08:00
Mike Yuan
ade0789fab
run: do not log "Error on PTY forwarding logic" when disconnected due to user operation 2024-05-19 09:18:48 +08:00
Mike Yuan
6d2a26a136
vmspawn: use openpt_allocate where appropriate 2024-05-19 09:18:48 +08:00
Mike Yuan
2153899d96
ptyfwd: trivial coding style and log cleanups 2024-05-19 09:18:48 +08:00
Luca Boccassi
68ca50d3ae
Merge pull request #32914 from yuwata/test-64-storage
test: several follow-ups for TEST-64-STORAGE
2024-05-19 02:50:36 +02:00
Yu Watanabe
301d7ee611 test: wipe filesystem before moving to the next test case 2024-05-19 05:10:28 +09:00
Yu Watanabe
2569e790f6 test: install modinfo to test image
Follow-up for 6c2d47d6d3.

Fixes the following unexpected skip:
```
[    6.163670] TEST-64-UDEV-STORAGE.sh[596]: + modinfo btrfs
[    6.164102] TEST-64-UDEV-STORAGE.sh[726]: /usr/lib/systemd/tests/testdata/units/TEST-64-UDEV-STORAGE.sh: line 726: modinfo: command not found
[    6.164683] TEST-64-UDEV-STORAGE.sh[727]: + echo 'This test requires the btrfs kernel module but it is not installed, skipping the test'
[    6.165069] TEST-64-UDEV-STORAGE.sh[728]: + tee --append /skipped
[    6.166801] TEST-64-UDEV-STORAGE.sh[728]: This test requires the btrfs kernel module but it is not installed, skipping the test
[    6.167177] TEST-64-UDEV-STORAGE.sh[596]: + exit 77
```
2024-05-19 05:08:31 +09:00
Yu Watanabe
762412f2bb
Merge pull request #32902 from yuwata/emergency-action-fixes
several fixes for emergency actions and document update
2024-05-18 16:32:36 +09:00
Yu Watanabe
e579017872
Merge pull request #32909 from arthurzam/bash-v256
shell-completion: add more missing args for bash
2024-05-18 16:30:03 +09:00
Arthur Zamarin
27e49748ca
shell-completion: add systemd-vmspawn to meson.build
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
2024-05-18 09:38:53 +03:00
Arthur Zamarin
02132022b0
shell-completion: add missing args to bash systemd-nspawn
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
2024-05-18 09:34:38 +03:00
Arthur Zamarin
030b2c8490
shell-completion: add missing args to bash systemd-run
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
2024-05-18 09:34:38 +03:00
Yu Watanabe
f3c5ea7111 install-file: make fs_make_very_read_only() static 2024-05-17 23:06:48 +02:00
Yu Watanabe
6da7485176 man: refer FailureAction= and SuccessAction= for explaining allowed values in JobTimeoutAction=
The allowed values are explained in FailureAction= and SuccessAction=,
rather than StartLimitAction=.
2024-05-18 02:51:34 +09:00
Yu Watanabe
2a2d9539f0 core: refuse invalid emergency actions for SuccessAction= and friends in user service manager
Especially, soft-reboot is not supported by user service manager.

Fixes a bug in 13ffc60749 and
3cf848f6cd.
2024-05-18 02:51:34 +09:00
Yu Watanabe
067857196c man: mention soft-reboot in bootup(7) 2024-05-18 02:51:24 +09:00
Yu Watanabe
1cd904bbe0 units: add JobTimeoutAction= to exit.target and friends
For consistency with other targets, e.g. poweroff.target or
reboot.target.
2024-05-18 01:28:14 +09:00
Mike Yuan
3acc318591 man/soft-reboot: order surviving services before shutdown.target
Prompted by #32895

Rather than ordering with each power operation targets,
ordering against shutdown.target which is a valid
synchronization point. This has no effect if soft-reboot
is being performed.
2024-05-17 16:49:58 +02:00
Zbigniew Jędrzejewski-Szmek
759e8fe7f6 man: add note about selinux to rc-local
This feature is deprecated, but if users use it, they are likely to be
tripped up by the wrong selinux context, so add a note.

https://discussion.fedoraproject.org/t/systemd-rc-local-service-doesnt-work-on-fedora-40-until-selinux-contexts-are-set-on-rc-local-script
2024-05-17 15:16:07 +02:00
Mike Yuan
de12b8d163 core/execute: do not use format str for log_object_internal
This reverts part of 210ca71cb5.

Another fallout from that commit...

Fixes #32877
2024-05-17 15:15:21 +02:00
Daan De Meyer
e3828d7103 mountpoint-util: Deal with kernel API breakage in "norecovery" mount option
"norecovery" was deprecated for btrfs in
74ef00185e
and removed in
a1912f7121.

Let's drop our assumption that btrfs supports "norecovery" and first query for the
new name of the option followed by querying for the old name.
2024-05-17 14:29:09 +02:00
Yu Watanabe
19da480d3c test: wait for underlying .device unit being active before invoking systemd-mount
Fixes following failure:
===
May 17 04:12:04 TEST-74-AUX-UTILS.sh[2684]: + systemd-mount --owner=testuser /dev/loop0 /tmp/tmp.DVQdo2ou53/mnt
(snip)
May 17 04:15:04 systemd[1]: dev-loop0.device: Job dev-loop0.device/start timed out.
May 17 04:15:04 systemd[1]: dev-loop0.device: Job 5812 dev-loop0.device/start finished, result=timeout
May 17 04:15:04 systemd[1]: Timed out waiting for device dev-loop0.device - /dev/loop0.
May 17 04:15:04 systemd[1]: tmp-tmp.DVQdo2ou53-mnt.mount: Job 5804 tmp-tmp.DVQdo2ou53-mnt.mount/start finished, result=dependency
May 17 04:15:04 systemd[1]: Dependency failed for tmp-tmp.DVQdo2ou53-mnt.mount - /tmp/tmp.DVQdo2ou53/mnt.
May 17 04:15:04 systemd[1]: tmp-tmp.DVQdo2ou53-mnt.mount: Job tmp-tmp.DVQdo2ou53-mnt.mount/start failed with result 'dependency'.
May 17 04:15:04 systemd[1]: systemd-fsck@dev-loop0.service: Job 5805 systemd-fsck@dev-loop0.service/start finished, result=dependency
May 17 04:15:04 systemd[1]: Dependency failed for systemd-fsck@dev-loop0.service - File System Check on /dev/loop0.
May 17 04:15:04 systemd[1]: systemd-fsck@dev-loop0.service: Job systemd-fsck@dev-loop0.service/start failed with result 'dependency'.
May 17 04:15:04 systemd[1]: dev-loop0.device: Job dev-loop0.device/start failed with result 'timeout'.
(snip)
May 17 04:15:04 systemd-mount[2856]: A dependency job for tmp-tmp.DVQdo2ou53-mnt.mount failed. See 'journalctl -xe' for details.
2024-05-17 12:31:32 +02:00
Yu Watanabe
514458604b test: dynamically generate list of test cases
Follow-up for #32666.
2024-05-17 17:24:18 +09:00
Yu Watanabe
fc5112580a test: wait for sessions being closed
If a session in closing state, the user state will be in online.

Fixes #32698.
2024-05-17 09:13:52 +02:00
Daan De Meyer
c84b7a5743
Merge pull request #32875 from yuwata/network-route-wireguard
network/route: fix unexpected removal of routes for wireguard
2024-05-17 09:10:33 +02:00
Yu Watanabe
0664c1cf1d test: wait for partition device being processed by udevd
Fixes #32697.
2024-05-17 09:05:49 +02:00
Yu Watanabe
272aae38f8 test: wait for slice unit being (de)activated
Fixes #32731.
2024-05-17 09:02:23 +02:00
Daan De Meyer
d42b71213a
Merge pull request #32885 from yuwata/test-do-not-fill-journal
test: do not fill journal with garbage
2024-05-17 08:54:24 +02:00
Mike Yuan
bf71770960
Merge pull request #32880 from yuwata/unit-soft-reboot
units: do not soft-reboot before soft-reboot.target reached
2024-05-17 14:06:44 +08:00
Yu Watanabe
c22a112883 test: sync journal before reading journal
Otherwise, expected lines may not be processed or not sync()ed to disk.

Fixes #32712.
2024-05-17 07:46:02 +02:00
Yu Watanabe
71f0487173 test: wait for partition processed by udevd
Fixes #32695.
2024-05-17 07:43:29 +02:00
Jian-Hong Pan
5ccd8ab263 hwdb: Enable JP-IK LEAP W502's touchpad toggle key
The laptop JP-IK LEAP W502 has touchpad toggle key (Fn+F9), but it does
not work. Because, the scancode maps to a wrong key code:

Event: time 1715846095.224900, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9d
Event: time 1715846095.224900, type 1 (EV_KEY), code 97 (KEY_RIGHTCTRL), value 1
Event: time 1715846095.224900, -------------- SYN_REPORT ------------
Event: time 1715846095.230985, type 4 (EV_MSC), code 4 (MSC_SCAN), value db
Event: time 1715846095.230985, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 1
Event: time 1715846095.230985, -------------- SYN_REPORT ------------
Event: time 1715846095.232903, type 4 (EV_MSC), code 4 (MSC_SCAN), value 76
Event: time 1715846095.232903, type 1 (EV_KEY), code 85 (KEY_ZENKAKUHANKAKU), value 1
Event: time 1715846095.232903, -------------- SYN_REPORT ------------

Map the scancode 76 to KEY_F21 to enable the touchpad toggle key.
2024-05-17 14:24:20 +09:00
Yu Watanabe
55732636ed test: do not fill journal with diff 2024-05-17 14:17:11 +09:00
Yu Watanabe
cad510b08c test: do not fill journal with "wait" 2024-05-17 14:17:11 +09:00