Problem with yum/dnf after installing "Development Tools"

Issues related to applications and software problems and general support
Post Reply
iSente
Posts: 3
Joined: 2020/01/21 22:15:52

Problem with yum/dnf after installing "Development Tools"

Post by iSente » 2020/01/21 22:28:46

Hi all,

So here's the thing: I have a perfectly running CentOS 8 installation on my computer.
I have been able to install hundreds of packages, both from the terminal and through the software manager GUI.

I just installed "Development Tools" using the command dnf groupinstall "Development Tools" (>100 packages were installed).
Right after executing that command I tried installing something else, but now it seems that I can't install anything, as I'm getting the error:
"Failed to synchronize cache for repo 'AppStream'"
I can't update neither (sudo dnf/yum update gives the same error)

I tried looking for a solution, but nothing I found on the forum fixes the problem:
I tried commenting mirrorlist and uncomment baseurl in the repo files, but still the same.
I tried clearing the cache (dnf -v clean all, rm -r /var/cache/dnf...), but same.
I tried to temporarily remove the AppStream repo, but all of them give me the same error (it just happens that AppStream is the first, and then yum stops there).
The network is working fine on the terminal, as I can ping and I receive the response.

I don't know whether installing "Development Tools" did something, or it is only a coincidence, but I'm running out of ideas.
Any suggestion?

Many thanks!

sml
Posts: 305
Joined: 2020/01/17 09:01:44

Re: Problem with yum/dnf after installing "Development Tools"

Post by sml » 2020/01/23 16:05:55

My suggestion would be to try running dnf in verbose mode:

Code: Select all

dnf -v --refresh upgrade
It won't fix the breakage, but additional info in the output may give you hints about what actually went wrong.

iSente
Posts: 3
Joined: 2020/01/21 22:15:52

Re: Problem with yum/dnf after installing "Development Tools"

Post by iSente » 2020/01/23 21:14:11

Hi,
Thanks for your reply!

Here's the output:

Code: Select all

Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
DNF version: 4.0.9
cachedir: /var/cache/dnf
Unknown configuration option: autorefresh = 1 in /etc/yum.repos.d/elasticsearch.repo
Unknown configuration option: protect = 0 in /etc/yum.repos.d/nux-dextop.repo
Unknown configuration option: protect = 0 in /etc/yum.repos.d/nux-dextop.repo
repo: downloading from remote: AppStream
CentOS-8.0 - AppStream                                                                                                                                             33  B/s |  38  B     00:01    
Cannot download 'http://mirrorlist.centos.org/?release=8.0&arch=x86_64&repo=AppStream&infra=stock': Cannot prepare internal mirrorlist: No URLs in mirrorlist.
Error: Failed to synchronize cache for repo 'AppStream'
I can't curl that URL neither (nor access it through the browser, but I don't know if I'm supposed to be able -- longtime user of Arch, but new to CentOS)
Invalid release/repo/arch combination


Same with baseurl instead of mirrorlist

Code: Select all

Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
DNF version: 4.0.9
cachedir: /var/cache/dnf
Unknown configuration option: autorefresh = 1 in /etc/yum.repos.d/elasticsearch.repo
Unknown configuration option: protect = 0 in /etc/yum.repos.d/nux-dextop.repo
Unknown configuration option: protect = 0 in /etc/yum.repos.d/nux-dextop.repo
repo: downloading from remote: AppStream
CentOS-8.0 - AppStream                                                                                                                                            6.6 kB/s | 7.6 kB     00:01    
Cannot download 'http://mirror.centos.org/centos/8.0/AppStream/x86_64/os/': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried.
Error: Failed to synchronize cache for repo 'AppStream'

iSente
Posts: 3
Joined: 2020/01/21 22:15:52

Re: Problem with yum/dnf after installing "Development Tools"

Post by iSente » 2020/01/23 22:32:01

Well, I kind of found a workaround.

The problem comes from the variable 'releasever' in the repo files, as it resolves in 8.0 (for centOS 8)
As a result, yum tries to update from http://mirrorlist.centos.org/?release=8 ... a=stock%27
but this url doesn't exist
However, http://mirrorlist.centos.org/?release=8 ... a=stock%27 does exist (note the 8 instead of 8.0)

So, after looking where is the releasever variable specified, i could solve it by adding a new file:

Code: Select all

sudo bash -c "echo 8 > /etc/yum/vars/releasever"
And now everything works :|

nlfiedler
Posts: 1
Joined: 2020/02/02 18:09:20

Re: Problem with yum/dnf after installing "Development Tools"

Post by nlfiedler » 2020/02/02 18:13:45

Fascinating. Any clues why installing the development tools changes the releasever? I could't find any files under /etc that had "releasever" or "8.0" (that weren't certs or binary files) so I'm curious how the dev tools could have changed the value for the releasever (I am not all that savvy with CentOS so that doesn't help much).

But anyway, thanks for finding how to address this.

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Problem with yum/dnf after installing "Development Tools"

Post by TrevorH » 2020/02/02 18:22:34

I don't believe that installing "Development tools" has anything to do with this. This is a known problem in the original 8.0 version of yum/dnf/rpm and the correct solution currently is to run yum --releasever=8 update yum\* dnf\* rpm\* first and then it just works correctly afterwards.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
javajox
Posts: 25
Joined: 2019/10/11 10:08:05
Location: Internet
Contact:

Re: Problem with yum/dnf after installing "Development Tools"

Post by javajox » 2020/02/08 13:01:51

TrevorH,

I'm executing yum --releasever=8 update yum\* dnf\* rpm\*, and got the following :

Code: Select all

Traceback (most recent call last):
  File "/usr/bin/yum", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 193, in user_main
    errcode = main(args)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 99, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 115, in cli_run
    cli.run()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 1124, in run
    self._process_demands()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 828, in _process_demands
    load_available_repos=self.demands.available_repos)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 400, in fill_sack
    self._add_repo_to_sack(r)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 137, in _add_repo_to_sack
    repo._repo.initHyRepo(hrepo)
  File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 359, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Repo, name)
  File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 80, in _swig_getattr
    raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
AttributeError: 'Repo' object has no attribute 'initHyRepo'


sml
Posts: 305
Joined: 2020/01/17 09:01:44

Re: Problem with yum/dnf after installing "Development Tools"

Post by sml » 2020/02/08 19:21:13

javajox wrote:
2020/02/08 13:01:51
yum --releasever=8 update yum\* dnf\* rpm\*
Try globbing dnf and rpm on both sides plus updating python3-hawkey:

Code: Select all

yum --releasever=8 update yum\* \*dnf\* \*rpm\* python3-hawkey
While there's only yum-utils besides yum, there're python3-dnf, python3-rpm and so on that need to be updated at once.

gabolander
Posts: 1
Joined: 2020/04/08 13:12:19

Re: Problem with yum/dnf after installing "Development Tools"

Post by gabolander » 2020/04/08 13:41:45

Python3 calls and consequently dnf/yum scripts have changed after dec 2019, so if you are trying to update now a CentOS8 system with last update done before that date, you could get issues (like yours, for instance) ...

Try to do this way:
  • Become root (with root access, or by 'sudo -i'), so you can avoid to prefix 'sudo' on any command.
  • create a temp dir and cd into:

    Code: Select all

    mkdir ~/tmp && cd ~/tmp
  • manually download from repos all involved packages need for dependencies in the same dnf+yum+python3 process:

    Code: Select all

    wget http://centos.mirror.garr.it/centos/8.1.1911/BaseOS/x86_64/os/Packages/dnf-4.2.7-7.el8_1.noarch.rpm
    wget http://centos.mirror.garr.it/centos/8.1.1911/BaseOS/x86_64/os/Packages/dnf-plugins-core-4.0.8-3.el8.noarch.rpm
    wget http://centos.mirror.garr.it/centos/8.1.1911/BaseOS/x86_64/os/Packages/python3-dnf-4.2.7-7.el8_1.noarch.rpm
    wget http://centos.mirror.garr.it/centos/8.1.1911/BaseOS/x86_64/os/Packages/python3-dnf-plugins-core-4.0.8-3.el8.noarch.rpm
    wget http://centos.mirror.garr.it/centos/8.1.1911/BaseOS/x86_64/os/Packages/yum-4.2.7-7.el8_1.noarch.rpm
    
  • upgrade all downloaded packages via rpm command:

    Code: Select all

    rpm -Uvh *
  • now clean all dnf cache:

    Code: Select all

    dnf clean all
  • now you can upgrade, with --skip-broken to skip broken dependencies:

    Code: Select all

    dnf update --skip-broken
    If last command still gets you some dependencies error, try to use --nobest parameter:

    Code: Select all

    dnf update --nobest
  • wait for system upgrade.
  • ...
  • Reboot.
  • Try to repeat a new upgrade
Here it worked with this method.

Regards,
Gabo
javajox wrote:
2020/02/08 13:01:51
TrevorH,

I'm executing yum --releasever=8 update yum\* dnf\* rpm\*, and got the following :

Code: Select all

Traceback (most recent call last):
  File "/usr/bin/yum", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 193, in user_main
    errcode = main(args)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 99, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 115, in cli_run
    cli.run()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 1124, in run
    self._process_demands()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 828, in _process_demands
    load_available_repos=self.demands.available_repos)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 400, in fill_sack
    self._add_repo_to_sack(r)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 137, in _add_repo_to_sack
    repo._repo.initHyRepo(hrepo)
  File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 359, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Repo, name)
  File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 80, in _swig_getattr
    raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
AttributeError: 'Repo' object has no attribute 'initHyRepo'


Post Reply