Description of problem: Some packages (such as linux-firmware) are needed only during the installation of other RPMs and do not necessarily need to remain on the installed system after the transaction has concluded. It would be ideal if DNF could automatically remove these packages after the standard transaction has completed to save disk space on installed systems. Version-Release number of selected component (if applicable): dnf-1.1.10-2.fc25 How reproducible: N/A Steps to Reproduce: 1. Using a mock configuration for Fedora, install the kernel-core package Actual results: Mock installs linux-firmware as a "Requires(pre):" dependency of kernel-core. This package consumes approximately 120MiB of disk space and is not needed at runtime. Expected results: Mock installs linux-firmware at the beginning of the transaction, then removes the package after all package scripts have been run. Significantly less storage space is consumed on the resulting system. Additional info: linux-firmware is one example, but there are likely many other packages whose presence on the installed system is unnecessary after the installation transaction is completed.
Definitely nice thing to have! I would not say that it's something what we would do tomorrow, but anyway ;)
I tried one nice experiment with kernel-core, first I removed linux-firmware, then install additional kernel-core and surprisingly linux-firmware was installed again. That means additionally I downloaded and installed 41 MB and this was only experiment with single package. I do believe that for normal distribution this behavior cannot be applied, but for some corner cases, where you will not expect installing of updates.
There is blocker because we cannot distinguish between requires and requires-pre, because libsolv returns only unique values. Igor Gnatenko promised to investigate the issue.
It's an interesting idea, for image generation at least. For general purpose use probably not so much, because at least in Fedora practically every package gets updated once or usually more during the distro lifetime, so you'd end up downloading those usually unchanging install-time dependencies several times only to be removed after install of something else. I don't know libsolv well at all but it does seem to know about the fine-grained dependencies these days. If I had to guess after a quick glance at the code, I'd say it seems to filter out the install-only requires from the rpmdb .solv data. So it might be possible to get the install-only dependencies from the delta between available and installed package dependencies. But don't take my word for that. Another problem is that the repodata's idea of pre-requires is confused and flawed which makes it useless for most purposes. The pre-requires in repodata could only be used for install-ordering, but it's not sufficient for this feature. You need to look at the real rpm-level dependency type bitmap to determine whether something is truly only needed for install but eg not for removal. Of course removal-only dependencies could also be considered, but then for general use you might have to download something just to remove something else, and I dont think the world is ready for that :) Finally, I doubt the Fedora package set is ready for this, it's not an uncommon misunderstanding to assume that "Requires(pre/post): foo" implies "Requires: foo", ie that the dependency is always required. See eg bug 1469136, this is one of those almost annually recurring "bugs".
Please could you prove an rpm command that will remove only install-time dependencies?
Sorry, I dont understand. No such command exists in rpm, nor does it make sense to add one. You'd need to figure it out from the dependency data.
What about to add a new option for "dnf autoremove" command that will remove also install only dependencies?
(In reply to Jaroslav Mracek from comment #7) > What about to add a new option for "dnf autoremove" command that will remove > also install only dependencies? How would it determine which ones to remove?
Stephen Gallagher see https://github.com/openSUSE/libsolv/issues/330. Please could you answer a question from Comment 8?
(In reply to Jaroslav Mracek from comment #9) > Stephen Gallagher see https://github.com/openSUSE/libsolv/issues/330. Please > could you answer a question from Comment 8? What question do you want me to answer? Comment 8 was my own question...
Sorry - Comment 7
Are you suggesting that this would be a mode of `dnf autoremove` or an addition to it? I might want to clean up the `Requires(pre|post)` content but not all of the stuff that `dnf autoremove` currently discards.
Lets put it this way, we cannot remove install only dependency at the end of transaction, because in fact this will be the second rpm transaction for a single command (new unsupported workflow). Therefore another command should handle it. Autoremove is the command that I will use when I want to make my system smaller. But you want to have system extremely smaller, because you create a container. Additionally - this feature has an additional value only for system that will never perform upgrade, or reinstall.
(In reply to Jaroslav Mracek from comment #13) > Lets put it this way, we cannot remove install only dependency at the end of > transaction, because in fact this will be the second rpm transaction for a > single command (new unsupported workflow). Therefore another command should > handle it. Autoremove is the command that I will use when I want to make my > system smaller. But you want to have system extremely smaller, because you > create a container. > > Additionally - this feature has an additional value only for system that > will never perform upgrade, or reinstall. I disagree with this statement. There are many environments for which bandwidth for the upgrade is cheaper than long-term storage. I can see many cases where a datacenter setup (with a local repo mirror) would prefer to avoid having the `linux-firmware` package installed on all of their systems, wasting at least 200MiB of storage space (space usage has gotten much larger since the initial report of this BZ). Far simpler to have it installed only for the duration of the update process and then removed. If it has to be two steps, I think it's fine if it's the `dnf autoremove` command. What I was asking above (probably unclearly) was how you intend it to behave. Assuming a hypothetical `--scriptlet-pkgs` flag (I'm just making up a name), there are two ways it could function: 1) `dnf autoremove` removes all packages that it does in its normal operation, plus all of those that are installed solely to satisfy a Requires(*) 2) `dnf autoremove` removees only those packages that are installed solely to satisfy a Requires(*) I'd prefer option 2, since the first one may also be removing content that I need but happens to be leaf packages.