Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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#2836
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

@m-blaha

@m-blaha m-blaha commented Jul 24, 2026

Copy link
Copy Markdown
Member

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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] set systemd inhibitor during transactions

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.