如何就地升级到最新的 openSUSE Leap 版本

如何就地升级到最新的 openSUSE Leap 版本

与全新安装相比,就地升级的一个主要优点
是所有帐户、配置和安装的程序都保持完整。

使用适用于 Linux 的 Windows 子系统 (WSL),我安装了一个新的 openSUSE 42.1实例

如何将 openSUSE 42 就地升级到 15.x?

我的主要兴趣是从 openSUSE 42 升级到最新的 openSUSE 版本。
在撰写本文时, Leap 15.4 是最新的 openSUSE 活跃版本

动机

从命令行安装时,WSL 仍然仅提供 openSUSE 42.2 版本。
考虑到openSUSE 42.2 的生命周期于 2018 年 1 月正式结束
– 大约五年前 – 升级到新版本是有意义的。

警告!

在考虑就地升级之前,请确保有足够的可用磁盘空间,
在本例中,至少大约 5 GiB。

参考


1 打开Windows CMD.exe以管理员身份(WinKey+ r,键入cmd,按住 Ctrl+ Shift,按Enter)。
然后通过运行以下命令安装 openSUSE 42.2:

wsl.exe --install --distribution openSUSE-42

答案1

如何将 openSUSE 42 就地升级到 15.x?

在开始实验之前,最好进行预防性备份,以防出现问题。要备份现有.repo配置文件,请执行以下操作: 1

cd /etc/zypp/repos.d/ && sudo zip oss-42.2_orig.zip *.repo

我如何将 openSUSE 从 42.2 升级到 15.4 2

1.刷新并更新现有的openSUSE 42.2

升级之前,关键的一步就是运行sudo zypper refreshsudo zypper update刷新更新当前的系统版本。

:~> sudo zypper refresh
Retrieving repository 'oss' metadata ...........................[done]
Building repository 'oss' cache ................................[done]
Retrieving repository 'oss_update' metadata ....................[done]
Building repository 'oss_update' cache .........................[done]
All repositories have been refreshed.
:~> sudo zypper update
Loading repository data...
Warning: Repository 'oss_update' appears to be outdated.
 Consider using a different mirror or server.
Reading installed packages...

The following 3 NEW packages are going to be installed:
  kbd kmod pkg-config

The following 88 packages are going to be upgraded:
  binutils command-not-found coreutils cpp48 curl dbus-1 …
  yast2-xml zip zypper

88 packages to upgrade, 3 new.
Overall download size: 96.8 MiB. Already cached: 0 B. After the operation,
additional 7.8 MiB will be used.
Continue? [y/n/...? shows all options] (y): y

如上面的输出转储所示,我选择y开始更新。
这将开始下载并安装最新版本的 openSUSE 42.2 软件包。

Retrieving package emacs-info-24.3-24.6.1.noarch (1/91),              4.2 MiB
Retrieving: emacs-info-24.3-24.6.1.noarch.rpm .............[done (1.7 MiB/s)]
Retrieving package file-magic-5.22-7.6.1.x86_64 (2/91),             334.5 KiB
Retrieving: file-magic-5.22-7.6.1.x86_64.rpm ..........................[done]
Retrieving package wicked-service-0.6.40-6.6.1.x86_64 (91/91),       58.6 KiB
Retrieving: wicked-service-0.6.40-6.6.1.x86_64.rpm ....................[done]
Checking for file conflicts: ..........................................[done]
( 1/91) Installing: emacs-info-24.3-24.6.1.noarch .....................[done]
( 2/91) Installing: file-magic-5.22-7.6.1.x86_64 ......................[done]
(91/91) Installing: wicked-service-0.6.40-6.6.1.x86_64 ................[done]
Additional rpm output:
Failed to connect to bus: No such file or directory
Output of coreutils-8.25-2.3.1.x86_64.rpm %posttrans script:
    Please run mkinitrd as soon as your system is complete.

现在 openSUSE Leap 42.2 已经成功刷新和更新,
是时候开始升级到 openSUSE Leap 15.4 了。

.repo2.更改配置文件中的版本号

A. 在 中/etc/zypp/repos.d/oss.repo,替换42.2/repo/oss/suse15.4/repo/oss

sudo sed -i 's|42.2/repo/oss/suse|15.4/repo/oss|g' /etc/zypp/repos.d/oss.repo
:~> cat /etc/zypp/repos.d/oss.repo
[oss]
enabled=1
autorefresh=0
baseurl=http://download.opensuse.org/distribution/leap/15.4/repo/oss/
type=rpm-md

B. 在 中/etc/zypp/repos.d/oss_update.repo,替换42.215.4

sudo sed -i 's|42.2|15.4|g' /etc/zypp/repos.d/oss_update.repo
:~> cat /etc/zypp/repos.d/oss_update.repo
[oss_update]
enabled=1
autorefresh=0
baseurl=http://download.opensuse.org/update/leap/15.4/oss/
type=rpm-md

3. 同步可用的软件包和版本列表

:~> sudo zypper refresh
Retrieving repository 'oss' metadata ...........................[done]
Building repository 'oss' cache ................................[done]
Retrieving repository 'oss_update' metadata ....................[done]
Building repository 'oss_update' cache .........................[done]
All repositories have been refreshed.

4. 执行发行版升级

:~> sudo zypper dist-upgrade
Warning: You are about to do a distribution upgrade with all enabled
 repositories. Make sure these repositories are compatible before you
 continue. See 'man zypper' for more information about this command.
Loading repository data...
Reading installed packages...
Computing distribution upgrade...
14 Problems:
Problem: nothing provides (kmod(sg.ko) if kernel)
needed by suse-module-tools-15.4.12-150400.1.4.x86_64
 Solution 1: deinstallation of suse-module-tools-12.4-3.2.x86_64
 Solution 2: keep obsolete suse-module-tools-12.4-3.2.x86_64
 Solution 3: break suse-module-tools-15.4.12-150400.1.4.x86_64
  by ignoring some of its dependencies
Choose from above solutions by number or skip, retry, cancel [1/2/3/s/r/c]: 1

好的?我现在应该怎么做?
如上面的输出转储所示,我选择了 卸载 suse-module-tools-12.4-...

一个新的问题显示。

Problem: nothing provides (/usr/sbin/useradd or busybox)
needed by sysuser-shadow-3.1-150400.1.35.noarch
 Solution 1: deinstallation of rpcbind-0.2.3-3.3.1.x86_64
 Solution 2: keep obsolete rpcbind-0.2.3-3.3.1.x86_64
 Solution 3: break sysuser-shadow-3.1-150400.1.35.noarch
  by ignoring some of its dependencies
Choose from above solutions by number or skip, retry, cancel [1/2/3/s/r/c]: 1

我再次选择了卸载……(rpcbind-0.2.3-3.3.1.x86_64)。

这样的事一直持续着。有时,卸载被呈现为解决方案2
我继续选择卸载对于以下软件包:
patterns-openSUSE-base-20150918-27.1.x86_64, man-2.6.6-6.3.1.x86_64,
emacs-24.3-24.6.1.x86_64, udev-228-25.18.1.x86_64,
util-linux-2.28-12.9.1.x86_64, systemd-228-25.18.1.x86_64,
libutempter0-1.1.6-7.55.x86_64, openssh-7.2p2-11.6.1.x86_64,
emacs-nox-24.3-24.6.1.x86_64, gpm-1.20.7-9.53.x86_64,
systemd-sysvinit-228-25.18.1.x86_64, util-linux-systemd-2.28-12.9.1.x86_64, , , , , , , , , , ,
sysconfig-netconfig-0.84.0-1.2.x86_64, , , , , , , 。
aaa_base-13.2+git20140911.61c1681-24.3.1.x86_64kmod-17-10.3.1.x86_64
screen-4.0.4-7.21.x86_64sysconfig-0.84.0-1.2.x86_64
wicked-0.6.40-6.6.1.x86_64kmod-compat-17-10.3.1.x86_64
libwicked-0-6-0.6.40-6.6.1.x86_64ruby-common-2.1-6.3.1.noarch
wicked-service-0.6.40-6.6.1.x86_64yast2-packager-3.1.123-5.6.1.x86_64
aaa_base-extras-13.2+git20140911.61c1681-24.3.1.x86_64
yast2-ruby-bindings-3.1.51.2-3.1.x86_64yast2-3.1.217-5.6.1.x86_64
yast2-country-data-3.1.32-1.2.x86_64ruby-2.1-4.2.x86_64
yast2-hardware-detection-3.1.7-9.5.x86_64yast2-transfer-3.1.3-1.3.x86_64

回答后卸载对于最后一个包,很多的输出如下。

Resolving dependencies...
Computing distribution upgrade...
The following 96 NEW packages are going to be installed:
  bash-sh blog boost-license1_66_0 branding-openSUSE … vim-data-common

The following NEW product is going to be installed:
  "openSUSE Leap 15.4"

The following 45 packages are going to be REMOVED:
  aaa_base aaa_base-extras emacs emacs-nox gpm kmod … yast2-transfer

The following pattern is going to be REMOVED:  base

The following product is going to be REMOVED:  openSUSE

The following 198 packages are going to be upgraded:
  augeas bash bc bind-utils binutils bzip2 ca-certificates … zypper

The following pattern is going to be upgraded:  minimal_base

The following 26 packages are going to be downgraded:
  acl fillup insserv-compat klogd libacl1 libaio1 libattr1 … unzip zip

The following 4 packages are going to change architecture:
  file-magic                 x86_64 -> noarch
  linux-glibc-devel          noarch -> x86_64
  openssl                    x86_64 -> noarch
  perl-XML-NamespaceSupport  x86_64 -> noarch
The following 217 packages are going to change vendor:
  acl                        openSUSE -> SUSE LLC <https://www.suse.com/>
  zypper                     openSUSE -> SUSE LLC <https://www.suse.com/>

198 packages to upgrade, 26 to downgrade, 96 new, 45 to remove, 217 to
change vendor, 4 to change arch.
Overall download size: 189.6 MiB. Already cached: 0 B. After the operation,
additional 293.0 MiB will be used.
Continue? [y/n/...? shows all options] (y): y

我选择了y,然后开始下载和安装。

Retrieving package boost-license1_66_0-1.66.0-12.3.1.noarch (1/320), 20.8 KiB
Retrieving: boost-license1_66_0-1.66.0-12.3.1.noarch.rpm ..............[done]
Retrieving package branding-openSUSE-15.4.20220322-lp154.2. (2/320), 11.6 KiB
Retrieving package device-mapper-1.02.163-150400.15.95.x (320/320), 143.7 KiB
Retrieving: device-mapper-1.02.163-150400.15.95.x86_64.rpm ............[done]

Checking for file conflicts: ..........................................[done]
(  1/363) Installing: boost-license1_66_0-1.66.0-12.3.1.noarch ........[done]
Additional rpm output:
warning: /var/cache/zypp/packages/oss/noarch/boost-license1_66_0-1.66.0-12.3.
1.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 39db7c82: NOKEY
(  2/363) Installing: …
(362/363) Removing kmod-17-10.3.1.x86_64 ..............................[done]
(363/363) Removing suse-module-tools-12.4-3.2.x86_64 ..................[done]
Output of rpm-4.14.3-150300.46.1.x86_64.rpm %posttrans script:
    migrating rpmdb from /var/lib/rpm to /usr/lib/sysimage/rpm...

我看到了很多警告,其中最常见的是 No such file or directory.
下载和安装大约需要 7 分钟。

5.检查openSUSE当前新版本

:~> sudo zypper repos
Repository priorities are without effect.
All enabled repositories share the same priority.

# | Alias                       | Name        | Enabled | GPG Check | Refresh
--+-----------------------------+-------------+---------+-----------+--------
1 | oss                         | oss         | Yes     | (r ) Yes  | No
2 | oss_update                  | oss_update  | Yes     | (r ) Yes  | No
3 | repo-backports-debug-update | Update re-> | No      | ----      | ----
4 | repo-backports-update       | Update re-> | Yes     | (r ) Yes  | Yes
5 | repo-sle-debug-update       | Update re-> | No      | ----      | ----
6 | repo-sle-update             | Update re-> | Yes     | (r ) Yes  | Yes

检查版本:

:~> cat /etc/os-release
NAME="openSUSE Leap"
VERSION="15.4"

6. 重建系统存储库的缓存

:~> sudo zypper refresh
Repository 'oss' is up to date.
Building repository 'oss' cache ................................[done]
Repository 'oss_update' is up to date.
Building repository 'oss_update' cache .........................[done]

New repository or package signing key received:
  Repository:       Update repository of openSUSE Backports
  Key Fingerprint:  …
Do you want to reject the key, trust temporarily, trust always? [r/t/a/?]: t
Retrieving repository 'Update repository of openSUSE Backports'metadata[done]
Building repository 'Update repository of openSUSE Backports' cache ...[done]

New repository or package signing key received:
Repository:      Update repository with updates from SUSE Linux Enterprise 15
Key Fingerprint: …
Do you want to reject the key, trust temporarily, trust always? [r/t/a/?]: t
Retrieving repository 'Update repository with updates from SUSE Linux E[done]
Building repository 'Update repository with updates from SUSE Linux Ent[done]
All repositories have been refreshed.

7. 将已安装的软件包升级到最新的可用版本3

然后我就跑了sudo zypper update

-bash-4.4$ sudo zypper update
Loading repository data...
Reading installed packages...

The following 125 packages are going to be upgraded:
  augeas bind-utils binutils ca-certificates-mozilla curl … zypper

The following 7 NEW packages are going to be installed:
  libisc1606 libjitterentropy3 libutempter0 libzck1 … util-linux

The following 2 packages are going to be REMOVED:
  bind-libs hardlink

125 packages to upgrade, 7 new, 2 to remove.
Overall download size: 102.2 MiB. Already cached: 0 B. After the operation,
additional 1.7 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y

当然,我选择了y。接下来是更新的下载和安装。

Retrieving package sysuser-shadow-3.1-150400.1.35.noarch (1/132),  12.9 KiB
Retrieving: sysuser-shadow-3.1-150400.1.35.noarch.rpm .................[done]
Retrieving package system-group-hardware-20170617-150400.… (2/132),  12.4 KiB
Retrieving: …
Retrieving package util-linux-2.37.2-150400.8.8.1.x86_64 (132/132),   1.3 MiB
Retrieving: util-linux-2.37.2-150400.8.8.1.x86_64.rpm .................[done]

Checking for file conflicts: ..........................................[done]
(  1/132) Installing: sysuser-shadow-3.1-150400.1.35.noarch ...........[done]
/usr/sbin/groupadd -r render
/usr/sbin/groupadd -r sgx
(  2/132) Installing: …
(132/132) Installing: util-linux-2.37.2-150400.8.8.1.x86_64 ...........[done]
Executing %posttrans scripts ..........................................[done]

http:8.和之间的战斗https:

根据我的经验,在文件中 替换http:为 可能会导致错误。 当我这样做 – 然后运行​​– 我经常(但并非总是)得到: 4https:/etc/zypp/repos.d/*.repo

sudo zypper refresh

:~> sudo zypper refresh
Download (curl) error for 'https://download.opensuse.org/distribution/…':
Error code: Curl error 60
Error message: SSL certificate problem: certificate has expired

显然,这是过期证书的问题。一旦成功完成升级(包括刷新和更新系统),
获得此类风险的风险可能会小得多。Curl error

概括

重复最初的预防性备份是谨慎的做法:

cd /etc/zypp/repos.d/ && sudo zip oss-15.4_orig.zip *.repo

在这样的升级过程中要做出哪些选择并不明显。
但看来升级大部分都有效。
cat /etc/os-release说版本是现在 openSUSE Leap 15.4

当我尝试通过 ConEmu 启动 openSUSE-15 时,我仍然会Access is denied. Press Enter or Esc to exit...时不时地遇到这种情况。我不知道这个问题是否与ConEmu有关,但是我直接从CMD.exe启动openSUSE-15时从未见过这个问题 wsl ~ -d openSUSE-155

参考


1 要查看文件的内容oss-42.2_orig.zip,请运行unzip -l oss-42.2_orig.zip.
要恢复.repo文件:
cd /etc/zypp/repos.d/ && sudo rm *.repo && sudo unzip oss-42.2_orig.zip

2 支持数据库:系统升级是我用于执行升级的最重要的参考。

3 此时,openSUSE 发行版挂起并且不响应键盘的任何输入。
当我重新启动时,它看起来如下。
-bash: /etc/profile: No such file or directory
-bash-4.4$

安装后折断 如此处所述,然后再次重新启动,那种行为离开了。
提示符再次恢复正常,如下所示:
henke@hp:~>
我不知道到底是什么修复了系统。而且我不知道如何复制这个问题。

4要在所有文件中 替换http:为,请运行:https:.repo
sudo sed -i 's/http:/https:/' /etc/zypp/repos.d/*.repo

5 如果您没有更改发行版的名称,则应将其启动为 wsl ~ -d openSUSE-42,即使发行版包含是 openSUSE 15。

相关内容