``` Traceback (most recent call last): File "/usr/bin/yum", line 62, in <module> main.user_main(sys.argv[1:], exit_code=True) File "/usr/lib/python3.9/site-packages/dnf/cli/main.py", line 201, in user_main errcode = main(args) File "/usr/lib/python3.9/site-packages/dnf/cli/main.py", line 66, in main with dnf.cli.cli.BaseCli(conf_class()) as base: File "/usr/lib/python3.9/site-packages/dnf/conf/config.py", line 228, in __init__ config = libdnf.conf.ConfigMain() File "/usr/lib64/python3.9/site-packages/libdnf/conf.py", line 1122, in __init__ _conf.ConfigMain_swiginit(self, _conf.new_ConfigMain()) RuntimeError: addFromFile(): Can't open file Exception ignored in: <function MainConf.__del__ at 0x7ffff47a45e0> Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/dnf/conf/config.py", line 254, in __del__ for file_name in self.tempfiles: File "/usr/lib/python3.9/site-packages/dnf/conf/config.py", line 66, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format(self.__class__, name)) AttributeError: '<class 'dnf.conf.config.MainConf'>' object has no attribute 'tempfiles' ``` </details>
How to solve this issue?
May 10, 5:20pm
The error you're encountering on Red Hat Enterprise Linux (RHEL) 9.5 when running yum install htop is related to a corrupted or misconfigured DNF (Dandified YUM) configuration. This often happens due to:
A missing or corrupted /etc/dnf/dnf.conf file.
Permission issues with DNF configuration files.
A broken DNF cache or temporary files.
How to Fix the Issue
1. Check DNF Configuration File
Run the following command to verify if /etc/dnf/dnf.conf exists and is readable:
bash
ls -l /etc/dnf/dnf.conf
If it's missing or corrupted, restore it from a backup or recreate it:
bash
sudo cp /usr/share/dnf/dnf.conf /etc/dnf/dnf.conf
2. Clear DNF Cache
Corrupted cache files can cause this issue. Clear the cache with:
bash
sudo dnf clean all
3. Reinstall DNF
If the issue persists, reinstall DNF:
bash
sudo dnf reinstall dnf -y
4. Check for Broken Dependencies
Run:
bash
sudo dnf check
If broken dependencies are found, fix them with:
bash
sudo dnf repair
5. Use dnf Instead of yum
Since RHEL 9 uses dnf as the default package manager, try:
bash
sudo dnf install htop
6. Check for SELinux Issues
If SELinux is enforcing, it might block DNF operations. Temporarily set it to permissive mode to test:
bash
sudo setenforce 0
Then retry the installation. If it works, adjust SELinux policies: