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

asked 2017-11-11 12:58:55 -0500

dreua gravatar image

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.)

edit retag flag offensive close merge delete


I just had the same problem with broken java alternatives again and fixed it again the same way. Still wondering what dnf reinstall doesn't do. This renders dnf reinstall quite useless imo.

dreua gravatar imagedreua ( 2018-01-11 14:35:43 -0500 )edit

This is a known bug. The short term answer seems to be to do a dnf reinstall operation twice in succession. What a mess :(

jgu gravatar imagejgu ( 2018-08-21 10:52:22 -0500 )edit