0

I keep getting the following error whenever I do a dnf update -y or try to install a package. I'm using CentOS 8 as a virtual machine. Can you tell me why this is happening?

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/libdnf/common_types.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: libyaml-0.so.2: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

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/__init__.py", line 30, in <module>
    import dnf.base
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 29, in <module>
    import libdnf.transaction
  File "/usr/lib64/python3.6/site-packages/libdnf/__init__.py", line 3, in <module>
    from . import common_types
  File "/usr/lib64/python3.6/site-packages/libdnf/common_types.py", line 17, in <module>
    _common_types = swig_import_helper()
  File "/usr/lib64/python3.6/site-packages/libdnf/common_types.py", line 16, in swig_import_helper
    return importlib.import_module('_common_types')
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_common_types'
  • Restore the deleted file from backup. – Michael Hampton Sep 21 at 6:20
  • there are no deleted files, this is a fresh CentOS install. not sure what you're looking at here. – ninsonTan Sep 21 at 6:25
  • Someone deleted this file. ImportError: libyaml-0.so.2: cannot open shared object file: No such file or directory – Michael Hampton Sep 21 at 12:59
  • downloaded the file and installed it manually and it works. curl -o /tmp/libyaml-0.1.7-5.el8.x86_64.rpm 'http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/libyaml-0.1.7-5.el8.x86_64.rpm' sudo rpm -i libyaml-0.1.7-5.el8.x86_64.rpm – ninsonTan Sep 21 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.