Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What exactly happens on `dnf reinstall`(in terms of scriptlets)?

If I have a problem with a specific package I usually dnf reinstall it and in some cases this just fixes it. I always assumed that this is equivalent to removing and afterwards installing the package but this assumption seems to be wrong as rpm -e --nodeps <package> followed by dnf install <package> had a different result and fixed my problem.

I couldn't find any information on dnf reinstall on the internet so it would be just nice to have this answer here for me and others to find. The information could also be added to the documentation of dnf and maybe the Wiki page on Scriptlets.

Story leading to that question (may be safely skipped)

My specific, now solved, problem was, that the java and related commands stopped working after I removed Oracle JDK. So my usual approach was sudo dnf reinstall java-1.8.0-openjdk-* but to no avail. I figured out that the problem was a messed up alternatives configuration leading to missing symlinks. I found said configuration being set up in the pretrans scriptlet of the java packages and searched for a way to properly re-execute this scriptlet as dnf reinstall didn't do the trick.

Removing and afterwards installing said package (Java) with DNF was not possible due to the many dependent packages which would have been removed with it so I came up with the solution described above which worked for me. Now I want to find out why dnf reinstall didn't work (it might even be a packaging bug in Java?) and what to do if I will have a similar problem and the first step is to better understand dnf's reinstall command.

(I know this question contains some sub-questions like if my approach was correct in the first place etc. While I would appreciate hints and answers to those question this might lead to confusion and be a violation of this site's guidelines so I'd encourage you to just concentrate on the main question in the title.)