rpm-software-management / dnf

Package manager based on libdnf and libsolv. Replaces YUM.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

the dependency packages cannot be uninstalled correctly when yum 3.x is upgraded to dnf 4.x

weli-l opened this issue · comments

commented

When upgrading the package, I encountered the following issues:

In my environment, the previous package was installed using yum 3.xx. However, with the system upgrade, we are now using a newer version of dnf 4.xxx. This has led to the replacement of dependency parsing tools.

During the system upgrade, the rpm -Uvh *.rpm command is used. This will upgrade yum 3.x to dnf 4.x. Before the upgrade, the /var/lib/dnf directory does not exist. After the upgrade, the /var/lib/dnf directory exists but is empty. As a result, when I attempt to uninstall the software package before the upgrade, the dependency packages cannot be uninstalled correctly.

commented

here are the steps to reproduce the issue
1.dnf install -y myapp
2. cd /var/lib/dnf
3. rm -rf *
4.dnf remove myapp
The expected result is that the package and its dependency packages are deleted, but the dependency packages are not deleted.
image
image

That's expected. Without the history database (located in /var/lib/dnf), DNF can't figure out if the "myapp_deps" package is a leftover dependency or if the user installed it explicitly. So, to be safe, it keeps packages with an unknown reason installed.

In the history database, DNF keeps track of the "reason" for each installed package. This reason can be either "user" (meaning the user explicitly installed the package, like running dnf install myapp_deps) or "dependency" (like "myapp_deps" in dnf install myapp). DNF only automatically removes packages with a "dependency" reason that are no longer needed by any installed packages.

commented

That's expected. Without the history database (located in /var/lib/dnf), DNF can't figure out if the "myapp_deps" package is a leftover dependency or if the user installed it explicitly. So, to be safe, it keeps packages with an unknown reason installed.

In the history database, DNF keeps track of the "reason" for each installed package. This reason can be either "user" (meaning the user explicitly installed the package, like running dnf install myapp_deps) or "dependency" (like "myapp_deps" in dnf install myapp). DNF only automatically removes packages with a "dependency" reason that are no longer needed by any installed packages.

thanks for your reply

One more thing - you can change the stored reason for a specific package using dnf mark install <package-spec> to set the reason to "user", or dnf mark remove <package-spec> to set it to "dependency". See man dnf and search for "Mark Command".

commented

One more thing - you can change the stored reason for a specific package using dnf mark install <package-spec> to set the reason to "user", or dnf mark remove <package-spec> to set it to "dependency". See man dnf and search for "Mark Command".

yes, actually that's what i did, thanks