I am currently facing a problem with dnf, when running any dnf command I get this error:
File "/usr/bin/dnf", line 61, in <module>
from dnf.cli import main
File "/usr/lib/python3.10/site-packages/dnf/__init__.py", line 30, in <module>
File "/usr/lib/python3.10/site-packages/dnf/base.py", line 29, in <module>
ModuleNotFoundError: No module named 'libdnf'
I am running Fedora 36 fully upgraded and running the 5.15.27 kernel compiled with a Bluetooth patch. yum is also not working with the same error.
This tells me you are not running the vanilla fedora system. Fedora 36 is currently at the 5.19.11 kernel. It seems likely that some recent update caused a python mismatch that broke dnf. (yum is merely a link to dnf)
It seems quite likely that your kernel with the bluetooth patch is the cause of the error, and that having the proper fedora kernel and packages installed may fix the problem. It also might resolve all the bluetooth issues as well since there are continuous fixes in that area.
The file it should be looking for is probably
/usr/lib64/python3.10/site-packages/libdnf/transaction.py and it seems to be looking at /usr/lib/ instead.
/usr/lib64/python3.10/site-packages/libdnf/transaction.py does not exist in my system
It should be provided by
python3-libdnf which is essential to dnf.
You can find the build at https://koji.fedoraproject.org/koji/buildinfo?buildID=2046779 where you can download the rpms for your architechture. You can install the rpm using the rpm command
rpm -Uvh python3-libdnf-0.68.0-1.fc36.x86_64.rpm