Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2214510

Summary: `dnf offline-upgrade reboot --poweroff` doesn't poweroff after upgrade
Product: Red Hat Enterprise Linux 9 Reporter: Jan Kolarik <jkolarik>
Component: dnf-plugins-coreAssignee: Jan Kolarik <jkolarik>
Status: CLOSED ERRATA QA Contact: swm-qe
Severity: medium Docs Contact:
Priority: unspecified    
Version: 9.3CC: daniel.mach, extras-qa, james.antill, jkolarik, jmracek, jrohel, konradmb, mbanas, mblaha, packaging-team-maint, pkratoch, praiskup, rpm-software-management
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: dnf-plugins-core-4.3.0-9.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: 2211844 Environment:
Last Closed: 2023-11-07 08:54:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2211844    
Bug Blocks:    

Description Jan Kolarik 2023-06-13 07:52:04 UTC
+++ This bug was initially created as a clone of Bug #2211844 +++

Man page for `dnf-offline-upgrade` specifies:
"       --poweroff
              When applied with the reboot subcommand, the system  will  power
              off after upgrades are completed, instead of restarting."

Adding `--poweroff` doesn't change the default behaviour of `dnf offline-upgrade reboot`. The system reboots instead as without the `--poweroff` option.

Reproducible: Always

Steps to Reproduce:
1. `sudo dnf offline-upgrade download`
2. `sudo dnf offline-upgrade reboot --poweroff`

Actual Results:  
1. System reboots to upgrade in offline mode
2. System reboots after upgrade and waits for login

Expected Results:  
1. System reboots to upgrade in offline mode
2. System powers off after upgrade and stays shutdown

$ dnf --version
4.15.1
  Installed: dnf-0:4.15.1-1.fc38.noarch at Sat May 20 18:25:43 2023
  Built    : Fedora Project at Thu May 18 09:11:03 2023

  Installed: rpm-0:4.18.1-3.fc38.x86_64 at Sun May  7 21:48:47 2023
  Built    : Fedora Project at Wed Apr 26 05:35:27 2023

$ dnf info dnf-plugins-core
Installed Packages
Name         : dnf-plugins-core
Version      : 4.4.1
Release      : 1.fc38
Architecture : noarch
Size         : 22 k
Source       : dnf-plugins-core-4.4.1-1.fc38.src.rpm
Repository   : @System
From repo    : updates
Summary      : Core Plugins for DNF
URL          : https://github.com/rpm-software-management/dnf-plugins-core
License      : GPL-2.0-or-later
Description  : Core Plugins for DNF. This package enhances DNF with builddep,
             : config-manager, copr, debug, debuginfo-install, download,
             : needs-restarting, groups-manager, repoclosure, repograph,
             : repomanage, reposync, changelog and repodiff commands.
             : Additionally provides generate_completion_cache passive plugin.

--- Additional comment from Jan Kolarik on 2023-06-06 14:36:34 CEST ---

I've connected the related bug where the fix was verified in the RHEL 9: https://bugzilla.redhat.com/show_bug.cgi?id=2157844.

But anyway, I've tested it in Fedora 38 VM and it really seems not working properly in some cases.

First I tried (several times) using only the CLI mode (systemd target = multi-user.target). After the upgrades were installed, it rebooted the system, although according to logs, the shut down was triggered.
Then I tried installing the GUI environment and setting up the graphical.target. After that, I did the same procedure and the system really shut down in the end.

From the logs it seems, that in the CLI case both poweroff and reboot services were triggered for some reason. I will need to investigate it further...

I am attaching the logs from CLI and GUI attempts also here.

--- Additional comment from Jan Kolarik on 2023-06-06 14:38:32 CEST ---



--- Additional comment from Jan Kolarik on 2023-06-06 14:39:02 CEST ---



--- Additional comment from Jan Kolarik on 2023-06-09 13:43:17 CEST ---

In case of the CLI usage, dnf-system-upgrade.service gets killed before being deactivated successfully which will trigger the dnf-system-upgrade-cleanup.service doing the reboot instead of requested poweroff. The question is still why it is getting killed and why not in the GUI case...

--- Additional comment from Jan Kolarik on 2023-06-09 14:04:06 CEST ---

There was a problem in missing systemd unit dependency.

The following PR was created to fix this issue: https://github.com/rpm-software-management/dnf-plugins-core/pull/496.

Comment 2 Jan Kolarik 2023-06-13 07:54:40 UTC
Cloned from Fedora bug: https://bugzilla.redhat.com/show_bug.cgi?id=2211844.

Comment 13 errata-xmlrpc 2023-11-07 08:54:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (dnf-plugins-core bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6641