What is .rpmnew & .rpmsave files in Linux?

In Linux, .rpmnew and .rpmsave files are created by the RPM Package Manager during the installation or upgrade of software packages. These files are part of RPM’s mechanism to handle changes to configuration files, ensuring that user modifications are not accidentally lost or overwritten. Here’s what they mean:


1. .rpmnew Files

  • What it is:
    • A .rpmnew file contains a new version of a configuration file that comes with a software package update.
  • When it’s created:
    • It’s created when the current configuration file has been modified by the user or administrator and the package update includes a new version of the file.
    • The existing file remains unchanged, and the new version is saved as .rpmnew for review.
  • Purpose:
    • Allows the administrator to review and merge changes from the new configuration file, ensuring that new settings or features are not missed.
  • Example:
    • Original file: /etc/app.conf (modified by the user)
    • New version provided by the package: /etc/app.conf.rpmnew

2. .rpmsave Files

  • What it is:
    • A .rpmsave file contains a backup of an existing configuration file that has been replaced by a new version from a package update.
  • When it’s created:
    • It’s created when a package update or reinstallation overwrites a modified configuration file.
    • The user’s modified file is saved as .rpmsave before being replaced with the new version.
  • Purpose:
    • Ensures that any custom configurations are preserved and can be restored or reviewed later.
  • Example:
    • Original file: /etc/app.conf (modified by the user)
    • Replaced by the new version from the package: /etc/app.conf
    • User’s modified file saved as: /etc/app.conf.rpmsave

Why Are These Files Important?

  • They help manage configuration changes during software updates, ensuring user modifications are not lost.
  • Administrators can compare the original, new, and saved files to decide how to update or preserve settings.

How to Handle .rpmnew and .rpmsave Files?

  1. Identify the files:
    • Look for .rpmnew and .rpmsave files in directories like /etc.
    • Example: find /etc -name "*.rpmnew" -o -name "*.rpmsave"
  2. Compare the files:
    • Use tools like diff or vimdiff to compare the active file with the .rpmnew or .rpmsave versions.
    • Example: diff /etc/app.conf /etc/app.conf.rpmnew
  3. Merge or replace:
    • Merge changes from .rpmnew into the active configuration file if needed.
    • Restore settings from .rpmsave if they are still relevant.
  4. Clean up:
    • Once reviewed and merged, delete unnecessary .rpmnew and .rpmsave files to avoid confusion.

Summary of Differences

Aspect.rpmnew.rpmsave
Created WhenUser-modified file exists, and the package installs a new versionModified file is replaced by the package update
PurposeSave the new version for reviewBackup the old modified file for safekeeping
Action NeededReview and merge changesRestore or review if necessary

These files are an essential part of system configuration management in RPM-based distributions.