Understanding and Handling .rpmnew/.rpmsave Files After RPM Package Updates in Fedora/RHEL Systems


1 views

When updating packages via yum or dnf, you might encounter files with .rpmnew and .rpmsave extensions appearing in your system directories. This occurs due to RPM's configuration file management mechanism, even when you haven't explicitly modified the original files.

RPM uses a sophisticated algorithm to determine whether to preserve existing configuration files during updates:

# RPM's config file decision tree:
if (new_config_file_exists_in_package) {
    if (original_file_was_modified) {
        if (noreplace_attr_set) {
            create .rpmnew
        } else {
            overwrite original, create .rpmsave
        }
    } else {
        overwrite original
    }
}

Several scenarios can trigger this behavior:

  • The package maintainer marked the file as config even though you didn't modify it
  • File permissions or ownership changes were detected
  • The package's %config(noreplace) directive is being overly cautious
  • System utilities or daemons might have modified the files during normal operation

For your specific TeX example, here's how to proceed:

# Compare the files
diff -u /usr/share/texmf-var/fonts/map/dvipdfm/updmap/dvipdfm_dl14.map \
         /usr/share/texmf-var/fonts/map/dvipdfm/updmap/dvipdfm_dl14.map.rpmnew

# If you want to keep the new version:
sudo mv /usr/share/texmf-var/fonts/map/dvipdfm/updmap/dvipdfm_dl14.map.rpmnew \
         /usr/share/texmf-var/fonts/map/dvipdfm/updmap/dvipdfm_dl14.map

For managing multiple files across your system:

#!/bin/bash
# Find and process .rpmnew and .rpmsave files
find / -name "*.rpmnew" -o -name "*.rpmsave" | while read -r file; do
    original="${file%.rpm*}"
    echo "Found: $file"
    echo "Original: $original"
    diff -u "$original" "$file" || true
    echo "--------------------------------"
done

To minimize these files appearing in future updates:

  • Review package changelogs with rpm -q --changelog <package>
  • Use rpm -V to detect modified files before updates
  • Consider using configuration management tools like Ansible

These files won't affect subsequent updates directly, but they indicate areas where:

  • Package defaults have changed
  • Configuration drift might occur
  • Manual intervention might be needed for optimal operation

When you update packages using yum or dnf on Fedora (or other RPM-based systems), you might encounter files with .rpmnew or .rpmsave extensions. These files are created by the RPM package manager during updates to handle configuration file conflicts.

Contrary to common belief, these files can appear even if you didn't modify the original configuration files. This happens when:

  • The package maintainer marks certain files as "configuration files" in the RPM spec
  • The package's new version includes significant changes to default configurations
  • The system detects potential conflicts between old and new versions

RPM uses a specific algorithm for configuration files during updates:

if (original_file_modified) {
    save_as(.rpmsave);
    install_new_version_as(.rpmnew);
} else if (new_config_differs_from_installed) {
    install_new_version_as(.rpmnew);
}

In your case with the TeX Live files:

/usr/share/texmf-var/fonts/map/dvipdfm/updmap/dvipdfm_dl14.map.rpmnew
/usr/share/texmf-var/fonts/map/dvipdfm/updmap/dvipdfm_dl14.map.rpmsave

This suggests the package maintainer updated the font mapping configuration, and RPM preserved both versions.

Here's a script to help identify and process these files:

#!/bin/bash
# Find all .rpmnew and .rpmsave files
find / -name "*.rpmnew" -o -name "*.rpmsave" | while read -r file; do
    original_file="${file%.rpm*}"
    echo "Found: $file"
    echo "Original: $original_file"
    
    if [ -f "$original_file" ]; then
        echo "Diff between original and new:"
        diff -u "$original_file" "$file" | head -n 10
    fi
    
    echo "-----"
done
  • Review changes: Always check differences before merging
  • Use automated tools: rpmconf or etc-update can help manage these files
  • Document changes: Keep track of configuration modifications

Future updates will:

  1. Preserve your current working configuration
  2. Create new .rpmnew files if the package provides updated defaults
  3. Not overwrite your customizations