RPM won't erase its installed directories if they have been modified after the initial installation

0

1

Here are the steps I took:

  1. Create RPM
  2. Install rpm via "rpm -i" (this creates /opt/foo and unpacks files into it)
  3. Modify some files under /opt/foo/ (rename, append data, etc.)
  4. Uninstall rpm via "rpm -e"

And the observed behavior:

All files under /opt/foo are removed except for the ones that were modified. /opt/foo remains as well.

How can I force delete /opt/foo and all of its content even if it was modified after the initial installation?

Thanks a bunch!

Timtam

Posted 2014-09-17T03:53:40.167

Reputation: 1

Answers

1

rpm uses a database (usually in /var/lib/rpm) where is stores information about installations. If you create (rename, copy) a file into the installation directory, rpm won't remove it since it is not in the database. If you modify a file, rpm will not remove it since it has different information in the database. rpm will not delete a non-empty directory.

If you want to delete the whole directory using rpm, you need to rebuild the database just before the uninstall. See rpm {--initdb|--rebuilddb} [-v] [--dbpath DIRECTORY] [--root DIRECTORY]

http://linux.die.net/man/8/rpm

LDC3

Posted 2014-09-17T03:53:40.167

Reputation: 2 062

Thanks for the reply! Am I doing something wrong? I ran "sudo rpm --rebuilddb" and then "sudo rpm -e <name>", but the files are still present :( – Timtam – 2014-09-17T05:36:37.423

Since you already tried to remove the package previously, there is nothing in the database to rebuild, so the command doesn't do anything. If you use the -v flag, you should see what is actually happening. To remove the files and directory now is best done by deleting from the command line. – LDC3 – 2014-09-18T01:13:26.507