This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: System Administration

Dealing with .rpmnew and .rpmsave files

By Bruce Byfield on November 21, 2007 (9:00:00 AM)

Share    Print    Comments   

Nobody ever thinks to mention .rpmnew and .rpmsave extensions to new users of Fedora or Red Hat derivatives. Instead, most users suddenly discover that these files are accumulating on their hard drives, or notice a fleeting message on the screen about them during a version upgrade. Many, I suspect, simply leave them alone, uncertain what to do about them. Yet dealing with them is simply a matter of using a few basic commands, and can be a necessity for ensuring trouble-free upgrades in the future.

Both .rpmnew and .rpmsave files are the result of a cautious upgrade policy in .RPM packages. When an upgrade includes changes to a default configuration file, instead of overwriting the configuration file on your system -- and possibly nuking the changes you have made -- the package will write one of these file types. An .rpmnew file contains the new default configuration file and leaves your original configuration file untouched. By contrast, and .rpmsave file is a copy of your original configuration file, which has been replaced by the new default file.

Which file a package creates is up to the discretion of the package maintainer. However, if the recent upgrade to Fedora 8 is typical, almost all maintainers choose to use rpmnew files, which is the less obtrusive choice. After all, if you have added, for instance, multiple keyboard configurations to /etc/X11/xorg.conf, the last thing you want is for an upgrade to overwrite your modifications and force you to redo them.

However, no matter which file is added to your system, you still need to know to know how to deal with it. Some users simply delete all .rpmnew and .rpmsave files -- a move that is tempting after a major upgrade, when you typically have dozens of files to manage, but which defeats the point of the policy behind the files.

If you do not have the patience to examine all the .rpmnew and .rpmsave files, a more reasonable approach is to examine carefully only those files that are likely affect overall system performance -- which mostly means those files in /etc, the top-level directory that holds most configuration files. Files outside /etc are less crucial, and in most cases should not affect the entire operating system, although you should still proceed cautiously.

Generally, you should examine your system for .rpmnew and .rpmsave files after every upgrade, especially major ones. Your first problem, though, is to find them. Fedora-like systems no longer keep an upgrade log in the /root directory, as they did in earlier versions. Nor is there a record in /var/log, as might be expected.

The easiest way to locate them is by using one of the desktop search tools to scan the entire file system, or opening a command line while logged in as the root user and entering find / -print | egrep "rpmnew$|rpmsave$" to search the system from the root directory down and print the full path to each of the files found.

Armed with this list, you can compare each modified and original file, both of which are in the same directory. You could make your comparison by opening up both the modified and original versions in separate windows of a text editor, but this is one case where the command line is easier.

Instead of trusting your powers of concentration not to miss any changes, use the command diff file1 file2. Lines unique to the first file are displayed with a greater than sign (>) at their start, while lines unique to the second file start with a less than sign (<). You might also consider using the -y option to display the the two files in two columns, or -c to print differences with surrounding lines so you can understand their context better. The man page for the diff command displays other options that you might want to explore.

Armed with this list of differences, you can decide whether the .rpmnew file can be deleted, whether you should overwrite the new configuration file with .rpmsave, or create a new file that includes aspects of both the files you are comparing. If the differences in the upgrade version are all additions, you can automate the process by using the command cat file1 file2 > outputfile, then renaming the output file so that it becomes the new configuration file. Otherwise, you can copy and paste as needed. Needless to say, whatever your decision, you should back up all files before deleting or overwriting them, just in case a reboot proves that you need to reconsider their use.

Of course, how well you can make decisions based on the list of differences depends on your general knowledge of GNU/Linux. Yet even if you are a relatively new user, you can use the list to find out more about the changes.

For example, when I upgraded Fedora 8, I noticed that the .rpmnew version of /etc/modprobe.d/blacklist, the file that specifies which modules the kernel should not load when booting, included a line for bcm43xx. If I did not already know what that was, I could do a Web search and discover that this line is a reference to the firmware-cutter for Broadcom wireless cards, which allows GNU/Linux to use some models of wireless cards for which no native drivers exist. If I were using one of the cards the firmware-cutter is designed for, I would probably want to delete this line from the final blacklist file.

These comparisons can take time, and are likely to be tedious. However, once you have dealt with all the .rpmnew and .rpmsave on your hard drive, you should consider installing yum-merge-conf, a recent plugin for yum, the command behind Pirut and Pup, the graphical package manager and updater for Fedora-like distributions. It lets you handle this process on the fly as you install, and avoid having to deal with these files later. To use the plugin requires that you use yum for your updates.

Whatever solution you adopt, remember that dealing with .rpmnew and .rpmsave files is a basic part of system maintenance on Fedora-like systems. If you ignore these files, your system may not be tuned to get the most out of your upgrades. It may also be less secure than it should be. In the worst case scenario, you may find that your next major upgrade has problems because some packages assume that you are using the latest default configuration. These things may not happen, but the possibility still makes dealing with the changes in .rpmnew and .rpmsave files a precaution worth taking.

Bruce Byfield is a computer journalist who writes regularly for Linux.com.

Share    Print    Comments   

Comments

on Dealing with .rpmnew and .rpmsave files

Note: Comments are owned by the poster. We are not responsible for their content.

Diffing with .rpmnew and .rpmsave files

Posted by: Anonymous [ip: 66.15.176.4] on November 21, 2007 01:31 PM
"...diff file1 file2" -- or use "tkdiff" or "kompare" for side-by-side comparison...

#

Re: Diffing with .rpmnew and .rpmsave files

Posted by: Anonymous [ip: 163.192.21.43] on November 21, 2007 04:49 PM
tkdiff looks ugly (as are most Tk programs unfortunately) and kompare is a KDE program (not that I want to say something bad about KDE). To have side by side comparision, you can use diff -y file1 file2 | less or use vimdiff (part of Vim editor) or (for a GUI interface) gvimdiff

#

Re(1): Diffing with .rpmnew and .rpmsave files

Posted by: Anonymous [ip: 172.21.37.177] on November 22, 2007 02:07 PM
another great diff tool is meld (meld.sf.net), its using pygtk.

#

WOW! Congrats!

Posted by: Anonymous [ip: unknown] on November 21, 2007 01:54 PM

Not even a century have passed and RH finally - *finally* - implemented that.

Congrats to few remaining RH users! Enjoy painless upgrades - everybody else was using for *AGES*.

Seriously, that was most frustrating /feature/ of RH: silently overwriting config file. Like in saying - "of course it doesn't work - we performed software upgrade" - systems were breaking meaning nobody was able to use automatic updates on RH boxes. This felt always like hidden message of RH engineers to users: "we hate you."

#

Re: WOW! Congrats!

Posted by: Anonymous [ip: 83.180.163.138] on November 21, 2007 03:02 PM
Bullshit.

Redhat has done this for ages. If you need an article in linux.com to notice, that's not Redhat engineers's problem. Don't blame them.

#

Re: WOW! Congrats!

Posted by: Anonymous [ip: 163.192.21.43] on November 21, 2007 04:51 PM
This feature have been around for a long time. And having worked with both Debian and Red Hat based systems, I had my share of upgrade troubles with both.

#

Red Hat based systems?

Posted by: Anonymous [ip: unknown] on November 21, 2007 05:18 PM

If you mean SUSE (as well as some other rpm based distros) they actually do that correctly and do NEVER EVER overwrite user-modified configs.

SUSE only once in three years overwritten modified script somewhere deep in /etc/sysconfig - because I didn't found proper place where to put customization - otherwise it all was cool.

As special feature from leader of OSS technologies, RedHat not only overwrites your scripts in /etc - it also overwrites your configs. Always.

#

Re: Red Hat based systems?

Posted by: Anonymous [ip: 202.80.58.210] on November 22, 2007 02:20 PM
This is a complete lie. RPM packaging has always allowed any packager to not override existing configuration files. Red Hat and SUSE does not have any differences in this regard.

#

Dealing with .rpmnew and .rpmsave files

Posted by: Anonymous [ip: 71.197.93.79] on November 21, 2007 05:41 PM
"The easiest way to locate them is ..."



locate rpmnew | less

locate rpmsave | less



Thanks for the diff ideas.

#

Dealing with .rpmnew and .rpmsave files

Posted by: Imtiaz Rahi on November 22, 2007 12:09 PM
Very good article emphasizing the importance to deal with these 2 file types.
With guideline how to deal with them.
Such articles are more and more needed as Linux users are increasing.

#

Dealing with .rpmnew and .rpmsave files

Posted by: Anonymous [ip: 80.176.148.26] on November 23, 2007 12:14 AM
Good article. Only thing is, I think you got the greater than (>) and less than (<) signs the wrong way round. Your sentence should have read: "Lines unique to the first file are displayed with a less than sign (<) at their start, while lines unique to the second file start with a greater than sign (>)." Think of the symbols as arrow, one pointing to the file on the left and the other to the file on the right. Regards, middlekey

#

Re: Dealing with .rpmnew and .rpmsave files

Posted by: Anonymous [ip: 88.212.135.56] on November 23, 2007 10:13 PM
Yeah - I'm glad someone else spotted that - I thought maybe I had got it wrong after all these years!

#

Re(1): Dealing with .rpmnew and .rpmsave files

Posted by: Anonymous [ip: 74.140.120.132] on November 26, 2007 01:31 AM
If you use diff -u, + and - is used instead. It's considerably more readable. I believe it's also the preferred format for patches.

#

Dealing with .rpmnew and .rpmsave files

Posted by: Anonymous [ip: 204.191.234.51] on November 25, 2007 03:42 AM
Thanks for the article. I'd figured out what rpmnew files were, but I wasn't sur eabout rpmsave files. This clears things up nicely.

#

Dealing with .rpmnew and .rpmsave files

Posted by: Anonymous [ip: 122.167.65.219] on November 26, 2007 03:27 PM
Simple sccript to do all the above:

for i in `find / -print | egrep "rpmnew$|rpmsave$"` ; do echo ; echo; echo ===================================================; echo $i; echo ===================================================; echo; diff -y -u $i `echo $i |se d -e 's/\.rpmsave//g' |sed -e 's/\.rpmnew//g'`; done

#

Dealing with .rpmnew and .rpmsave files

Posted by: Anonymous [ip: 90.185.208.170] on November 26, 2007 08:41 PM
Try etc-update http://gentoo-wiki.com/HOWTO_etc-update
Mandriva has this packaged and it works great for these files.

#

Dealing with .rpmnew and .rpmsave files

Posted by: Anonymous [ip: 24.202.71.169] on December 19, 2007 10:23 PM
Interesting stuff... and completely pointless article. Since 95% of linux users have no clue (even after they SEE the differences) if the differences should be accepted or not. I've been looking at these things for years now, and 50% of the time I can't make heads or tails out of it. I'm supposed to make a decision about some config file for an app that I didn't even know existed prior to receiving this patch? This just underlines, once again, the geek nature of linux.

#

Dealing with .rpmnew and .rpmsave files

Posted by: Anonymous [ip: 70.226.81.136] on January 07, 2008 05:26 AM
yeah, why would there be any real documentation located on the system for an average user to look up and go "oh, ok... that's what that file does[/means/is]"

... I love Linux but some things *need* to change. That's a big one.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya