2

I have an rpm with a file marked as config file in the %files section:

%files
%config /path/to/file.conf

now suppose I edit this file on-disk. I wish to repair this and redo a clean install of the package; thus restoring the config file to its original state; using

zypper in -f my-package

after doing this; the config file is still in its edited version. If it was not a reinstall but an update (with an rpm containing a changed version!); then rpm would have moved my edited file to /path/to/file.conf.rpmsave and reinstalled the new one.

What are my options to circumvent this problem? Is this normal behavior? If I was using rpm; I suppose I could use rpm -if my-package.rpm --replacefiles; but that option does not exist for zypper.

PS I use this page for reference.

Chris Maes
  • 35,025
  • 12
  • 111
  • 136

3 Answers3

2

Yes zypper would need to add --replacefiles in order to overwrite %config files. The harder issue (for zypper) is the scope of --replacefiles: the option applies to a transaction, not a single package in the transaction.

Easiest solution by far (imho) is to install the package manually using --replacefiles on the CLI.

Jeff Johnson
  • 2,310
  • 13
  • 23
  • helpful; but not a real solution :) For the moment I am considering just removing the `%config` tag for the config files that I want to be sure to replace with their package version upon install... – Chris Maes Sep 26 '16 at 06:05
0

I normally use rpmconf -a to handle updating config files. However, I ran into a similar issue after accidentally keeping a config file I wanted to replace. The rpmnew file is then deleted and, as you also noticed, zypper in -f will not place it back.

I got around the issue by simply deleting the config file and running the zypper command again.

sigma
  • 2,758
  • 1
  • 14
  • 18
-1

It sounds like you are seeing the difference between %config and %config(noreplace). However, even if it doesn't replace, I think it should export it as file.conf.rpmnew.

You can always use rpm2cpio to extract the original file if you really need it.

Aaron D. Marasco
  • 6,506
  • 3
  • 26
  • 39
  • you didn't read the page I referenced I think: I'm in the case `%config` , changed in update RPM (although I think rpm doesn't notice that due to reinstall), so he should use "File from update, edited file in .rpmsave" – Chris Maes Sep 23 '16 at 05:41
  • and after the `zypper in -f` there is no rpmnew NOR rpmsave file. – Chris Maes Sep 23 '16 at 05:42