执行 `zypper update` 后 yast2 损坏

Posted

技术标签:

【中文标题】执行 `zypper update` 后 yast2 损坏【英文标题】:yast2 is broken after executing `zypper update` 【发布时间】:2020-03-29 18:34:15 【问题描述】:

我是一个使用 openSUSE 的新手。 最近执行zypper update,发现yast2 UI客户端无法启动。在/var/log/YaST2/y2log可以看到登录:

2020-03-30 02:30:06 <1> linux-fjbu(26996) [Ruby] yast/wfm.rb:308 Call client /usr/share/YaST2/clients/sw_single.rb
2020-03-30 02:30:06 <1> linux-fjbu(26996) [Pkg] PkgModule.cc(instance):68 Redirecting ZYPP log to y2log
2020-03-30 02:30:07 <2> linux-fjbu(26996) [Ruby] yast/i18n.rb:61 luocanwei debug: found:true; str:"Print the help for this module"
2020-03-30 02:30:07 <3> linux-fjbu(26996) [Y2Ruby] binary/Y2RubyUtils.cc(y2_require):26 cannot require yast:undefined method `_' for FastGettext::Translation:Module at /usr/lib64/ruby/vendor_ruby/2.5.0/yast/i18n.rb:62:in `_'
2020-03-30 02:30:07 <3> linux-fjbu(26996) [Y2Ruby] binary/Y2RubyUtils.cc(y2_require):26 cannot require yast:undefined method `message' for nil:NilClass at /usr/lib64/ruby/vendor_ruby/2.5.0/yast/yast.rb:186:in `import_pure'
2020-03-30 02:30:07 <3> linux-fjbu(26996) [Y2Ruby] binary/Y2RubyComponent.cc(import):100 Reporting runtime error for import of module 'PackageCallbacks' message 'undefined method `message' for nil:NilClass'
2020-03-30 02:30:07 <3> linux-fjbu(26996) [Interpreter] yast/i18n.rb:145 Runtime error when loading module 'PackageCallbacks'
2020-03-30 02:30:07 <2> linux-fjbu(26996) [Ruby] yast/builtins.rb:586 tostring builtin called on wrong type Class
2020-03-30 02:30:07 <3> linux-fjbu(26996) [Ruby] yast/wfm.rb:253 Client /usr/share/YaST2/clients/sw_single.rb failed with 'Failed to load Module 'PackageCallbacks' due to: undefined method `message' for nil:NilClass' (RuntimeError).
Backtrace:
/usr/lib64/ruby/vendor_ruby/2.5.0/yast/yast.rb:186:in `import_pure'
/usr/lib64/ruby/vendor_ruby/2.5.0/yast/yast.rb:186:in `import'
/usr/share/YaST2/modules/PackageCallbacks.rb:61:in `main'
/usr/share/YaST2/modules/PackageCallbacks.rb:3219:in `<module:Yast>'
/usr/share/YaST2/modules/PackageCallbacks.rb:30:in `<top (required)>'
/usr/lib64/ruby/vendor_ruby/2.5.0/yast/yast.rb:186:in `import_pure'
/usr/lib64/ruby/vendor_ruby/2.5.0/yast/yast.rb:186:in `import'
/usr/share/YaST2/clients/sw_single.rb:24:in `main'
/usr/share/YaST2/clients/sw_single.rb:801:in `<top (required)>'
/usr/lib64/ruby/vendor_ruby/2.5.0/yast/wfm.rb:313:in `eval'
/usr/lib64/ruby/vendor_ruby/2.5.0/yast/wfm.rb:313:in `run_client'
/usr/lib64/ruby/vendor_ruby/2.5.0/yast/wfm.rb:206:in `call_builtin'
/usr/lib64/ruby/vendor_ruby/2.5.0/yast/wfm.rb:206:in `call_builtin_wrapper'
/usr/lib64/ruby/vendor_ruby/2.5.0/yast/wfm.rb:195:in `CallFunction'
/usr/lib/YaST2/bin/y2start:58:in `<main>'
2020-03-30 02:30:07 <3> linux-fjbu(26996) [Ruby] yast/wfm.rb:276 Internal error. Please report a bug report with logs.
Run save_y2logs to get complete logs.
Details: Failed to load Module 'PackageCallbacks' due to: undefined method `message' for nil:NilClass
Caller:  /usr/lib64/ruby/vendor_ruby/2.5.0/yast/yast.rb:186:in `import_pure'

我已经报告了错误https://bugzilla.suse.com/show_bug.cgi?id=1167315,但一周没有得到答复。

我该如何解决这个问题。谢谢。

【问题讨论】:

【参考方案1】:

在 Stefan 的帮助下,我的问题得到了解决。

原因是我最近安装的输入法软件(Leap 15.1)版本与系统版本(Leap 15.0)冲突。

我的解决方法如下:

(1) 移除 M17N repo(Leap 15.1)

sudo zypper rr 1  ## 1 is the index number of M17N after `sudo zypper lr`

(2) 添加 M17N repo(Leap 15.0)

sudo zypper ar -f https://download.opensuse.org/repositories/home:/MargueriteSu:/branches:/M17N/openSUSE_Leap_15.0/home:MargueriteSu:branches:M17N.repo

(3) 更新仓库

sudo zypper update

(4)卸载搜狗拼音/yast2(包括kde_yast和yast2_basis)/fast_gettext

sudo zypper remove sogou-pinyin
sudo zypper remove yast2-ruby-bindings
sudo zypper remove ruby2.5-rubygem-fast_gettext
sudo gem uninstall fast_gettext

(5) 重新安装 yast2

sudo zypper install patterns-kde-kde_yast
sudo zypper install patterns-yast-yast2_basis

(6)重新安装搜狗拼音

sudo zypper install sogou-pinyin

我的 yast2 重生。

【讨论】:

以上是关于执行 `zypper update` 后 yast2 损坏的主要内容,如果未能解决你的问题,请参考以下文章

Opensuse zypper 笔记

期望:无法执行“/usr/bin/zypper patch”:没有这样的文件或目录

SUSE zypper 添加源和离线下载rpm包

SUSE zypper 添加源和离线下载rpm包

SUSE Linux 的Zypper包管理器使用实例

SUSE-11 本地 zypper 配置