Add systemd inhibitor lock plugin#2836
Draft
m-blaha wants to merge 1 commit into
rpm-software-management:mainrpm-software-management/dnf5:mainfrom
m-blaha:systemd-inhibit-plugin-preonlym-blaha/dnf5:systemd-inhibit-plugin-preonlyCopy head branch name to clipboard
Draft
Add systemd inhibitor lock plugin#2836m-blaha wants to merge 1 commit intorpm-software-management:mainrpm-software-management/dnf5:mainfrom m-blaha:systemd-inhibit-plugin-preonlym-blaha/dnf5:systemd-inhibit-plugin-preonlyCopy head branch name to clipboard
m-blaha wants to merge 1 commit into
rpm-software-management:mainrpm-software-management/dnf5:mainfrom
m-blaha:systemd-inhibit-plugin-preonlym-blaha/dnf5:systemd-inhibit-plugin-preonlyCopy head branch name to clipboard
Conversation
Add a libdnf5 plugin that acquires a systemd logind inhibitor lock during package transactions to prevent system shutdown or reboot while the system is in a critical state. The lock covers plugin hooks, RPM transaction execution, system state updates, and history database writes. The plugin only implements pre_transaction() to acquire the lock. The fd is registered with libdnf5::plugin::register_systemd_inhibitor_fd(), a small standalone module that closes it unconditionally when the transaction run finishes, regardless of which plugins are installed or enabled - so the lock is guaranteed to be released even if this plugin is later disabled or uninstalled after acquiring it. The mechanism is keyed by the transaction object's address, so it requires no changes to Transaction's own public interface. The plugin config file is named 00-systemd-inhibit.conf so that it sorts first alphabetically among all plugins, running before other plugins' pre_transaction hooks. Failure to acquire the lock is non-fatal: the transaction proceeds normally with a warning logged. Resolves: rpm-software-management#2408 Signed-off-by: Marek Blaha <mblaha@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a libdnf5 plugin that acquires a systemd logind inhibitor lock during package transactions to prevent system shutdown or reboot while the system is in a critical state. The lock covers plugin hooks, RPM transaction execution, system state updates, and history database writes.
The plugin only implements pre_transaction() to acquire the lock. The fd is registered with libdnf5::plugin::register_systemd_inhibitor_fd(), a small standalone module that closes it unconditionally when the transaction run finishes, regardless of which plugins are installed or enabled - so the lock is guaranteed to be released even if this plugin is later disabled or uninstalled after acquiring it. The mechanism is keyed by the transaction object's address, so it requires no changes to Transaction's own public interface.
The plugin config file is named 00-systemd-inhibit.conf so that it sorts first alphabetically among all plugins, running before other plugins' pre_transaction hooks.
Failure to acquire the lock is non-fatal: the transaction proceeds normally with a warning logged.
Resolves: #2408