HalNiの雑記

備忘録を兼ねて。サーバマシンとかネットワークとか

openSUSE Leap のライブアップグレードは2コマンドで完了するよ ( System live upgrade )

要約

openSUSE のマイナーバージョンをライブアップグレードする場合、15.3 → 15.4 の場合

zypper --releasever=15.4 refresh
zypper --releasever=15.4 dist-upgrade

でOK!


openSUSE 13や42では、マイナーバージョンのアップグレードにライブアップグレードを選択するのは推奨されておらず、 またライブアップグレードを行う場合はリポジトリの書き換え等の作業が必要だった

しかし現在ではリポジトリを書き換えることなく、たったの2コマンドの実行だけでライブアップグレードが可能になっている
リポジトリ内のURLにreleaserverの変数を使用しているため、アップグレードの際に変数をzypperに指定してあげればよい

15.3から15.4へのアップグレードを行う場合は--releaserver=15.4、15.2から15.3への場合は--releaserver=15.3となる

リポジトリのURLにはreleaserver変数が使用されている

実際にアップグレードしてみる

halni@localhost:~> cat /etc/os-release
NAME="openSUSE Leap"
VERSION="15.3"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.3"
PRETTY_NAME="openSUSE Leap 15.3"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.3"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
halni@localhost:~> uname -r
5.3.18-150300.59.90-default
halni@localhost:~> sudo zypper --releasever=15.4 refresh
[sudo] password for root:
Warning: Enforced setting: $releasever=15.4
Retrieving repository 'Update repository of openSUSE Backports' metadata .........................................[done]
Building repository 'Update repository of openSUSE Backports' cache ..............................................[done]

...(略)...

Retrieving repository 'Update Repository (Non-Oss)' metadata .....................................................[done]
Building repository 'Update Repository (Non-Oss)' cache ..........................................................[done]
All repositories have been refreshed.
halni@localhost:~> sudo zypper --releasever=15.4 dup
Warning: Enforced setting: $releasever=15.4
Loading repository data...
Reading installed packages...
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.
Computing distribution upgrade...

The following 143 packages are going to be upgraded:

...(略)...

The following product is going to be upgraded:
  openSUSE Leap 15.3  15.3-2 -> 15.4-1

...(略)...

The following package is going to be REMOVED:
  kernel-default-base-5.3.18-150300.59.90.1.150300.18.52.1

The following package requires a system reboot:
  kernel-default-base-5.14.21-150400.24.18.1.150400.24.5.4

143 packages to upgrade, 2 to downgrade, 14 new, 1 to remove.
Overall download size: 105.1 MiB. Already cached: 0 B. After the operation, additional 23.9 MiB will be used.

    Note: System reboot required.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package branding-openSUSE-15.4.20220322-lp154.2.3.noarch              (1/159),  11.6 KiB (  1.6 KiB unpacked)
Retrieving: branding-openSUSE-15.4.20220322-lp154.2.3.noarch.rpm .................................................[done]

...(略)...

dracut: *** Creating initramfs image file '/boot/initrd-5.14.21-150400.24.18-default' done ***
Executing %posttrans scripts .....................................................................................[done]
There are running programs which still use files and libraries deleted or updated by recent upgrades. They should be restarted to benefit from the latest updates. Run 'zypper ps -s' to list these programs.

Since the last system boot core libraries or services have been updated.
Reboot is suggested to ensure that your system benefits from these updates.
halni@localhost:~> reboot

halni@localhost:~> cat /etc/os-release
NAME="openSUSE Leap"
VERSION="15.4"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.4"
PRETTY_NAME="openSUSE Leap 15.4"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.4"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Leap"
LOGO="distributor-logo-Leap"
halni@localhost:~> uname -r
5.14.21-150400.24.18-default
halni@localhost:~>

こんな感じ
15.3 から 15.4 にアップグレードされていることが分かる

ライブアップグレードを行う際、特に気にするべきこととしては

・マイナーバージョン一つづつアップグレードしてね (15.2 → 15.4 はNG )
・手動で追加したリポジトリは無理に削除する必要はないよ
・アップグレード後は再起動してね

こんなところだろうか

実際にアップグレードする場合、注意点等を以下の公式ドキュメントからよく確認することをお勧めする en.opensuse.org

★参考:fedoraの場合、dnf-plugin-system-upgrade パッケージを使用して同じく2コマンドでライブアップグレードが実行可能

$ sudo dnf system-upgrade download --releasever=38
$ sudo dnf system-upgrade reboot

DNF System Upgrade :: Fedora Docs

おわり