Ask Your Question

Python error doing "sudo dnf upgrade"

asked 2015-09-19 15:29:38 -0500

q2dg gravatar image

updated 2015-09-19 18:00:23 -0500

skytux gravatar image

The error is:

Traceback (most recent call last):
  File "/bin/dnf", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/", line 198, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/", line 84, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/", line 117, in _main
    cli.configure(map(ucd, args))
  File "/usr/lib/python2.7/site-packages/dnf/cli/", line 1007, in configure
    self.optparser.usage = self.optparser.get_usage()
  File "/usr/lib/python2.7/site-packages/dnf/cli/", line 273, in get_usage
    usage += "%-25s %s\n" % (name, summary)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 51: ordinal not in range(128)

I has ocurred after upgrading and rebooting all packages. I mean I have last version from every package (F22).

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2015-09-20 01:58:42 -0500

tng gravatar image

As of bugs: Bug 539904, 1060382, Bug 1130432, 505831, and all the others showing up when you do a google search on: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 40 fedora dnf, this may be quite common.

I definitely think it has somthing to do with python and UTF8. As you can see in some posts, "accents" could be the reason why dnf fails.

Since currently is down for maintenance/upgrade, all I can suggest is that you try to run dnf using another locale. That worked for me. For example:

env LANG=C sudo dnf clean all && env LANG=C sudo dnf -y update
edit flag offensive delete link more


Yes, you're right: it works!

Something has broken in Python's Utf8 support in last update, then...

Thanks a lot

q2dg gravatar imageq2dg ( 2015-09-21 16:46:53 -0500 )edit

See also comment 26 on this bugzilla bug: for more help and a way to avoid the reboot loop.

erik gravatar imageerik ( 2016-12-27 05:29:27 -0500 )edit

answered 2015-09-19 17:14:08 -0500

davidva gravatar image

You can use yum-deprecated if you need update, and dnf doesn't work.

1) su
2) yum-deprecated clean metadata
3) yum-deprecated -y update
edit flag offensive delete link more


Thanks for the workaround. It's works. I'll do this until dnf gets corrected (I hope so!). Thanks!

q2dg gravatar imageq2dg ( 2015-09-20 09:00:49 -0500 )edit

Thanks a lot! 3 commands perfect.

Joan Vidal gravatar imageJoan Vidal ( 2015-11-09 16:58:23 -0500 )edit

Thanks !!!

sando66 gravatar imagesando66 ( 2015-11-30 18:08:20 -0500 )edit

answered 2016-03-19 03:57:09 -0500

Sol14 gravatar image

yum install python3-dnf.noarch --best --allowerasing This command solve all your problems about update and other...

edit flag offensive delete link more

answered 2015-10-05 13:35:46 -0500

q2dg gravatar image

well, workarounds work well,but this BIG problem is still unresolved. Ehem...

edit flag offensive delete link more


Time to switch to Python 3 where UTF-8 works just fine.

mithrial gravatar imagemithrial ( 2015-10-05 14:47:10 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-09-19 15:29:38 -0500

Seen: 4,730 times

Last updated: Oct 05 '15