当前位置:   article > 正文

【Linux】Centos8删除多余内核版本_centos kernel、kernel-headers、kernel-devel卸载

centos kernel、kernel-headers、kernel-devel卸载

【Linux】Centos8删除多余内核版本

背景

Centos8系统中有两个内核版本,一个是5.4.172,另一个是4.18.0如下图:
在这里插入图片描述
比如需要删除多余的5.4.172内核。

删除步骤

-1,查看当前系统的内核版本号
使用命令:uname -r
如下:

[jn@localhost ~]$ uname -r
4.18.0-348.7.1.el8_5.x86_64
[jn@localhost ~]$
  • 1
  • 2
  • 3

-2,查找点前系统上存在的内核
使用命令:rpm -qa | grep kernel
如下:

[jn@localhost ~]$ rpm -qa | grep kernel
kernel-headers-4.18.0-348.7.1.el8_5.x86_64
kernel-4.18.0-348.7.1.el8_5.x86_64
kernel-tools-libs-4.18.0-348.7.1.el8_5.x86_64
kernel-lt-5.4.172-1.el8.elrepo.x86_64
kernel-core-4.18.0-193.el8.x86_64
kernel-lt-core-5.4.172-1.el8.elrepo.x86_64
kernel-tools-4.18.0-348.7.1.el8_5.x86_64
kernel-4.18.0-193.el8.x86_64
kernel-lt-devel-5.4.172-1.el8.elrepo.x86_64
kernel-modules-4.18.0-348.7.1.el8_5.x86_64
kernel-devel-4.18.0-348.7.1.el8_5.x86_64
kernel-core-4.18.0-348.7.1.el8_5.x86_64
kernel-lt-modules-5.4.172-1.el8.elrepo.x86_64
kernel-modules-4.18.0-193.el8.x86_64
[jn@localhost ~]$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

-3,移除多余的内核版本
使用命令:yum remove kernel-XXXXXXXXX

如下:

[jn@localhost ~]$ sudo yum remove kernel-lt-5.4.172-1.el8.elrepo.x86_64
[sudo] jn 的密码:
依赖关系解决。
=====================================================================
软件包    架构    版本    仓库    大小
=====================================================================
移除:
kernel-lt     x86_64    5.4.172-1.el8.elrepo    @elrepo-kernel    0  
清除未被使用的依赖关系:
kernel-lt-core    x86_64    5.4.172-1.el8.elrepo    @elrepo-kernel    63 M
kernel-lt-modules    x86_64    5.4.172-1.el8.elrepo    @elrepo-kernel    24 M

事务概要
====================================================================
移除  3 软件包

将会释放空间:87 M
确定吗?[y/N]: y
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                    1/1
  删除    : kernel-lt-5.4.172-1.el8.elrepo.x86_64                                                                              1/3
  删除    : kernel-lt-modules-5.4.172-1.el8.elrepo.x86_64                                                                      2/3
  运行脚本: kernel-lt-modules-5.4.172-1.el8.elrepo.x86_64                                                                      2/3
  运行脚本: kernel-lt-core-5.4.172-1.el8.elrepo.x86_64                                                                         3/3
dkms: removing: nvidia 470.94 (5.4.172-1.el8.elrepo.x86_64) (x86_64)
Module nvidia-470.94 for kernel 5.4.172-1.el8.elrepo.x86_64 (x86_64).
Before uninstall, this module version was ACTIVE on this kernel.
Removing any linked weak-modules
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/rtc/rtc-hid-sensor-time.ko.xz needs unknown symbol hid_sensor_parse_common_attributes
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/hwmon/iio_hwmon.ko.xz needs unknown symbol iio_get_channel_type
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/hwmon/iio_hwmon.ko.xz needs unknown symbol devm_iio_channel_get_all
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/hwmon/iio_hwmon.ko.xz needs unknown symbol iio_read_channel_processed
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_create_server
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_l2t_get
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_pktgl_to_skb
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_port_idx
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_best_aligned_mtu
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_register_uld
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_remove_server
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_l2t_send
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_port_viid
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_alloc_stid
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_ofld_send
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_remove_tid
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_port_chan
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_immdata_send
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_unregister_uld
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_free_stid
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/crypto/chelsio/chtls/chtls.ko.xz needs unknown symbol cxgb4_l2t_release
depmod: WARNING: /lib/modules/5.4.172-1.el8.elrepo.x86_64/kernel/drivers/hid/hid-asus.ko.xz needs unknown symbol asus_wmi_evaluate_method

nvidia.ko.xz:
- Uninstallation
   - Deleting from: /lib/modules/5.4.172-1.el8.elrepo.x86_64/extra/
- Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

nvidia-uvm.ko.xz:
- Uninstallation
   - Deleting from: /lib/modules/5.4.172-1.el8.elrepo.x86_64/extra/
- Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

nvidia-modeset.ko.xz:
- Uninstallation
   - Deleting from: /lib/modules/5.4.172-1.el8.elrepo.x86_64/extra/
- Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

nvidia-drm.ko.xz:
- Uninstallation
   - Deleting from: /lib/modules/5.4.172-1.el8.elrepo.x86_64/extra/
- Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

nvidia-peermem.ko.xz:
- Uninstallation
   - Deleting from: /lib/modules/5.4.172-1.el8.elrepo.x86_64/extra/
- Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.
depmod...

  删除    : kernel-lt-core-5.4.172-1.el8.elrepo.x86_64                                                                         3/3
警告:文件 /lib/modules/5.4.172-1.el8.elrepo.x86_64/updates:移除失败:没有那个文件或目录


  运行脚本: kernel-lt-core-5.4.172-1.el8.elrepo.x86_64                                                                         3/3
  验证    : kernel-lt-5.4.172-1.el8.elrepo.x86_64                                                                              1/3
  验证    : kernel-lt-core-5.4.172-1.el8.elrepo.x86_64                                                                         2/3
  验证    : kernel-lt-modules-5.4.172-1.el8.elrepo.x86_64                                                                      3/3
已更新安装的产品。

已移除:
  kernel-lt-5.4.172-1.el8.elrepo.x86_64  kernel-lt-core-5.4.172-1.el8.elrepo.x86_64  kernel-lt-modules-5.4.172-1.el8.elrepo.x86_64

完毕!
[hl@localhost ~]$ rpm -qa | grep kernel
kernel-headers-4.18.0-348.7.1.el8_5.x86_64
kernel-4.18.0-348.7.1.el8_5.x86_64
kernel-tools-libs-4.18.0-348.7.1.el8_5.x86_64
kernel-core-4.18.0-193.el8.x86_64
kernel-tools-4.18.0-348.7.1.el8_5.x86_64
kernel-4.18.0-193.el8.x86_64
kernel-lt-devel-5.4.172-1.el8.elrepo.x86_64
kernel-modules-4.18.0-348.7.1.el8_5.x86_64
kernel-devel-4.18.0-348.7.1.el8_5.x86_64
kernel-core-4.18.0-348.7.1.el8_5.x86_64
kernel-modules-4.18.0-193.el8.x86_64
[hl@localhost ~]$ sudo yum remove kernel-lt-devel-5.4.172-1.el8.elrepo.x86_64
依赖关系解决。
=============================================================================
软件包    架构    版本    仓库    大小
=============================================================================
移除:
kernel-lt-devel    x86_64    5.4.172-1.el8.elrepo    @elrepo-kernel    49 M


事务概要
=============================================================================
移除  1 软件包

将会释放空间:49 M
确定吗?[y/N]: y
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                    1/1
  删除    : kernel-lt-devel-5.4.172-1.el8.elrepo.x86_64                                                                        1/1
  验证    : kernel-lt-devel-5.4.172-1.el8.elrepo.x86_64                                                                        1/1
已更新安装的产品。

已移除:
  kernel-lt-devel-5.4.172-1.el8.elrepo.x86_64                                                                                      
完毕!
  • 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
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145

查询否把5.4.172内核删掉:

[jn@localhost ~]$ rpm -qa | grep kernel
kernel-headers-4.18.0-348.7.1.el8_5.x86_64
kernel-4.18.0-348.7.1.el8_5.x86_64
kernel-tools-libs-4.18.0-348.7.1.el8_5.x86_64
kernel-core-4.18.0-193.el8.x86_64
kernel-tools-4.18.0-348.7.1.el8_5.x86_64
kernel-4.18.0-193.el8.x86_64
kernel-modules-4.18.0-348.7.1.el8_5.x86_64
kernel-devel-4.18.0-348.7.1.el8_5.x86_64
kernel-core-4.18.0-348.7.1.el8_5.x86_64
kernel-modules-4.18.0-193.el8.x86_64
[jn@localhost ~]$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

如上已经删掉5.4.172内核!

-4,重启
采用如下命令重启:

$ sudo reboot
  • 1

重启之后5.4.172内核版已经消失,如下图:
在这里插入图片描述
注意:不需要再修改grub.conf文件!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/80812
推荐阅读
相关标签
  

闽ICP备14008679号