Bug 1278031 - dnf fails to find system-upgrade plugin with certain locales (Chinese, Japanese and maybe more)
dnf fails to find system-upgrade plugin with certain locales (Chinese, Japane...
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf-plugin-system-upgrade (Show other bugs)
22
Unspecified Unspecified
unspecified Severity urgent
: ---
: ---
Assigned To: Will Woods
Fedora Extras Quality Assurance
https://fedoraproject.org/wiki/Common...
: CommonBugs, Reopened
: 1279217 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-04 10:16 EST by Kamil Páral
Modified: 2015-12-16 09:36 EST (History)
11 users (show)

See Also:
Fixed In Version: dnf-plugin-system-upgrade-0.7.1 dnf-plugin-system-upgrade-0.7.1-1.fc22 dnf-plugin-system-upgrade-0.7.1-1.fc23
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-09 22:51:31 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Kamil Páral 2015-11-04 10:16:41 EST
Description of problem:
With en_US locale, everything works well (ignore the dep issue, that's not important):

$ sudo dnf system-upgrade download --releasever=23
Last metadata expiration check performed 0:05:49 ago on Wed Nov  4 16:03:25 2015.
Error: package smc-1.9-17.fc22.x86_64 requires libboost_filesystem.so.1.57.0()(64bit), but none of the providers can be installed
(try to add '--allowerasing' to command line to replace conflicting packages)

With zh_CN locale, the system-upgrade plugin is not found:
$ LC_ALL=zh_CN.UTF-8 sudo dnf system-upgrade download --releasever=23
加载插件失败:system_upgrade
没有命令: system-upgrade。请使用 /bin/dnf --help
这可能是一个DNF插件的命令,请尝试:"dnf install 'dnf-command(system-upgrade)'"

which translates to:
Failed to load plugin: system_upgrade
No command: system-upgrade. Use / bin / dnf --help
This may be a DNF plug-in command, try: "dnf install 'dnf-command (system-upgrade)'"


Other Chinese users see even tracebacks:
加载插件失败:system_upgrade
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/main.py", line 198, in user_main
errcode = main(args)
File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 84, in main
return _main(base, args)
File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 117, in _main
cli.configure(map(ucd, args))
File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1006, in configure
self.base.plugins.run_init(self.base, self)
File "/usr/lib/python2.7/site-packages/dnf/plugin.py", line 104, in run_init
plugin = p_cls(base, cli)
File "/usr/lib/python2.7/site-packages/dnf-plugins/system_upgrade.py", line 359, in __init__
super(SystemUpgradePlugin, self).__init__(base, cli)
TypeError: must be type, not None
(The Chinese characters means ‘failed to load plugin’)

See here:
http://fedoramagazine.org/upgrading-from-fedora-22-to-fedora-23/#comment-449824



Version-Release number of selected component (if applicable):
dnf-1.1.3-1.fc22.noarch
dnf-conf-1.1.3-1.fc22.noarch
dnf-plugins-core-0.1.13-1.fc22.noarch
dnf-plugin-system-upgrade-0.7.0-1.fc22.noarch
dnf-yum-1.1.3-1.fc22.noarch
python2-dnf-plugin-system-upgrade-0.7.0-1.fc22.noarch
python3-dnf-1.1.3-1.fc22.noarch
python-dnf-1.1.3-1.fc22.noarch
python-dnf-plugins-core-0.1.13-1.fc22.noarch
python-dnf-plugins-extras-common-0.0.11-1.fc22.noarch
python-dnf-plugins-extras-migrate-0.0.11-1.fc22.noarch
Comment 1 Kamil Páral 2015-11-04 10:17:15 EST
Adding wwoods into CC in case it's a bug in system-upgrade plugin somehow.
Comment 2 Kamil Páral 2015-11-04 10:49:01 EST
A workaround for this (not tested) could be:
1. See what your current locale is:
$ locale
2. Switch system to English:
$ sudo localectl set-locale LANG=en_US.UTF-8
3. Reboot, perform the upgrade.
4. Switch your system back to Chinese:
$ sudo localectl set-locale LANG=YOUR_OLD_LOCALE
5. Reboot.
Comment 3 Kamil Páral 2015-11-05 05:16:19 EST
Also tracked in system-upgrade github:
https://github.com/rpm-software-management/dnf-plugin-system-upgrade/issues/32
Comment 4 Michal Luscon 2015-11-05 09:28:59 EST
Hi,

I was able to reproduce the traceback and it seems that jsilhan was right with blaming python. The whole issue is apparently caused by lines #368 and #369 containing:

usage = dnf.i18n.ucd("[%s] [download --releasever=%s|reboot|clean|log]" % (
        _("OPTIONS"), _("VERSION")))

After commenting out those lines the plugin run smoothly. 

Using python3 version of plugin can be considered as another workaround.
Comment 5 Michal Luscon 2015-11-05 09:43:41 EST
It can be also fixed by:

usage = "[%s] [download --releasever=%s|reboot|clean|log]" % (
        dnf.i18n.ucd(_("OPTIONS")), dnf.i18n.ucd(_("VERSION")))
Comment 6 Will Woods 2015-11-05 16:15:24 EST
Hmm. `dnf config-manager` will probably have the same problem, then, since AFAICT it's doing the same thing:

    usage = '[%s] [%s]' % (_('OPTIONS'), _('KEYWORDS'))

See https://github.com/rpm-software-management/dnf-plugins-core/blob/dnf-plugins-core-0.1.13-1/plugins/config_manager.py#L49

I'm kind of confused about the root cause here, and the fact that we have to fix multiple plugins feels more like it's a bug in DNF (or, at least, something to add to the plugin docs, i.e. that the 'usage' property has to be the same type as.. whatever the return value of dnf.i18n._() is.)

Anyway, I should have a patch for this shortly.
Comment 7 Honza Silhan 2015-11-06 08:56:42 EST
It's not a bug in DNF but Python 2 stuff that cannot handle concatenate different types of strings properly. If it would require fix on may places we can add proper gettext initialization in DNF [1].

[1] https://github.com/rpm-software-management/dnf/pull/375
Comment 8 Will Woods 2015-11-09 15:51:33 EST
This commit should fix things for now:

  https://github.com/rpm-software-management/dnf-plugin-system-upgrade/commit/8430636

I can prepare a patch that uses dnf.i18n.translation once that lands in upstream dnf.

Expect dnf-plugin-system-upgrade 0.5.1/0.7.1 to arrive soon..ish.
Comment 9 Jens Petersen 2015-11-11 21:10:34 EST
I cavalierly ignored comment 2 and just ran:

$ LANG=C sudo dnf system-upgrade download --releasever=23
$ LANG=C sudo dnf system-upgrade reboot

Not only did it fail to upgrade - it also no longer boots and I don't know how to fix it. (Not sure if the old F21 rescue target boot target was still working.)

eg localectl in the rescue environment complains it can't connect to dbus.
(What could possibly go wrong...;)
Comment 10 Will Woods 2015-11-12 10:16:52 EST
(In reply to Jens Petersen from comment #9)
> I cavalierly ignored comment 2 and just ran:
> 
> $ LANG=C sudo dnf system-upgrade download --releasever=23
> $ LANG=C sudo dnf system-upgrade reboot
> 
> Not only did it fail to upgrade - it also no longer boots and I don't know
> how to fix it. (Not sure if the old F21 rescue target boot target was still
> working.)

Until dnf-plugin-system-upgrade-0.7.1 is released, you could probably work around this one of two ways:

1) Abort the upgrade

    See the directions here: https://github.com/rpm-software-management/dnf-plugin-system-upgrade#in-case-of-boot-problems

2) Make the upgrade also use LANG=C

Follow the directions above, but instead of removing /sysroot/system-update,
add the following line to /lib/systemd/system/dnf-system-upgrade.service:
    
    Environment=LANG=C

Once you exit the emergency shell, the upgrade *should* start normally.
Comment 11 Fedora Update System 2015-11-16 14:07:26 EST
dnf-plugins-core-0.1.14-1.fc23 dnf-1.1.4-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-fe6e8b885b
Comment 12 Martin Rossbach 2015-11-18 04:27:47 EST
I'd like to confirm that switching to locale "en_US" as comment 2 suggests will work flawlessly with the system upgrade from f21 to f23. Using Lang=C failed as with comment 9.

I failed with de_DE locale.....

(I did this comment for those still with f21 (or f22) and didn't get the update (yet))
Comment 13 Kamil Páral 2015-11-18 05:55:20 EST
(In reply to Fedora Update System from comment #11)
> dnf-plugins-core-0.1.14-1.fc23 dnf-1.1.4-1.fc23 has been submitted as an
> update to Fedora 23.
> https://bodhi.fedoraproject.org/updates/FEDORA-2015-fe6e8b885b

I tried to install this update onto F22, and the problem persists. Before, I received this error (translated from Chinese):
Failed to load plugin: system_upgrade
No command: system-upgrade. Use / bin / dnf --help
This may be a DNF plug-in command, try: "dnf install 'dnf-command (system-upgrade)'"

With the update, I receive this (note the missing first line):
No command: system-upgrade. Use / bin / dnf --help
This may be a DNF plug-in command, try: "dnf install 'dnf-command (system-upgrade)'"

But it might be caused by package version mismatch? Please provide a F22 build to test this.
Comment 14 Honza Silhan 2015-11-18 07:35:57 EST
*** Bug 1279217 has been marked as a duplicate of this bug. ***
Comment 15 Fedora Update System 2015-11-18 11:26:27 EST
dnf-1.1.4-1.fc22 dnf-plugins-core-0.1.14-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-6137119aff
Comment 16 Fedora Update System 2015-11-18 11:52:18 EST
dnf-1.1.4-1.fc23, dnf-plugins-core-0.1.14-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update dnf dnf-plugins-core'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-fe6e8b885b
Comment 17 Kamil Páral 2015-11-19 03:53:06 EST
(In reply to Fedora Update System from comment #15)
> dnf-1.1.4-1.fc22 dnf-plugins-core-0.1.14-1.fc22 has been submitted as an
> update to Fedora 22.
> https://bodhi.fedoraproject.org/updates/FEDORA-2015-6137119aff

This does not fix this bug. Are system-upgrade changes needed as well?
Comment 18 Fedora Update System 2015-11-19 04:52:20 EST
dnf-1.1.4-1.fc23, dnf-plugins-core-0.1.14-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
Comment 19 Fedora Update System 2015-11-19 09:51:21 EST
dnf-1.1.4-1.fc22, dnf-plugins-core-0.1.14-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update dnf-plugins-core dnf'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-6137119aff
Comment 20 Honza Silhan 2015-11-24 09:38:56 EST
The changes were made in dnf [1] and in system-upgrade plugin [2]. I unreferenced this BZ from bodhi update.

[1] https://github.com/rpm-software-management/dnf/commit/a4df4849f412b9f03e6e18b52996134a5267c0cd
[2] https://github.com/rpm-software-management/dnf-plugin-system-upgrade/commit/4bbbf1ec0c3f387249d30dd103ff4d002c17f574
Comment 21 Kamil Páral 2015-11-25 04:48:43 EST
OK, thanks. Waiting for a new system-upgrade version...
Comment 22 Fedora Update System 2015-12-07 15:39:19 EST
dnf-plugin-system-upgrade-0.7.1-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-45efbec1fe
Comment 23 Fedora Update System 2015-12-07 15:39:23 EST
dnf-plugin-system-upgrade-0.7.1-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-6b41346335
Comment 24 Kamil Páral 2015-12-08 03:58:16 EST
This fixes the problem for F22. But we have left the Chinese/Japanese/other users of F21 stranded, because we can no longer push a fix there. Their only choice is to do the workaround - switch system language to English (or other working language), perform the upgrade, and switch it back.
Comment 25 Fedora Update System 2015-12-08 17:58:30 EST
dnf-plugin-system-upgrade-0.7.1-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update dnf-plugin-system-upgrade'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-45efbec1fe
Comment 26 Fedora Update System 2015-12-08 18:51:51 EST
dnf-plugin-system-upgrade-0.7.1-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update dnf-plugin-system-upgrade'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-6b41346335
Comment 27 Fedora Update System 2015-12-09 22:51:20 EST
dnf-plugin-system-upgrade-0.7.1-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
Comment 28 Fedora Update System 2015-12-16 09:36:29 EST
dnf-plugin-system-upgrade-0.7.1-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.