0

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!

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

  • 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 Sep 17 '14 at 5:36
  • 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 Sep 18 '14 at 1:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.