How to fix yum. I can run 'yum install ' or 'yum upgrade 'after lastest system upgrade

I’m a beginner at Fedora.My system is fedora39.Yesterday, i run ‘yum update’ .After I rebooted system.But I can run ‘yum update’ or ‘yum install xxx’ command anymore. Errors happen, and message like:

How can I fix it?
My system information is :

Yum is not used anymore, use dnf.

Do a dnf -h and see if sudo dnf autoremove or others may help fix some things.

And it looks like you have some python errors, no idea here apart from removing python and using venvs with pipx instead.

Please share the output of rpm -qa | grep dnf

output is:


1 Like

It seems like that dnf also goes wrong:

It seems that some python script goes wrong. But I dont know why. I didn’t change python config.My python is 3.12.1:

That’s more-or-less what I expected. It seems your last update was interrupted somehow and the old packages weren’t removed. Worse still, based on the error you’re seeing, it appears that at least one of the new packages wasn’t even unpacked.

Please confirm that there are also duplicate versions of python3-hawkey (rpm -qa | grep hawkey). If so, you can try:

sudo rpm -e libdnf-0.72.0-1.fc39.x86_64 python3-libdnf-0.72.0-1.fc39.x86_64 python3-hawkey-0.72.0-1.fc39.x86_64

I’m not sure if rpm will let you do that. If not, you can add --nodeps. This will may break dnf completely, but it’s already broken …

If dnf fails after that (with a different error), you’ll need to reinstall the new packages so that they’re properly installed. You can download the packages from koji. Match the filenames exactly to below, and then:

sudo rpm --reinstall libdnf-0.73.0-1.fc39.x86_64.rpm python3-libdnf-0.73.0-1.fc39.x86_64.rpm python3-hawkey-0.73.0-1.fc39.x86_64.rpm

If dnf works after that, you can run sudo dnf remove --duplicates to clean up any remaining duplicate packages.

P.S. Text is better than a screenshot of text; I can’t copy and paste from a screenshot.

1 Like

Thank you very much for your help. It works. Dnf and yum can run currently after i do steps you told.
And I’ll use text next time , instread of using screenshot

I’m glad to hear that it worked. For posterity, can you tell me which steps were necessary? Did you need --nodeps? Did you have to reinstall the 0.73 packages?

–nodeps is not necessary.
Reinstallation of the 0.73 packages is necessary.

I run 'sudo rpm -e libdnf-0.72.0-1.fc39.x86_64 python3-libdnf-0.72.0-1.fc39.x86_64 python3-hawkey-0.72.0-1.fc39.x86_64 ’ directly and it executed currently. But After this step, the problem still existed.
Then I downloaded the packages and reinstalled them.After this step, the problem was fixed.

Okay so now they have a fully working system? I would do a sudo dnf autoremove and maybe some more to make sure your system is clean. Does --best help?

sudo dnf distro-sync

1 Like

Yes, now it works fine.
'sudo dnf autoremove ’ removes some packages from my system. But I’m not sure about what effect --best make during dnf runs. I’ll try it again later.

It seems this command will remove some software I need to use in my system.So I did not execute this command finally.

Thank you all for your advice and help

you should totally sync your current system with what fedora provides. This is a huge advantage of atomic variants. How to prevent removing wanted packages? No idea

autoremove should not be critical, it should remove packages that where not manually installed but are unneeded dependencies, AFAIK

no guarantee though

Autoremove seems removed some packages that used by some softwares which i installed with local rpm file(using rpm -ivh command). I cannot use some of those softwares(such as sunloginclient) after i executed autoremove. But this can be fixed by reinstalling the softwres.
I don’t know much about how to sync my current system with what fedora provides. I run ‘yum update’ or ‘dnf update’ everytime when i login my system. That’s not enough I guess. But I really don’t want to run ‘sudo dnf distro-sync’ because it will remove some softwares I need to use(like beyond compare).

Autoremove removes packages that according to dnf is not needed. Your local rpms could declare the other packages that it needs to be required, and thus won’t be auto-removed.

1 Like

Apple and Fedora both use Python for “system level” tools. As you found when dnf
broke, it is dangerous to add Python packages to your system.

I use Python venv’s for packages that aren’t provided by Fedora. For me, there are packages that aren’t yet ported to current Python, so I often use a venv with an older Python. Fedora does package older versions of Python.

Another option many colleagues use is Anaconda Python.

Great opportunity for podman or toolbox especially if your project already has a Dockerfile or an OCI Image.

If you have dnf5 installed, it could save the day when dnf itself has been broken in some python code. dnf5 is python-free.

1 Like

That command should not remove any needed system packages. It may try to remove add-on packages from a different 3rd party repo that are not tied to the distribution itself.

You may always use the --exclude or the --noautoremove option to tell it to ignore those suggested packages if necessary.

1 Like