Sudo dnf up error

I just installed Rocky 8.5 on a laptop and then did

sudo dnf up

About 500 items were downloaded, and the installation began.

The update got hung up when running an update script for se_linux, and the laptop would beep every 5 seconds or so.
I tried Ctrl-C to exit the update process but that did not work, so I hard-rebooted the computer.
Now when I run a dnf command such as

sudo dnf up

I get:

Traceback (most recent call last):
File “/usr/lib64/python3.6/site-packages/libdnf/”, line 14, in swig_import_helper
return importlib.import_module(mname)
File “/usr/lib64/python3.6/importlib/”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 955, in _find_and_load_unlocked
File “”, line 658, in _load_unlocked
File “”, line 571, in module_from_spec
File “”, line 922, in create_module
File “”, line 219, in _call_with_frames_removed
ImportError: /lib64/ file too short

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/bin/dnf”, line 57, in
from dnf.cli import main
File “/usr/lib/python3.6/site-packages/dnf/”, line 30, in
import dnf.base
File “/usr/lib/python3.6/site-packages/dnf/”, line 29, in
import libdnf.transaction
File “/usr/lib64/python3.6/site-packages/libdnf/”, line 8, in
from . import error
File “/usr/lib64/python3.6/site-packages/libdnf/”, line 17, in
_error = swig_import_helper()
File “/usr/lib64/python3.6/site-packages/libdnf/”, line 16, in swig_import_helper
return importlib.import_module(‘_error’)
File “/usr/lib64/python3.6/importlib/”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named ‘_error’

I tried:

dnf clean all

But that did not help.

Any help is appreciated.

As this was a new install, the best option would be to wipe and start again, but this time with Rocky 8.6 (not 8.5).

Forcing power off can leave it in an unworkable state.

If it happens again, make a note of the exact “se linux” script that’s failing.

If you can use rescue mode, try to get the dnf logs from the laptop.


Thanks for your help.
I did install with 8.6 and the update went fine this time.
From now on I will always use the latest ISO :slight_smile: