Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-96510

rpm package upgrade causes failing rpmdb-migrate.service

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • CentOS Stream 10
    • rpm
    • No
    • None
    • rhel-swm
    • 0
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • Hide
      • Sanity-check that the rpmdb relocation scriptlets & systemd service are gone from the spec
      • Verify that a Leapp upgrade from RHEL-9 to RHEL-10 doesn't break due to those bits missing - this is expected to not be the case as the relocation is handled by Leapp explicitly
      Show
      Sanity-check that the rpmdb relocation scriptlets & systemd service are gone from the spec Verify that a Leapp upgrade from RHEL-9 to RHEL-10 doesn't break due to those bits missing - this is expected to not be the case as the relocation is handled by Leapp explicitly
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • All
    • None

      There is a logics error in %posttrans script of rpm-4.19.1.1-17.el10 causing rpmdb-migrate.service to run on next boot (errorously) and rpmdb-migrate.service fails because migrate has already been run.

      This patch demonstrates the issue (with fix).

      Because there is a symlink /var/lib/rpm -> /usr/lib/sysimage/rpm, [ -d /var/lib/rpm ] is successful. And because there is no check for /var/lib/rpm being link, migration is wrongly triggered again.

       

       

      Author: Tuomo Soini <tis@foobar.fi>
      Date:   Thu Jun 12 11:26:41 2025 +0300
          Fix posttrans logics
      diff --git a/rpm.spec b/rpm.spec
      index 40ad12c..17a288c 100644
      --- a/rpm.spec
      +++ b/rpm.spec
      @@ -467,7 +467,8 @@ if [ -x /usr/bin/systemctl ]; then
       fi
       
       %posttrans
      -if [ -d /var/lib/rpm ]; then
      +# If already symlinked, migration is not possible
      +if [ ! -L /var/lib/rpm ] && [ -d /var/lib/rpm ]; then
           touch /var/lib/rpm/.migratedb
       fi
       if [ ! -d /var/lib/rpm ] && [ -d /usr/lib/sysimage/rpm ] && [ ! -f /usr/lib/sysimage/rpm/.rpmdbdirsymlink_created ]; then
      

       

              packaging-team-maint packaging-team-maint
              bleve Tuomo Soini (Inactive)
              packaging-team-maint packaging-team-maint
              Martin Banas Martin Banas
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: