Bug 2119385

Summary: Failing %prein scriptlet during IPU 8 -> 9 breaking the in-place upgrade process
Product: Red Hat Enterprise Linux 9 Reporter: Petr Stodulka <pstodulk>
Component: dovecotAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED ERRATA QA Contact: Evgeny Fedin <efedin>
Severity: high Docs Contact:
Priority: unspecified    
Version: 9.0CC: efedin, jcastran, mhlavink, mkluson, ovasik
Target Milestone: rcKeywords: Triaged, Upgrades
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dovecot-2.3.16-8.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:37:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Stodulka 2022-08-18 13:47:57 UTC
Description of problem:

From the DNF transaction during the in-place upgrade 8 -> 9:
~~~
Error in PREIN scriptlet in rpm package dovecot
...
...
Dec 03 06:02:22 localhost upgrade[1188]:   Running scriptlet: dovecot-1:2.3.16-3.el9.x86_64                     436/1182
Dec 03 06:02:22 localhost upgrade[1188]: error: %prein(dovecot-1:2.3.16-3.el9.x86_64) scriptlet failed, exit status 1
Dec 03 06:02:22 localhost upgrade[1188]:   Upgrading        : gnupg2-smime-2.3.3-1.el9.x86_64                   437/1182
Dec 03 06:02:22 localhost upgrade[1188]: error: dovecot-1:2.3.16-3.el9.x86_64: install failed
...
...
2021-12-03 06:06:08.280 DEBUG    PID: 588 leapp.workflow.RPMUpgrade.dnf_upgrade_transaction: Failed: dovecot-1:2.3.8-9.el8.x86_64
2021-12-03 06:06:08.282 DEBUG    PID: 588 leapp.workflow.RPMUpgrade.dnf_upgrade_transaction: Failed: dovecot-1:2.3.16-3.el9.x86_64
...
...
Dec 03 06:06:30 localhost upgrade[602]: error: dovecot-1:2.3.8-9.el8.x86_64: erase skipped 
~~~

From the scriptlet:

~~~
# do not let dovecot run during upgrade rhbz#134325                                                                                                                                                                                           
if [ "$1" = "2" ]; then                                                                                                                                                                                                                       
  rm -f /var/run/dovecot/dovecot-restart-after-rpm-install                                                                                                                                                                                    
  /bin/systemctl is-active dovecot.service >/dev/null 2>&1 && touch /var/run/dovecot/dovecot-restart-after-rpm-install ||:                                                                                                                    
  /bin/systemctl stop dovecot.service >/dev/null 2>&1                                                                                                                                                                                         
fi         
~~~

The scriptlet crashes due to call of systemctl commands that requries running systemd; but the scriptlet (the DNF upgrade transaction) is executed inside the container where systemd is not running. Also, regarding the design of in-place upgrades, we know that dovecot will not be running for sure during that time
so the stopping of the service is not needed, nor restarting.  


Steps to Reproduce:
1. install and setup dovecot
2. dnf install leapp-upgrade
3. upgrade the system - see the error during the DNF transaction after the reboot


Actual results:
system ends in emergency console due to the failed scriptlet

Expected results:
Dovecot is successfuly upgraded without breaking the DNF transaction by failing scriptlet.

Additional info:
To check that IPU 8 -> 9 is happening, test envar LEAPP_IPU_IN_PROGRESS:
    LEAPP_IPU_IN_PROGRESS == 8to9

Comment 11 Petr Stodulka 2023-01-31 14:56:40 UTC
*** Bug 2165923 has been marked as a duplicate of this bug. ***

Comment 15 errata-xmlrpc 2023-05-09 07:37:37 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 (dovecot 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:2242