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 1986657 - dnf exits with success even on failure of scriptlet
Summary: dnf exits with success even on failure of scriptlet
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf
Version: 8.4
Hardware: All
OS: Linux
medium
medium
Target Milestone: beta
: ---
Assignee: Packaging Maintenance Team
QA Contact: swm-qe
Mariya Pershina
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-07-28 02:37 UTC by Ameya Patil
Modified: 2022-08-10 11:37 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
.YUM transactions reported as successful when a scriptlet fails Since RPM version 4.6, post-install scriptlets are allowed to fail without being fatal to the transaction. This behavior propagates up to YUM as well. This results in scriptlets which might occasionally fail while the overall package transaction reports as successful. There is no workaround available at the moment. Note that this is expected behavior that remains consistent between RPM and YUM. Any issues in scriptlets should be addressed at the package level.
Clone Of:
Environment:
Last Closed: 2021-09-14 14:53:17 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ameya Patil 2021-07-28 02:37:25 UTC
Description of problem:

dnf exits with 0 exit code even when there are failure in the scriptlets. This lets the user think think their transaction is successful however the of the packages on the system may not be sucessful if there are important failure in the scriptlets. For example

During "dnf update" because /boot was full and when updating/installing a newer kernel-core-4.18.0-305.3.1.el8_4.x86_64 "dracut" exited with return code 1, but "dnf" didn't exit also with return code 1.
Due to the initramfs file not generated sucessfully the system will not be able to boot sucessfully and enter panic state.

This causes problems where automation is used to update several systems and since dnf exits with 0 exit status , which thinks the dnf execution is successful but some of the scriptlet failure like the initramfs generation can be quite important on the package state of the system and can also cause problems to functioning.


Version-Release number of selected component (if applicable):
# dnf --version
4.4.2
  Installed: dnf-0:4.4.2-11.el8.noarch at Mon 12 Jul 2021 07:14:26 AM GMT
  Built    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at Mon 08 Mar 2021 03:43:15 PM GMT

  Installed: rpm-0:4.14.3-14.el8_4.x86_64 at Tue 13 Jul 2021 07:58:50 PM GMT
  Built    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at Mon 31 May 2021 04:43:19 PM GMT


How reproducible:
100% on scriptlet failure

Steps to Reproduce:
1. We can reproduce this when updating with dnf to a newer kernel and when the rpm transaction test succeeds and kernel packages is being updated, before the initramfs generation begins , by filling the space of /boot with a dummy file which leaves little space from initramfs creation.
2. 
3.

Actual results:
dnf exits with 0 exit status even when there is rpm scriptlet failures

Expected results:
dnf should not return with 0 exit status when there are scriptlet failure signifying there may have been scriptlet failure during transaction.

Additional info:

~~~
------------------------
While scriplet fails **
------------------------

[root@localhost Packages]# dnf reinstall kernel-core-4.18.0-305.el8.x86_64.rpm 
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Dependencies resolved.
======================================================================================================================
 Package                     Architecture           Version                        Repository                    Size
======================================================================================================================
Reinstalling:
 kernel-core                 x86_64                 4.18.0-305.el8                 @commandline                  36 M

Transaction Summary
======================================================================================================================

Total size: 36 M
Installed size: 67 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1 
  Reinstalling     : kernel-core-4.18.0-305.el8.x86_64                                                            1/2 
  Running scriptlet: kernel-core-4.18.0-305.el8.x86_64                                                            1/2 
  Running scriptlet: kernel-core-4.18.0-305.el8.x86_64                                                            2/2 
  Cleanup          : kernel-core-4.18.0-305.el8.x86_64                                                            2/2 
  Running scriptlet: kernel-core-4.18.0-305.el8.x86_64                                                            2/2 
cp: error writing '/boot/initramfs-4.18.0-305.el8.x86_64.img': No space left on device
dracut: dracut: creation of /boot/initramfs-4.18.0-305.el8.x86_64.img failed
warning: %posttrans(kernel-core-4.18.0-305.el8.x86_64) scriptlet failed, exit status 1

Error in POSTTRANS scriptlet in rpm package kernel-core
  Verifying        : kernel-core-4.18.0-305.el8.x86_64                                                            1/2 
  Verifying        : kernel-core-4.18.0-305.el8.x86_64                                                            2/2 
Installed products updated.

Reinstalled:
  kernel-core-4.18.0-305.el8.x86_64                                                                                   

Complete!
[root@localhost Packages]# echo $?
0
[root@localhost Packages]#

-------------------------
While executable fails **
-------------------------

[root@localhost Packages]# dnf reinstall kernel-core-4.18.0-305.el8.x86_64.rpm 
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Dependencies resolved.
======================================================================================================================
 Package                     Architecture           Version                        Repository                    Size
======================================================================================================================
Reinstalling:
 kernel-core                 x86_64                 4.18.0-305.el8                 @commandline                  36 M

Transaction Summary
======================================================================================================================

Total size: 36 M
Installed size: 67 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Error: Transaction test error:
  installing package kernel-core-4.18.0-305.el8.x86_64 needs 36MB on the /boot filesystem

Error Summary
-------------
Disk Requirements:
   At least 36MB more space needed on the /boot filesystem.

[root@localhost Packages]# echo $?
1
[root@localhost Packages]#
~~~


Note You need to log in before you can comment on or make changes to this bug.