From Fedora Project Wiki

Relocate RPM database to /usr


Currently, the RPM databases is located in /var. Let's move it to /usr. The move is already under way in rpm-ostree-based installations, and in (open)SUSE.


Current status

Detailed Description

Current location


New location


/var/lib/rpm will be a symlink pointing to /usr/lib/sysimage/rpm

  • The RPM database primarily describes the state of /usr. Storing the databases in /usr will more easily facilitate OS snapshots and rollback, without affecting /var.
  • The need for moving rpmdb to /usr was brought up in a 2017 thread on the upstream rpm-maint@ list. Various locations for rpmdb (and similar databases) is discussed in the thread, with the end result being /usr/lib/sysimage/rpm.
  • There's upstream RPM, rpm-ostree, and (open)SUSE agreement for this location.

Note: Changing the file system layout to accommodate a snapshot+rollback regime is implied, but not required by this proposal. For example, Fedora has long placed /home on a separate subvolume (or file system) so it can be isolated from system root. Likewise, it makes sense to isolate /var/log and possibly /var/lib/libvirt/images so these locations continue to carry forward in time, even if the system root does a rollback.


There will be no change to DNF as part of this change proposal. DNF's history will remain in /var until DNF 5. Discussion continues about the effect of a snapshot+rollback regime on DNF history. Relocate DNF history to /usr.

Upstream RPM accepts the change, but institutionally don't like the loss or weakening of a very well known location for the database, and anticipate complaints.

Benefit to Fedora

  • Helps align Fedora variants with each other
    • rpm-ostree based systems (including CoreOS, IoT, Silverblue, Kinoite) already use /usr/lib/sysimage for rpmdb.
  • Consistency with another RPM-based distro, (open)SUSE have made this change.
  • Accounts for various snapshot+rollback regimes, i.e. it's a beneficial change whether Btrfs or device-mapper based.
  • Is a preparatory step to support boot-to-snapshot and transactional update methods for dealing with problematic updates and upgrades.


  • Proposal owners:
    • changes in rpm package
      • create the new path
      • create a symlink for the old path pointing to new path
  • Other developers:
    • changes in SElinux policy
    • tracking bug for supermin: test if a package has been installed/updated/removed so that we can rebuild our cache
    • tracking bug for libguestfs: build a "phony" Fedora image for testing with a fake RPM database
    • possible bug in DNF when doing dnf list which writes to one or more rpmdb files (these might be file metadata changes not file data changes)

  • Release engineering: #Releng issue 10441
  • Policies and guidelines: N/A (not needed for this Change)
  • Trademark approval: N/A (not needed for this Change)
  • Alignment with Objectives:

Upgrade/compatibility impact

Change will be applied to offline upgrades, similar to the RPM sqlite database change. A systemd service will move the rpmdb from /var to /usr, then create a symlink pointing to /usr from /var.

  1. Create /usr/lib/sysimage/rpm (rpm package will do this at preinst)
  2. Create symlinks in /usr/lib/sysimage/rpm/ pointing to files in /var/lib/rpm/ (rpm package will do this at preinst)
  3. Change the dbpath in /usr/lib/rpm/macros to /usr/lib/sysimage/rpm (rpm package will be patched to do this on F36+)
  4. Request rpm rebuild the database (done via systemd service)
  5. Remove /var/lib/rpm and create a symlink /var/lib/rpm -> /usr/lib/sysimage/rpm (done via systemd service)

How To Test

  1. Perform a new clean install, or upgrade a system
  2. Check that /var/lib/rpm is a symlink to /usr/lib/sysimage/rpm
  3. Check that /usr/lib/sysimage/rpm is populated with at least rpmdb.sqlite, possibly also rpmdb.sqlite-shm and rpmdb.sqlite-wal
  4. Confirm rpm -q <package> and/or rpm -qa still work

User Experience

  • symlink /var/lib/rpm -> /usr/lib/sysimage/rpm

Otherwise, the change should be invisible to users.


  • rpm-ostree probably should make /usr/share/rpm a symlink to /usr/lib/sysimage/rpm, rather than the reverse as it is currently.
  • PackageKit might use inotify on /var/lib/rpm need to check if it does and whether it should be changed or add the additional path

Contingency Plan

  • Contingency mechanism: Revert the change, try again the next Fedora release.
  • Contingency deadline: Beta freeze
  • Blocks release? Yes


Release Notes