【SUSE Linux kernel版本升级】SUSE Linux Enterprise Server 12 SP5

作者:美云 发布日期:2024/6/5 13:16:09 浏览次数:1156 复制

安装完SUSE Linux操作系统后,正常会将SUSE Linux的kernel升级至最新版本。

本次实验环境是SUSE Linux Enterprise Server 12 SP5:

​cat /etc/*-release​

SAPTEST:~ # cat /etc/*-release
SUSE Linux Enterprise Server 12 (x86_64)
VERSION = 12
PATCHLEVEL = 5
# This file is deprecated and will be removed in a future service pack or release.
# Please check /etc/os-release for details about this release.
NAME="SLES"
VERSION="12-SP5"
VERSION_ID="12.5"
PRETTY_NAME="SUSE Linux Enterprise Server 12 SP5"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles_sap:12:sp5"
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
操作系统安装后,kernel的初始版本是4.12.14-120-default:

​uname -a​

SAPTEST:~ # uname -a
Linux SAPTEST 4.12.14-120-default #1 SMP Thu Nov 7 16:39:09 UTC 2019 (fd9dc36) x86_64 x86_64 x86_64 GNU/Linux
1.
2.


升级SUSE kernel有两种方式,方式一是通过配置zypper源并使用zypper命令来升级kernel至最新版本,方式二是手工下载最新版本的kernel文件并升级kernel版本。方式一可以自动升级软件包及相关联的软件包。

​kernel升级方式一:通过zypper命令升级​

​zypper update kernel​

SAPTEST:~ # zypper update kernel
Loading repository data...
Reading installed packages...
'kernel' not found in package names. Trying capabilities.
Resolving package dependencies...

Nothing to do.
1.
2.
3.
4.
5.
6.
7.
以上结果是因为未配置zypper源,故通过zyyper命令无法升级SUSE kernel版本。

​kernel升级方式二:手工下载kernel文件并升级​

手工下载kernel文件之前,需要先确认需要下载哪些kernel包以及当前kernel包的版本:

​rpm -qa|grep kernel​

SAPTEST:/sapcd/SUSE12SP5 # rpm -qa|grep kernel
kernel-default-devel-4.12.14-120.1.x86_64
kernel-macros-4.12.14-120.1.noarch
kernel-default-4.12.14-120.1.x86_64
kernel-devel-4.12.14-120.1.noarch
kernel-source-4.12.14-120.1.noarch
nfs-kernel-server-1.3.0-34.18.1.x86_64
kernel-firmware-20190618-5.11.1.noarch
1.
2.
3.
4.
5.
6.
7.
8.
通过网址​ ​https://scc.suse.com​​登录SUSE Customer Center并下载kernel包:

 

将下载的kernel包放入同一个目录/sapcd/SUSE12SP5底下:

SAPTEST:/sapcd/SUSE12SP5 # ls -l
total 218716
-rwxrwxrwx 1 root root  56229932 Mar 21 16:29 kernel-default-4.12.14-122.113.1.x86_64.rpm
-rwxrwxrwx 1 root root   9894850 Mar 21 16:29 kernel-default-devel-4.12.14-122.113.1.x86_64.rpm
-rwxrwxrwx 1 root root  20808345 Mar 21 16:29 kernel-devel-4.12.14-122.113.1.noarch.rpm
-rwxrwxrwx 1 root root   7289636 Mar 21 16:29 kernel-macros-4.12.14-122.113.1.noarch.rpm
-rwxrwxrwx 1 root root 127765484 Mar 21 16:29 kernel-source-4.12.14-122.113.1.noarch.rpm
1.
2.
3.
4.
5.
6.
7.
升级SUSE Linux kenel:

​rpm -Uvh kernel*​

SAPTEST:/sapcd/SUSE12SP5 # rpm -Uvh kernel*
error: Failed dependencies:
        suse-kernel-rpm-scriptlets is needed by kernel-default-4.12.14-122.113.1.x86_64
1.
2.
3.
升级kernel出现报错suse-kernel-rpm-scriptlets is needed by kernel-default-4.12.14-122.113.1.x86_64,这是因为kernel-default包的关联包suse-module-tools也需要同步升级,否则将升级失败。

先确认当前suse-module-tools包的版本:

​rpm -qa|grep suse-module-tools​

SAPTEST:/sapcd/SUSE12SP5 # rpm -qa|grep suse-module-tools
suse-module-tools-12.7-1.6.x86_64
1.
2.
下载suse-module-tools包并放入同一个目录/sapcd/SUSE12SP5底下:

SAPTEST:/sapcd/SUSE12SP5 # ls -l
total 218760
-rwxrwxrwx 1 root root  56229932 Mar 22 10:20 kernel-default-4.12.14-122.113.1.x86_64.rpm
-rwxrwxrwx 1 root root   9894850 Mar 22 10:20 kernel-default-devel-4.12.14-122.113.1.x86_64.rpm
-rwxrwxrwx 1 root root  20808345 Mar 22 10:20 kernel-devel-4.12.14-122.113.1.noarch.rpm
-rwxrwxrwx 1 root root   7289636 Mar 22 10:20 kernel-macros-4.12.14-122.113.1.noarch.rpm
-rwxrwxrwx 1 root root 127765484 Mar 22 10:20 kernel-source-4.12.14-122.113.1.noarch.rpm
-rwxrwxrwx 1 root root     44826 Mar 22 10:19 suse-module-tools-12.11-3.8.1.x86_64.rpm
1.
2.
3.
4.
5.
6.
7.
8.
同时升级kernel包和suse-module-tools包:

​rpm -Uvh kernel* suse-module-tools*​

SAPTEST:/sapcd/SUSE12SP5 # rpm -Uvh kernel* suse-module-tools*
Preparing...                          ################################# [100%]
Updating / installing...
   1:suse-module-tools-12.11-3.8.1    ################################# [  8%]
   2:kernel-macros-4.12.14-122.113.1  ################################# [ 17%]
   3:kernel-devel-4.12.14-122.113.1   ################################# [ 25%]
Changing symlink /usr/src/linux from linux-4.12.14-120 to linux-4.12.14-122.113
   4:kernel-default-devel-4.12.14-122.################################# [ 33%]
Changing symlink /usr/src/linux-obj/x86_64/default from ../../linux-4.12.14-120-obj/x86_64/default to ../../linux-4.12.14-122.113-obj/x86_64/default
   5:kernel-source-4.12.14-122.113.1  ################################# [ 42%]
   6:kernel-default-4.12.14-122.113.1 ################################# [ 50%]
Creating initrd: /boot/initrd-4.12.14-122.113-default
dracut: Executing: /usr/bin/dracut --logfile /var/log/YaST2/mkinitrd.log --force /boot/initrd-4.12.14-122.113-default 4.12.14-122.113-default
dracut: *** Including module: bash ***
dracut: *** Including module: systemd ***
dracut: *** Including module: warpclock ***
dracut: *** Including module: systemd-initrd ***
dracut: *** Including module: i18n ***
dracut: *** Including module: drm ***
dracut: *** Including module: plymouth ***
dracut: *** Including module: dm ***
dracut: Skipping udev rule: 64-device-mapper.rules
dracut: Skipping udev rule: 60-persistent-storage-dm.rules
dracut: Skipping udev rule: 55-dm.rules
dracut: *** Including module: kernel-modules ***
dracut: *** Including module: lvm ***
dracut: Skipping udev rule: 64-device-mapper.rules
dracut: Skipping udev rule: 56-lvm.rules
dracut: Skipping udev rule: 60-persistent-storage-lvm.rules
dracut: *** Including module: resume ***
dracut: *** Including module: rootfs-block ***
dracut: *** Including module: suse-btrfs ***
dracut: *** Including module: suse-xfs ***
dracut: *** Including module: terminfo ***
dracut: *** Including module: udev-rules ***
dracut: Skipping udev rule: 40-redhat.rules
dracut: Skipping udev rule: 50-firmware.rules
dracut: Skipping udev rule: 50-udev.rules
dracut: Skipping udev rule: 91-permissions.rules
dracut: Skipping udev rule: 80-drivers-modprobe.rules
dracut: *** Including module: dracut-systemd ***
dracut: *** Including module: haveged ***
dracut: *** Including module: usrmount ***
dracut: *** Including module: base ***
dracut: *** Including module: fs-lib ***
dracut: *** Including module: shutdown ***
dracut: *** Including module: suse ***
dracut: *** Including modules done ***
dracut: *** Installing kernel module dependencies and firmware ***
dracut: *** Installing kernel module dependencies and firmware done ***
dracut: *** Resolving executable dependencies ***
dracut: *** Resolving executable dependencies done***
dracut: *** Hardlinking files ***
dracut: *** Hardlinking files done ***
dracut: *** Stripping files ***
dracut: *** Stripping files done ***
dracut: *** Generating early-microcode cpio image ***
dracut: *** Constructing GenuineIntel.bin ****
dracut: *** Store current command line parameters ***
dracut: Stored kernel commandline:
dracut:  rd.lvm.lv=system/swap
 rd.lvm.lv=system/root
dracut:  resume=/dev/mapper/system-swap
dracut:  root=/dev/mapper/system-root rootfstype=xfs rootflags=rw,relatime,attr2,inode64,noquota
dracut: *** Creating image file '/boot/initrd-4.12.14-122.113-default' ***
dracut: *** Creating initramfs image file '/boot/initrd-4.12.14-122.113-default' done ***
Cleaning up / removing...
   7:kernel-source-4.12.14-120.1      ################################# [ 58%]
   8:kernel-default-devel-4.12.14-120.################################# [ 67%]
   9:kernel-devel-4.12.14-120.1       ################################# [ 75%]
  10:kernel-default-4.12.14-120.1     ################################# [ 83%]
  11:suse-module-tools-12.7-1.6       ################################# [ 92%]
  12:kernel-macros-4.12.14-120.1      ################################# [100%]
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
查看升级后的kernel版本和suse-module-tools版本:

​rpm -qa|grep kernel​

SAPTEST:~ # rpm -qa|grep kernel
kernel-source-4.12.14-122.113.1.noarch
kernel-macros-4.12.14-122.113.1.noarch
kernel-default-devel-4.12.14-122.113.1.x86_64
kernel-default-4.12.14-122.113.1.x86_64
kernel-devel-4.12.14-122.113.1.noarch
nfs-kernel-server-1.3.0-34.18.1.x86_64
kernel-firmware-20190618-5.11.1.noarch
1.
2.
3.
4.
5.
6.
7.
8.
​rpm -qa|grep suse-module-tools​

SAPTEST:~ # rpm -qa|grep suse-module-tools
suse-module-tools-12.11-3.8.1.x86_64
1.
2.
重启操作系统使最新版本的SUSE Linux kernel生效:

​uname -a​

​reboot​

SAPTEST:~ # uname -a
Linux AMERT73T01 4.12.14-120-default #1 SMP Thu Nov 7 16:39:09 UTC 2019 (fd9dc36) x86_64 x86_64 x86_64 GNU/Linux
SAPTEST:~ # reboot
SAPTEST:~ # uname -a
Linux AMERT73T01 4.12.14-122.113-default #1 SMP Tue Mar 1 11:43:17 UTC 2022 (fe89a8c) x86_64 x86_64 x
/5134212