2

I'm looking for the equivalent of running apt install with a package that came pre-installed on the system or was automatically installed as a dependency of another package. apt then simply marks that package as manually installed, which means it won't be automatically uninstalled along with the package that depends on it or during autoremove.

So far, I was unable to find any answer to this online. Running dnf install with an auto-downloaded dependency simply prints "Nothing to do." but doesn't change the status of the package to manually installed. The dnf man page didn't mention any special flags under the install command either.

The only "solution" so far was to uninstall the package (along with all packages that depend on it), manually reinstall it and then reinstall the dependent packages. That's not practical. Compared to that, even manually editing some file databases would be easier.

2 Answers 2

7

dnf mark install <package> marks the package as manually installed in Fedora (and similarly dnf mark remove <package> does the opposite -- remove the mark if you no longer wish to manually keep the package).

From dnf man page:

Marks the specified packages as installed by user. This can be useful if any package was installed as a dependency and is desired to stay on the system when Autoremove Command or Remove Command ... is executed

2

With dnf 5, dnf mark can be followed with one of the following subcommands:

 user Mark package as user-installed dependency Mark package as a dependency weak Mark package as a weak dependency group Mark package as installed by a group 

For example, dnf mark user <package> marks the package as user-installed, dnf mark dependency <package> marks the package as a dependency.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.