I while ago i needed to remove an loder version of mariadb. It remove every depen. even the ones that other repos needed, thus these repos where ols removed.
Ho can I tell dnf to leave all dependecies and only remove the packaged that I want to remove?
Base principle: If A does depend on B, then A cannot be installed if B is not installed.
I don’t recall any repo that would depend on something, like MariaDB.
Could you give more details about that transaction (fer example from dnf history info transID)?
The original post is too vague; it would be better to see the exact command line output of what it wants to remove. The MariaDB in the official repo should not need any special command to uninstall it.
When you tpy dnf remove mariadb you will see wat is removed. There is no need to remove its dependecies because other rpm need them like open dmarc. Had to reinstall this unwatend removed packages.
I know how installing works first dependcies from bottom to top.
In other words, we are talking about “unused dependencies”.
If I had mariadb installed … found one:
# dnf rm mariadb
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
mariadb x86_64 3:10.5.22-1.el9_2.alma.1 @appstream 18 M
Removing dependent packages:
mariadb-server x86_64 3:10.5.22-1.el9_2.alma.1 @appstream 63 M
Removing unused dependencies:
mariadb-backup x86_64 3:10.5.22-1.el9_2.alma.1 @appstream 24 M
mariadb-common x86_64 3:10.5.22-1.el9_2.alma.1 @appstream 179 k
mariadb-errmsg x86_64 3:10.5.22-1.el9_2.alma.1 @appstream 2.6 M
mariadb-gssapi-server x86_64 3:10.5.22-1.el9_2.alma.1 @appstream 20 k
mariadb-server-utils x86_64 3:10.5.22-1.el9_2.alma.1 @appstream 801 k
mysql-selinux noarch 1.0.10-1.el9 @appstream 50 k
perl-DBD-MariaDB x86_64 1.21-16.el9_0 @appstream 383 k
perl-DBI x86_64 1.643-9.el9 @appstream 1.9 M
perl-File-Copy noarch 2.34-481.el9 @appstream 21 k
perl-Math-BigInt noarch 1:1.9998.18-460.el9 @appstream 709 k
perl-Math-Complex noarch 1.59-481.el9 @appstream 86 k
Transaction Summary
================================================================================
Remove 13 Packages
Nothing much in that. Granted, I could have “source installed” Perl programs that do need those Perl modules.
The man dnf tells that dnf
removes all packages from the system that were originally installed as dependencies of user-installed packages, but which are no longer required by any such package.
There is interesting term: user-installed
The doc continues to tell that dnf rq --userinstalled (or dnf history userinstalled) shows the user-installed packages. I wonder what does not count as “user”?
Perhaps something like dnf group install Base
(The dnf has all kinds of murky “mark” features, particularly about groups.)
Are you sure the issue was really caused by something like “dnf remove <mariadb_package”?
If I look at your logs I see that someone installed a bunch of packages at the same time,
e.g. mariadb, but also extra stuff like rsync and lsof.
Later all that stuff was removed again at the same time.
So maybe someone tried to undo a mariadb installation with a tool like
“dnf history undo <transaction_number>” and accidentially removed too much as the transaction contained more than only mariadb.
Are you sure the issue was really caused by something like “dnf remove <mariadb_package”?
Yes.
I needed to upgrade to 10.6 mariadb. So I had to remove 10.5.22 first and select a newer version.
It removed as I said earlier that things got removed that shouldn’t. So I reinstall sevarall packages like open dmarc and others that where removed so things start working again. What is shown in the log. These packages also use some of the mariadb 10.5.22 dependecies.
If they are not dependencies to MariaDB then they won’t get removed. It’s not possible for a package to remove other packages that it doesn’t depend on.
The dnf history command would roll back changes made. Also dnf autoremove will remove packages it thinks the system no longer needs.
If you want us to verify it, post the entire log file here without editing it or removing evidence of what commands were ran. @james-p gave the command to use with dnf, which you could also have used rpm -e --nodeps although it’s not recommended to use rpm commands outside of yum/dnf (but I guess sometimes you just have to).
The dnf history undo would roll back a transaction, if it can. That is not always possible. Example: transaction did update el9_4 package to el9_5 version. Repo does not have el9_4 package, and therefore the roll back (remove el9_5; install el9_4) is not possible.
If one does use the --noautoremove, then the “unused dependencies” are not removed.
The dnf autoremove seems to be for later “cleaning out” those packages (that noautoremove did leave).
Something like rsync (that was on the earlier post as “unused dependency”) is a command that one can very well need for something without any other package (than that version of MariaDB) requiring it.
The dnf has no way to know that user uses rsync. That is not an “explicit dependency”. Something like dnf group install Base would probably mark rsync as “needed by more than just MariaDB”.
I do install (and remove) packages primarily with Ansible. Therefore, I do have a list in “inventory” of groups/packages that I require. If “dnf rm” of some package predicts removal of packages that I know that I need, then I add them to the inventory.