(Fedora 27) DNF throwing python error, cannot upgrade

,

I’m preparing to upgrade from FC27 to 30 (I know I’m a bit behind, been kinda lazy but never mind that!) and I am just checking my packages using dnf and I’m getting python errors! I am unable to successfully run any command in dnf, making upgrading my machine (and managing packages at all!) practically impossible. I’d like some help!

This is the error:

$ dnf upgrade
Traceback (most recent call last):
  File "/bin/dnf", 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 179, 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 1013, in run
    self._process_demands()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 766, in _process_demands
    load_available_repos=self.demands.available_repos)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 353, in fill_sack
    self._add_repo_to_sack(r)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 122, in _add_repo_to_sack
    hrepo.filelists_fn = repo._filelists_fn
TypeError: Expected a string or a unicode object

and for your information, my installed versions:

$ rpm -q dnf python3-dnf python3 python3-rpm
dnf-2.7.5-2.fc27.noarch
python3-dnf-2.7.5-2.fc27.noarch
textpython3-3.6.6-1.fc27.x86_64
python3-rpm-4.14.2.1-1.fc27.x86_64

Any advice, barring a fresh reinstall of the OS? I used the Fedora Server spin, as this is a server I ssh into. I’d prefer not to wipe everything, there’s a lot of software and configuration on this machine I want to keep intact as it’s used daily.

Hello.
Could you provide the output of this command
dnf repolist -v
Or any argument passed to dnf throws such error?

Thank you for responding! This is the output of the command:

Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, repoclosure, repograph, repomanage, reposync, system-upgrade
DNF version: 2.7.5
cachedir: /var/cache/dnf
repo: using cache for: updates
updates: using metadata from Fri 30 Nov 2018 12:29:19 AEDT.
repo: using cache for: fedora
not found deltainfo for: Fedora 27 - x86_64
not found updateinfo for: Fedora 27 - x86_64
fedora: using metadata from Sun 05 Nov 2017 16:51:47 AEDT.
repo: using cache for: mono-centos7-stable
not found deltainfo for: mono-centos7-stable
not found updateinfo for: mono-centos7-stable
mono-centos7-stable: using metadata from Fri 12 Apr 2019 02:28:49 AEST.
repo: using cache for: PlexRepo
Traceback (most recent call last):
  File "/bin/dnf", 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 179, 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 1013, in run
    self._process_demands()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 766, in _process_demands
    load_available_repos=self.demands.available_repos)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 353, in fill_sack
    self._add_repo_to_sack(r)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 122, in _add_repo_to_sack
    hrepo.filelists_fn = repo._filelists_fn
TypeError: Expected a string or a unicode object

I would suggest to try two actions:

  • dnf clean all then sudo dnf upgrade --refresh
  • disable PlexRepo repository and retry the commands above
$ dnf clean all
73 files removed
$ dnf upgrade --refresh
[updated Fedora 27 - x86_64 - Updates (27MB)]
[updated Fedora 27 - x86_64 (58MB)]
[updated mono-centos7-stable (1.3MB)]
PlexRepo ... 11 kB/s | 1.2 kB     00:00
Traceback (most recent call last):
  File "/bin/dnf", 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 179, 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 1013, in run
    self._process_demands()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 766, in _process_demands
    load_available_repos=self.demands.available_repos)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 353, in fill_sack
    self._add_repo_to_sack(r)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 122, in _add_repo_to_sack
    hrepo.filelists_fn = repo._filelists_fn
TypeError: Expected a string or a unicode object

Because it stopped on PlexRepo, I have taken your advice and disabled the repo with the command $ dnf config-manager --set-disabled PlexRepo and confirmed it is disabled by viewing the /etc/yum.repos.d/plex.repo file and seeing enabled=0.

Doing the steps again:

$ dnf clean all
25 files were removed
$ dnf upgrade --refresh
Error: Failed to synchronize cache for repo 'updates'

I took it upon myself to look this up, and came across this post about Fedora 30 and made the suggested change, adding the line zchuck=False into /etc/dnf/dnf.conf and running the refresh again.

$ dnf upgrade --refresh
[updated Fedora 27 - x86_64 - Updates (27MB)]
[updated Fedora 27 - x86_64 (58MB)]
[updated mono-centos7-stable (1.3MB)]
[updated RPM Fusion for Fedora 27 - Free (717kB)]
Failed to synchronize cache for repo 'rpmfusion-free-updates', disabling.
Last metadata expiration check: 0:00:00 ago on Wed 22 May 2019 16:44:53 AEST.
Dependencies resolved.

and then the list of packages that require updating.

Looks like that must have fixed it, though it does concern me that the rpmfusion-free-updates repo also had a problem. Thus, I attempted a dnf search of just some package name (mono) and it triggered an update on the RPM Fusion for Fedora 27 - Free - Updates repo without complaint (529kB). So that’s good! The PlexRepo is not critical, I can get the rpms from their website manually, that’s fine by me.

Looks like I’m on track to being able to upgrade! I appreciate your help @alciregi thank you very much!!

1 Like