From: Lennart Poettering Date: Thu, 26 Jun 2025 09:17:23 +0000 (+0200) Subject: docs: properly document inhibitor locks X-Git-Tag: v258-rc1~245^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2cdaad5b3b255fa23b96c867a3e9e36edd64b5d8;p=thirdparty%2Fsystemd.git docs: properly document inhibitor locks I still am annoyed that this wasn't documented properly when the inhibitor locks where modified, even though raised multiple times in PR reviews. Follow-up for: #30307 See: #34091 --- diff --git a/docs/INHIBITOR_LOCKS.md b/docs/INHIBITOR_LOCKS.md index a7e2d91fdf5..fdf7b1e9ff1 100644 --- a/docs/INHIBITOR_LOCKS.md +++ b/docs/INHIBITOR_LOCKS.md @@ -42,8 +42,8 @@ If such a lock is taken the operation will fail (but still may be overridden if The InhibitDelayMaxSec= setting in [logind.conf(5)](http://www.freedesktop.org/software/systemd/man/logind.conf.html) controls the timeout for this. This is intended to be used by applications which need a synchronous way to execute actions before system suspend but shall not be allowed to block suspend indefinitely. This mode is only available for _sleep_ and _shutdown_ locks. -3. _block-weak_ that works as its non-weak counterpart, but that in addition may be ignored -automatically and silently under certain circumstances, unlike the former which is always respected. +3. _block-weak_ is identical to _block_, but has no effect on operations + requested by root or by the user owning the inhibitor lock. Inhibitor locks are taken via the Inhibit() D-Bus call on the logind Manager object: diff --git a/man/org.freedesktop.login1.xml b/man/org.freedesktop.login1.xml index c344cb3014c..19020321954 100644 --- a/man/org.freedesktop.login1.xml +++ b/man/org.freedesktop.login1.xml @@ -675,16 +675,20 @@ node /org/freedesktop/login1 { #define SD_LOGIND_SKIP_INHIBITORS (UINT64_C(1) << 4) When the flags is 0 then these methods behave just like the versions without - flags. Since systemd version 257 active inhibitors are honoured by default for privileged users too. - SD_LOGIND_ROOT_CHECK_INHIBITORS (0x01) now only applies to weak inhibitors, to - request that they honoured for privileged users too, since they ignore them by default. A new flag - SD_LOGIND_SKIP_INHIBITORS (0x04) can be specified to bypass all types of - inhibitors. When SD_LOGIND_KEXEC_REBOOT (0x02) is set, then - RebootWithFlags() performs a kexec reboot if kexec kernel is loaded. When - SD_LOGIND_SOFT_REBOOT (0x04) is set, or - SD_LOGIND_SOFT_REBOOT_IF_NEXTROOT_SET_UP (0x08) is set and a new root file system - has been set up on /run/nextroot/, then RebootWithFlags() - performs a userspace reboot only. SD_LOGIND_SOFT_REBOOT_IF_NEXTROOT_SET_UP and + flags. Since systemd version 257 inhibitors of type block are enforced on operations + requested by both privileged and unprivileged users. Previously they were honoured only by unprivileged + users, excluding the user owning the inhibitor. The latter behaviour is now available through the + block-weak inhibitor lock type. SD_LOGIND_ROOT_CHECK_INHIBITORS + (0x01) makes block-weak locks behave like regular block locks, + i.e. ensures they are honoured for any user. A flag SD_LOGIND_SKIP_INHIBITORS + (0x10) can be specified to bypass both block and block-weak + inhibitors (it has no effect on delay inhibitors). When + SD_LOGIND_KEXEC_REBOOT (0x02) is set, then RebootWithFlags() + performs a kexec reboot if kexec kernel is loaded. When SD_LOGIND_SOFT_REBOOT + (0x04) is set, or SD_LOGIND_SOFT_REBOOT_IF_NEXTROOT_SET_UP (0x08) is set and a new + root file system has been set up on /run/nextroot/, then + RebootWithFlags() performs a userspace reboot + only. SD_LOGIND_SOFT_REBOOT_IF_NEXTROOT_SET_UP and SD_LOGIND_KEXEC_REBOOT can be combined, with soft-reboot having precedence. diff --git a/man/systemd-inhibit.xml b/man/systemd-inhibit.xml index a8516a5f44c..27ea6d9836b 100644 --- a/man/systemd-inhibit.xml +++ b/man/systemd-inhibit.xml @@ -95,13 +95,14 @@ Takes block, delay, or block-weak and describes how the lock is applied. If block is used (the default), the lock prohibits any of the requested operations without time limit, and only - privileged users may override it. If delay is used, the lock can only delay the - requested operations for a limited time. If the time elapses, the lock is ignored and the operation - executed. The time limit may be specified in + privileged users may override it. The block-weak inhibitor lock type is similar to + block but is not enforced against operations initiated by privileged clients or + those owned by the user that also owns the inhibitor lock. If delay is used, the + lock can only delay the requested operations for a limited time. If the time elapses, the lock is + ignored and the operation executed. The time limit may be specified in logind.conf5. Note that delay is only available for sleep and - shutdown. In addition, the weak variants will automatically and silently be - bypassed under some circumstances. + shutdown.