![Yast2 损坏(zypper dup 之后?)](https://linux22.com/image/1588081/Yast2%20%E6%8D%9F%E5%9D%8F%EF%BC%88zypper%20dup%20%E4%B9%8B%E5%90%8E%EF%BC%9F%EF%BC%89.png)
不确定是否与我的 openSUSE Leap 15.0 的最新更新(zypper dup)有关,但现在所有 yast2 子命令都会因此错误而失败(单独 yast2 会显示该屏幕,但选择任何子命令也会失败):
erle:~ # yast2 sound
The config 'root' does not exist. Likely snapper is not configured.
See 'man snapper' for further instructions.
Traceback (most recent call last):
11: from /usr/lib/YaST2/bin/y2start:11:in `<main>'
10: from /usr/lib64/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
9: from /usr/lib64/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
8: from /usr/lib64/ruby/vendor_ruby/2.5.0/yast.rb:30:in `<top (required)>'
7: from /usr/lib64/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
6: from /usr/lib64/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
5: from /usr/lib64/ruby/vendor_ruby/2.5.0/yast/builtins.rb:9:in `<top (required)>'
4: from /usr/lib64/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
3: from /usr/lib64/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
2: from /usr/lib64/ruby/vendor_ruby/2.5.0/yast/i18n.rb:1:in `<top (required)>'
1: from /usr/lib64/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib64/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- fast_gettext (LoadError)
我见过https://stackoverflow.com/questions/45380062/opensuse-rvm-yast2-collision以及相关https://forums.opensuse.org/showthread.php/526198-Yast2-Ruby-Problem-After-Update,但我只有一个 ruby 版本:
erle:~ # zypper lr -d
Repository priorities are without effect. All enabled repositories share the same priority.
# | Alias | Name | Enabled | GPG Check | Refresh | Priority | Type | URI | Service
--+-----------------------------------+-----------------------------------+---------+-----------+---------+----------+--------+----------------------------------------------------------------------------------------+--------
1 | Oss | Oss | Yes | (r ) Yes | No | 99 | rpm-md | http://download.opensuse.org/distribution/leap/15.0/repo/oss/ |
2 | dvd | dvd | Yes | (r ) Yes | Yes | 99 | rpm-md | http://opensuse-guide.org/repo/openSUSE_Leap_15.0/ |
3 | gcc | gcc | Yes | (r ) Yes | No | 99 | rpm-md | http://download.opensuse.org/repositories/devel:/gcc/openSUSE_Leap_15.0 |
4 | mozilla | mozilla | Yes | (r ) Yes | No | 99 | rpm-md | http://download.opensuse.org/repositories/mozilla/openSUSE_Leap_15.0 |
5 | openSUSE-Leap-42.2-Update | openSUSE-Leap-15.0-Update | Yes | (r ) Yes | Yes | 99 | rpm-md | http://download.opensuse.org/update/leap/15.0/oss/ |
6 | openSUSE-Leap-42.2-Update-Non-Oss | openSUSE-Leap-15.0-Update-Non-Oss | Yes | (r ) Yes | Yes | 99 | rpm-md | http://download.opensuse.org/update/leap/15.0/non-oss/ |
7 | packman | packman | Yes | (r ) Yes | Yes | 99 | rpm-md | http://packman.inode.at/suse/openSUSE_Leap_15.0/ |
8 | x2go | x2go | Yes | (r ) Yes | No | 99 | rpm-md | https://download.opensuse.org/repositories/X11:/RemoteDesktop:/x2go/openSUSE_Leap_15.0 |
erle:~ # zypper se -si ruby
Loading repository data...
Reading installed packages...
S | Name | Type | Version | Arch | Repository
---+---------------------------------+---------+----------------------+--------+--------------------------
i | libruby2_5-2_5 | package | 2.5.0-lp150.2.11 | x86_64 | Oss
i+ | libstorage-ng-ruby | package | 3.3.317-lp150.2.15.1 | x86_64 | openSUSE-Leap-15.0-Update
i | ruby | package | 2.5-lp150.1.5 | x86_64 | Oss
i | ruby-common | package | 2.1-lp150.3.1 | noarch | Oss
i+ | ruby-devel | package | 2.5-lp150.1.5 | x86_64 | Oss
i | ruby2.5 | package | 2.5.0-lp150.2.11 | x86_64 | Oss
i | ruby2.5-devel | package | 2.5.0-lp150.2.11 | x86_64 | Oss
i | ruby2.5-rubygem-abstract_method | package | 1.2.1-lp150.1.9 | x86_64 | Oss
i | ruby2.5-rubygem-cfa | package | 0.6.4-lp150.1.1 | x86_64 | Oss
i | ruby2.5-rubygem-cfa_grub2 | package | 1.0.1-lp150.2.3.1 | x86_64 | openSUSE-Leap-15.0-Update
i | ruby2.5-rubygem-cheetah | package | 0.5.0-lp150.1.11 | x86_64 | Oss
i | ruby2.5-rubygem-fast_gettext | package | 1.6.0-lp150.1.4 | x86_64 | Oss
i | ruby2.5-rubygem-gem2rpm | package | 0.10.1-lp150.3.30 | x86_64 | Oss
i | ruby2.5-rubygem-ruby-augeas | package | 0.5.0-lp150.1.12 | x86_64 | Oss
i | ruby2.5-rubygem-ruby-dbus | package | 0.14.0-lp150.1.6 | x86_64 | Oss
i | ruby2.5-rubygem-simpleidn | package | 0.0.9-lp150.1.2 | x86_64 | Oss
i | ruby2.5-stdlib | package | 2.5.0-lp150.2.11 | x86_64 | Oss
i+ | xmms2-ruby | package | 0.8-lp150.2.8 | x86_64 | Oss
i+ | yast2-ruby-bindings | package | 4.0.6-lp150.1.1 | x86_64 | Oss
我该如何修复 yast2?
答案1
抱歉,我问了这个问题,我想我找到了解决方案。缺少的 fast_gettext 应该是 ruby2.5-rubygem-fast_gettext 包的一部分:
erle:~ # rpm -ql ruby2.5-rubygem-fast_gettext
/usr/lib64/ruby/gems/2.5.0/build_info
/usr/lib64/ruby/gems/2.5.0/cache/fast_gettext-1.6.0.gem
/usr/lib64/ruby/gems/2.5.0/gems/fast_gettext-1.6.0
...
但是,在我的系统上它不存在:
erle:~ # ll /usr/lib64/ruby/gems/2.5.0/gems
total 68
drwxr-xr-x 3 root root 4096 Jul 4 2018 bundler-1.16.2
drwxr-xr-x 3 root root 4096 Nov 28 10:17 cfa_grub2-1.0.1
drwxr-xr-x 6 root root 4096 Jul 4 2018 chunky_png-1.3.10
drwxr-xr-x 6 root root 4096 Jul 4 2018 compass-1.0.3
drwxr-xr-x 6 root root 4096 Jul 4 2018 compass-core-1.0.3
drwxr-xr-x 4 root root 4096 Jul 4 2018 compass-import-once-1.0.5
drwxr-xr-x 7 root root 4096 Jul 4 2018 ffi-1.8.1
drwxr-xr-x 7 root root 4096 Jul 4 2018 ffi-1.9.0
drwxr-xr-x 7 root root 4096 Jul 4 2018 ffi-1.9.17
drwxr-xr-x 5 root root 4096 Jul 4 2018 ffi-1.9.25
drwxr-xr-x 3 root root 4096 Jul 4 2018 multi_json-1.13.1
drwxr-xr-x 5 root root 4096 Jul 4 2018 rb-fsevent-0.10.3
drwxr-xr-x 4 root root 4096 Jul 4 2018 rb-inotify-0.9.10
drwxr-xr-x 3 root root 4096 Jun 27 2018 rdoc-6.0.1
drwxr-xr-x 8 root root 4096 Jul 4 2018 sass-3.4.25
drwxr-xr-x 4 root root 4096 Nov 28 10:22 suse-connect-0.3.12
所以我重新安装了这个包
erle:~ # zypper install --force ruby2.5-rubygem-fast_gettext
之后,yast2 弹出窗口抱怨缺少“abstract_method”。不知道还有什么被删除了,我重新安装了所有与 ruby 相关的包
zypper in --force libruby2_5-2_5 libstorage-ng-ruby ruby ruby-common ruby-devel ruby2.5 ruby2.5-devel ruby2.5-rubygem-abstract_method ruby2.5-rubygem-cfa ruby2.5-rubygem-cfa_grub2 ruby2.5-rubygem-cheetah ruby2.5-rubygem-fast_gettext ruby2.5-rubygem-gem2rpm ruby2.5-rubygem-ruby-augeas ruby2.5-rubygem-ruby-dbus ruby2.5-stdlib ruby2.5-rubygem-simpleidn yast2-ruby-bindings
现在 yast2 已经恢复运行。剩下的谜团是这些文件是如何丢失的。