Skip to content

antony@notes:~/suse$ cat "Offline-upgrade-SLES-15-Service-Pack-from-1-to-5.md"

Offline upgrade SLES 15 Service Pack from 1 to 5

2023-09-04· suse ·SUSE Manager

Offline upgrade SLES 15 Service Pack from 1 to 5

Preface

本篇文章會採取 Step by Step 和 ScreenShot 的方式介紹,如何透過 SUSE Manager 和在 SUSE Manager Client 端執行命令的方式將 SLES 15 SP1 升級至 SLES 15 SP5

:::danger

Note: 本驗測報告僅提供 OS 15 SP1 升級至 SP5,不包含其他應用、效能與第三方套件驗證,相關驗證得依實際應用整合為準。

若遭遇相關問題得依 SUSE 認定為準。

:::

Prerequest

  • 準備一台沒有到 SCC 註冊過的 SLES 15 SP1
  • 在 SUSE Manager 上準備 SLES 15 SP1 和 SLES 15 SP5 的 Product

Step1: 透過 SLES 15 SP1 Bootstrap Script 註冊 SUSE Manager Client 端

  1. 創建用戶端倉庫

在 SUSE Manager Server 執行以下命令

$ sudo mgr-create-bootstrap-repo --create SLE-15-SP1-x86_64
  1. 創建 Activation_Key

連線至 SUSE Manager Web UI,點擊左側選單 “Activation Keys” > 點擊右上角的 “Create Key”

填入以下欄位內容

  • Description: SLE-15-SP1-x86_64
  • Key: 1-SLE-15-SP1-x86_64
  • Usage: `` (依需求設定)
  • Base Channel: 選擇 SLE-Product-SLES15-SP1-Pool for x86_64
  • Child Channels: 勾選 include recommended (依需求勾選)
  • Add-On System Types: 勾選 Virtualization Host (依環境勾選)

以上確認沒問題後,點擊 “Create Activation Key”

  1. 創建 Bootstrap Script

在 SUSE Manager Server 執行以下命令

$ sudo mgr-bootstrap --activation-key=1-SLE-15-SP1-x86_64 --script=bootstrap-SLE-15-SP1-x86_64.sh
  • --activation-key,指定 Bootstrap Script 使用的 Activation Key
  • --script,指定 Bootstrap Script 名稱,Script 會生成在 /srv/www/htdocs/pub/bootstrap/ 目錄區

螢幕輸出 :

* WARNING: if there were hand edits to the rotated (backed up) file,
           some settings may need to be migrated.
* bootstrap overrides (written):
  '/srv/www/htdocs/pub/bootstrap/client-config-overrides.txt'

Values written:
serverURL                'https://antony-suma.example.com/XMLRPC'
enableProxy              '0'
httpProxy                ''
enableProxyAuth          '0'
proxyUser                ''
proxyPassword            ''
sslCACert                '/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT'
useGPG                   1
* bootstrap script (written):
    '/srv/www/htdocs/pub/bootstrap/bootstrap-SLE-15-SP1-x86_64.sh'
  1. 執行 Bootstrap Script

在 SLES 15 SP1 機器執行以下命令

$ curl -k https://antony-suma.example.com/pub/bootstrap/bootstrap-SLE-15-SP1-x86_64.sh | sudo bash

螢幕輸出 :

...以上省略
REGISTRATION
------------
* registering
Using activation key: 1-SLE-15-SP1-x86_64
* removing TLS certificate used for bootstrap
  (will be re-added via salt state)
* starting salt daemon and enabling it during boot
Created symlink /etc/systemd/system/multi-user.target.wants/venv-salt-minion.service → /usr/lib/systemd/system/venv-salt-minion.service.
-bootstrap complete-
  1. 在 SUSE Manager Web UI 接受 Client 端

[SUSE Manager] > Salt > Keys > V,接受新的 Salt-Key 讓新用戶端系統進入 System 清單中。

  1. System OverView 檢視新註冊的 Client 端

Step2: 將 Client 端更新至最新版本

透過 Web UI 的方式更新

  1. 點擊 “sles15-sp1” 主機

  1. 點擊 “Software” > “Packages” > “Upgrade” > “Select All” > “Upgrade Packages”

  1. 點擊 “Confirm”

  1. 檢查是否更新成功

點擊 “Event” > “History”

點擊 “Package Install/Upgrade scheduled by rancher”

  • 往下滑可以看到哪些套件從哪個版本升級到哪個版本

  1. 重啟系統

在 SLES 15 SP1 機器執行以下命令

$ sudo reboot

透過 CLI 的方式更新

  1. 更新套件儲存庫
$ sudo zypper ref

螢幕輸出 :

Repository 'SLE-Manager-Tools15-Pool for x86_64 SP1' is up to date.
Repository 'SLE-Manager-Tools15-Updates for x86_64 SP1' is up to date.
Repository 'SLE-Module-Basesystem15-SP1-Pool for x86_64' is up to date.
Repository 'SLE-Module-Basesystem15-SP1-Updates for x86_64' is up to date.
Repository 'SLE-Module-Server-Applications15-SP1-Pool for x86_64' is up to date.
Repository 'SLE-Module-Server-Applications15-SP1-Updates for x86_64' is up to date.
Repository 'SLE-Product-SLES15-SP1-Pool for x86_64' is up to date.
Repository 'SLE-Product-SLES15-SP1-Updates for x86_64' is up to date.
All repositories have been refreshed.
  1. 檢視套件儲存庫
$ sudo zypper lr

螢幕輸出 :

Repository priorities are without effect. All enabled repositories share the same priority.

# | Alias                                                           | Name                                                    | Enabled | GPG Check | Refresh
--+-----------------------------------------------------------------+---------------------------------------------------------+---------+-----------+--------
1 | SLES15-SP1-15.1-0                                               | SLES15-SP1-15.1-0                                       | No      | ----      | ----
2 | susemanager:sle-manager-tools15-pool-x86_64-sp1                 | SLE-Manager-Tools15-Pool for x86_64 SP1                 | Yes     | ( p) Yes  | Yes
3 | susemanager:sle-manager-tools15-updates-x86_64-sp1              | SLE-Manager-Tools15-Updates for x86_64 SP1              | Yes     | ( p) Yes  | Yes
4 | susemanager:sle-module-basesystem15-sp1-pool-x86_64             | SLE-Module-Basesystem15-SP1-Pool for x86_64             | Yes     | ( p) Yes  | Yes
5 | susemanager:sle-module-basesystem15-sp1-updates-x86_64          | SLE-Module-Basesystem15-SP1-Updates for x86_64          | Yes     | ( p) Yes  | Yes
6 | susemanager:sle-module-server-applications15-sp1-pool-x86_64    | SLE-Module-Server-Applications15-SP1-Pool for x86_64    | Yes     | ( p) Yes  | Yes
7 | susemanager:sle-module-server-applications15-sp1-updates-x86_64 | SLE-Module-Server-Applications15-SP1-Updates for x86_64 | Yes     | ( p) Yes  | Yes
8 | susemanager:sle-product-sles15-sp1-pool-x86_64                  | SLE-Product-SLES15-SP1-Pool for x86_64                  | Yes     | ( p) Yes  | Yes
9 | susemanager:sle-product-sles15-sp1-updates-x86_64               | SLE-Product-SLES15-SP1-Updates for x86_64               | Yes     | ( p) Yes  | Yes
  1. 檢視所有可更新的套件
$ sudo zypper lu

螢幕輸出 :

Loading repository data...
Reading installed packages...
S | Repository                                     | Name                         | Current Version                 | Available Version                | Arch
--+------------------------------------------------+------------------------------+---------------------------------+----------------------------------+-------
v | SLE-Module-Basesystem15-SP1-Updates for x86_64 | SUSEConnect                  | 0.3.16-5.20                     | 0.3.32-7.25.1                    | x86_64
v | SLE-Module-Basesystem15-SP1-Updates for x86_64 | aaa_base                     | 84.87+git20180409.04c9dae-3.6.1 | 84.87+git20180409.04c9dae-3.45.1 | x86_64
v | SLE-Module-Basesystem15-SP1-Updates for x86_64 | bash                         | 4.4-9.7.1                       | 4.4-9.10.1                       | x86_64
...以下省略
  1. 測試更新
$ ZYPP_LOGFILE=/root/zypper-15sp1-test-upgrade.log sudo zypper -vv dup --details --dry-run --no-force-resolution --no-recommends --no-allow-vendor-change --no-allow-arch-change
  • --dry-run,模擬升級過程軟體安裝是否有相依性或者其他錯誤,確認模擬升級測試成功,才開始運行升級指令。

螢幕輸出 :

...以上省略
174 packages to upgrade, 7 new, 1 to remove.
Overall download size: 228.1 MiB. Already cached: 0 B. After the operation, additional 312.7 MiB will be used.

    Note: System reboot required.
Continue? [y/n/v/...? shows all options] (y): y
committing (dry run)
CommitResult  (total 181, done 0, error 0, skipped 181, updateMessages 0)

:::danger

Note:

  • 確認 error 為 0 再執行更新
  • ZYPP_LOGFILE,設定 log 檔的絕對路徑和檔名
  • 如果有錯誤的詳細資訊可以檢視 ZYPP_LOGFILE 的內容

:::

  1. 執行以下命令開始正式升級
$ ZYPP_LOGFILE=/root/zypper-15sp1-upgrade.log sudo zypper -vv dup --details --no-force-resolution --no-recommends --no-allow-vendor-change --no-allow-arch-change
  • 可以看到那些 packages 要升級\哪些會降級\哪些會新安裝\那些會移除 輸入「y」開始升級安裝

螢幕輸出 :

...以上省略
CommitResult  (total 181, done 181, error 0, skipped 0, updateMessages 0)
...
Core libraries or services have been updated.
Reboot is required to ensure that your system benefits from these updates.
  • 確認升級成功且 error 為 0
  1. 重啟系統
$ sudo reboot
  1. 檢查 OS Kernel 是否為 4.12.14-197.78-default
$ uname -r

螢幕輸出 :

4.12.14-197.78-default
  1. 再次檢查所有可更新的套件
$ zypper lu
  • 注意,此時應不會顯示有套件需要更新

螢幕輸出 :

Loading repository data
Reading installed packages
No updates found.

Step3: 移除 Client 端

在 Client 端上執行以下命令

$ for i in {1..20} ; do zypper rr 1 ; done
$ systemctl stop salt-minion.service
$ rm /etc/zypp/repos.d/susemanager\:channels.repo
$ rm -r /etc/salt/	
$ rpm -e salt salt-minion python2-salt

在 SUMA 上執行以下命令

$ sudo spacecmd system_delete FQDN
$ sudo salt-key -d FQDN

Step4: 透過 SLES 15 SP5 Bootstrap Script 註冊 SUSE Manager Client 端

  1. 創建用戶端倉庫

在 SUSE Manager Server 執行以下命令

$ sudo mgr-create-bootstrap-repo --create SLE-15-SP5-x86_64
  1. 創建 Activation_Key

連線至 SUSE Manager Web UI,點擊左側選單 “Activation Keys” > 點擊右上角的 “Create Key”

填入以下欄位內容

  • Description: SLE-15-SP5-x86_64
  • Key: 1-SLE-15-SP5-x86_64
  • Usage: `` (依需求設定)
  • Base Channel: 選擇 SLE-Product-SLES15-SP5-Pool for x86_64
  • Child Channels: 勾選 include recommended (依需求勾選)
  • Add-On System Types: 勾選 Virtualization Host (依環境勾選)

以上確認沒問題後,點擊 “Create Activation Key”

  1. 創建 Bootstrap Script

在 SUSE Manager Server 執行以下命令

$ sudo mgr-bootstrap --activation-key=1-SLE-15-SP5-x86_64 --script=bootstrap-SLE-15-SP5-x86_64.sh
  • --activation-key,指定 Bootstrap Script 使用的 Activation Key
  • --script,指定 Bootstrap Script 名稱,Script 會生成在 /srv/www/htdocs/pub/bootstrap/ 目錄區

螢幕輸出 :

* WARNING: if there were hand edits to the rotated (backed up) file,
           some settings may need to be migrated.
* bootstrap overrides (written):
  '/srv/www/htdocs/pub/bootstrap/client-config-overrides.txt'

Values written:
serverURL                'https://antony-suma.example.com/XMLRPC'
enableProxy              '0'
httpProxy                ''
enableProxyAuth          '0'
proxyUser                ''
proxyPassword            ''
sslCACert                '/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT'
useGPG                   1
* bootstrap script (written):
    '/srv/www/htdocs/pub/bootstrap/bootstrap-SLE-15-SP1-x86_64.sh'
  1. 執行 Bootstrap Script

在 SLES 15 SP1 機器執行以下命令

$ curl -k https://antony-suma.example.com/pub/bootstrap/bootstrap-SLE-15-SP5-x86_64.sh | sudo bash

螢幕輸出 :

...以上省略
REGISTRATION
------------
* registering
Using activation key: 1-SLE-15-SP5-x86_64
* removing TLS certificate used for bootstrap
  (will be re-added via salt state)
* starting salt daemon and enabling it during boot
Created symlink /etc/systemd/system/multi-user.target.wants/venv-salt-minion.service → /usr/lib/systemd/system/venv-salt-minion.service.
-bootstrap complete-
  1. 在 SUSE Manager Web UI 接受 Client 端

[SUSE Manager] > Salt > Keys > V,接受新的 Salt-Key 讓新用戶端系統進入 System 清單中。

  1. System OverView 檢視新註冊的 Client 端

    • 注意到,此時 Base Channel 以更變為 SLE-Product-SLES15-SP5-Pool for x86_64

Step5: 在 Client 端使用指令將 Service Pack 升級至 SP5

  1. 檢查 OS 和 Kernel 版本為 SLES SP1

在 Client 端執行以下命令

查看 OS 版本

$ cat /etc/os-release

螢幕輸出 :

NAME="SLES"
VERSION="15-SP1"
VERSION_ID="15.1"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP1"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp1"

查看 Kernel 版本

$ uname -r

螢幕輸出 :

4.12.14-197.78-default
  1. 檢查 Package Repository 是否為 SP5 的版本
$ zypper lr

螢幕輸出 :

Repository priorities are without effect. All enabled repositories share the same priority.

# | Alias                                                           | Name                                                    | Enabled | GPG Check | Refresh
--+-----------------------------------------------------------------+---------------------------------------------------------+---------+-----------+--------
1 | SLES15-SP1-15.1-0                                               | SLES15-SP1-15.1-0                                       | No      | ----      | ----
2 | susemanager:sle-manager-tools15-pool-x86_64-sp5                 | SLE-Manager-Tools15-Pool for x86_64 SP5                 | Yes     | ( p) Yes  | Yes
3 | susemanager:sle-manager-tools15-updates-x86_64-sp5              | SLE-Manager-Tools15-Updates for x86_64 SP5              | Yes     | ( p) Yes  | Yes
4 | susemanager:sle-module-basesystem15-sp5-pool-x86_64             | SLE-Module-Basesystem15-SP5-Pool for x86_64             | Yes     | ( p) Yes  | Yes
5 | susemanager:sle-module-basesystem15-sp5-updates-x86_64          | SLE-Module-Basesystem15-SP5-Updates for x86_64          | Yes     | ( p) Yes  | Yes
6 | susemanager:sle-module-server-applications15-sp5-pool-x86_64    | SLE-Module-Server-Applications15-SP5-Pool for x86_64    | Yes     | ( p) Yes  | Yes
7 | susemanager:sle-module-server-applications15-sp5-updates-x86_64 | SLE-Module-Server-Applications15-SP5-Updates for x86_64 | Yes     | ( p) Yes  | Yes
8 | susemanager:sle-product-sles15-sp5-pool-x86_64                  | SLE-Product-SLES15-SP5-Pool for x86_64
         | Yes     | ( p) Yes  | Yes
9 | susemanager:sle-product-sles15-sp5-updates-x86_64               | SLE-Product-SLES15-SP5-Updates for x86_64               | Yes     | ( p) Yes  | Yes
  1. 檢視所有可更新的套件
$ sudo zypper lu

螢幕輸出 :

Loading repository data...
Reading installed packages...
S | Repository                                     | Name                         | Current Version                  | Available Version                       | Arch
--+------------------------------------------------+------------------------------+----------------------------------+-----------------------------------------+-------
v | SLE-Module-Basesystem15-SP5-Pool for x86_64    | aaa_base                     | 84.87+git20180409.04c9dae-3.45.1 | 84.87+git20180409.04c9dae-150300.10.3.1 | x86_64
v | SLE-Module-Basesystem15-SP5-Pool for x86_64    | bash-completion              | 2.7-4.3.1                        | 2.7-150400.13.3.1                       | noarch
v | SLE-Module-Basesystem15-SP5-Pool for x86_64    | bash-doc                     | 4.4-9.10.1                       | 4.4-150400.25.22                        | noarch
...以下省略
  1. 執行以下命令進行升級測試
$ ZYPP_LOGFILE=/root/zypper-15sp5-test-upgrade.log sudo zypper -vv dup --details --dry-run --no-force-resolution --no-recommends --no-allow-vendor-change --no-allow-arch-change
  • --dry-run,模擬升級過程軟體安裝是否有相依性或者其他錯誤,確認模擬升級測試成功,才開始運行升級指令。

螢幕輸出 :

...以上省略
CommitResult  (total 355, done 0, error 0, skipped 355, updateMessages 0)

:::danger

Note:

  • 確認 error 為 0 再執行更新
  • ZYPP_LOGFILE,設定 log 檔的絕對路徑和檔名
  • 如果有錯誤的詳細資訊可以檢視 ZYPP_LOGFILE 的內容

:::

  1. 執行以下命令開始正式升級
$ ZYPP_LOGFILE=/root/zypper-15sp5-upgrade.log sudo zypper -vv dup --details --no-force-resolution --no-recommends --no-allow-vendor-change --no-allow-arch-change

螢幕輸出 :

  • 可以看到那些 packages 要升級\哪些會降級\哪些會新安裝\那些會移除 輸入「y」開始升級安裝

螢幕輸出 :

...以上省略
CommitResult  (total 335, done 335, error 0, skipped 0, updateMessages 0)
...
Core libraries or services have been updated.
Reboot is required to ensure that your system benefits from these updates.
  1. 重啟系統
$ sudo reboot
  1. 檢查 OS 和 Kernel 版本是否更新成功

查看 OS 版本

$ cat /etc/os-release

螢幕輸出 :

NAME="SLES"
VERSION="15-SP5"
VERSION_ID="15.5"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP5"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp5"
DOCUMENTATION_URL="https://documentation.suse.com/"

查看 Kernel 版本

$ uname -r

螢幕輸出 :

5.14.21-150500.55.19-default
  1. 在 SUSE Manager Web UI 上檢視