Ask Your Question

How to fix a broken dnf

asked 2018-12-05 22:16:13 -0600

alfC gravatar image

Probably after an interruped dnf update, now I ended up with a broken dnf. Any command on dnf produces the following:

Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.6/site-packages/dnf/", line 31, in <module>
    import dnf.base
  File "/usr/lib/python3.6/site-packages/dnf/", line 31, in <module>
    from dnf.module.repo_module_dict import RepoModuleDict
  File "/usr/lib/python3.6/site-packages/dnf/module/", line 22, in <module>
    import hawkey
  File "/usr/lib64/python3.6/site-packages/hawkey/", line 24, in <module>
    from . import _hawkey
ImportError: /lib64/ file too short

This can be a problem with dnf, the hawkey module or the zck library.

How can I fix this broken dnf?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2018-12-06 05:02:38 -0600

villykruse gravatar image

You will need a bootable liveCD, as the one you used to originally install your system.

In the liveCD open a shell prompt and run su to become root.

Then you lsblk -f to get the name of you root file system. Mount that file system on /mnt.

Then run the following:

dnf  --installroot=/mnt  reinstall dnf 'python3*' 'lib*'
dnf --installroot=/mnt  upgrade dnf 'python3*' 'lib*'

That should install or upgrade anything that is needed to run dnf.

edit flag offensive delete link more

answered 2018-12-06 01:37:50 -0600

simmon gravatar image

updated 2018-12-06 01:42:14 -0600

how about with a cache refix and reload and dnf clean broken.....status

pkcon refresh force

dnf clean all

also, check python packages...old and new has conflict like a transaction problem.

dnf clean packages

dnf -y install python36

dnf -y install hawkey

Failed loading plugin: spacewalk Last metadata expiration check: 0:32:41 ago on 2018년 12월 06일 (목) 오후 04시 03분 11초.

Package python2-hawkey-0.22.3-1.fc29.x86_64 is already installed.

Package python3-hawkey-0.22.3-1.fc29.x86_64 is already installed.

Fedora29. python can be use like a version python2, python3

written by simmon

edit flag offensive delete link more


Thank you, [sudo] pkcon refresh force gives Failed to contact PackageKit: Error calling StartServiceByName for org.freedesktop.PackageKit: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.freedesktop.PackageKit': timed out (service_start_timeout=25000ms). Any dnf command, for exampl dnf clean all gives the original error Traceback ... file too short.

alfC gravatar imagealfC ( 2018-12-06 02:24:02 -0600 )edit

pkcon refresh force

other program good run to me with Fedora29s KDE System. did you solve that problem?

simmon gravatar imagesimmon ( 2018-12-06 05:58:03 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-12-05 22:16:13 -0600

Seen: 59 times

Last updated: Dec 06