刪除最新的(不是舊的) 核心條目(升級)CentOS
我之前升級了我的 CentOS 安裝…
現在,我想刪除一些以前的安裝
[root@centos /]# ls -al /boot/loader/entries total 36 drwx------. 2 root root 4096 Jun 13 10:32 . drwxr-xr-x. 3 root root 4096 Jul 5 2020 .. -rw-r--r--. 1 root root 395 Jul 5 2020 fb78af0a9247484aad9831a10a928084-0-rescue.conf -rw-r--r--. 1 root root 358 Jun 11 11:36 fb78af0a9247484aad9831a10a928084-4.18.0-193.14.2.el8_2.x86_64.conf -rw-r--r--. 1 root root 353 Jul 5 2020 fb78af0a9247484aad9831a10a928084-4.18.0-193.6.3.el8_2.x86_64.conf -rw-r--r--. 1 root root 464 Jun 13 10:32 fb78af0a9247484aad9831a10a928084-4.18.0-305.3.1.el8.x86_64.conf -rw-r--r--. 1 root root 494 Jun 12 23:57 fb78af0a9247484aad9831a10a928084-5.12.10-1.el8.elrepo.x86_64.conf -rw-r--r--. 1 root root 356 Jul 15 2020 fb78af0a9247484aad9831a10a928084-5.7.8-1.el8.elrepo.x86_64.conf -rw-r--r--. 1 root root 356 Aug 11 2020 fb78af0a9247484aad9831a10a928084-5.8.0-1.el8.elrepo.x86_64.conf [root@centos /]#
ls -al /lib/modules
[root@centos /]# ls -al /lib/modules total 40 drwxr-xr-x. 10 root root 4096 Jun 11 13:56 . dr-xr-xr-x. 46 root root 4096 Nov 3 2020 .. drwxr-xr-x. 6 root root 4096 Jun 11 13:57 4.18.0-193.14.2.el8_2.x86_64 drwxr-xr-x. 6 root root 4096 Jun 11 13:57 4.18.0-193.6.3.el8_2.x86_64 drwxr-xr-x. 3 root root 4096 Jun 11 13:43 4.18.0-294.el8.x86_64 drwxr-xr-x. 7 root root 4096 Sep 10 07:41 4.18.0-305.3.1.el8.x86_64 drwxr-xr-x. 3 root root 4096 Jun 11 13:50 4.18.0-305.el8.x86_64 drwxr-xr-x. 6 root root 4096 Jun 11 13:57 5.12.10-1.el8.elrepo.x86_64 drwxr-xr-x. 7 root root 4096 Jun 11 13:57 5.7.8-1.el8.elrepo.x86_64 drwxr-xr-x. 6 root root 4096 Jun 11 13:58 5.8.0-1.el8.elrepo.x86_64 [root@centos /]#
ls -al /boot
[root@centos /]# ls -al /boot total 496740 dr-xr-xr-x. 7 root root 4096 Jun 12 23:21 . dr-xr-xr-x. 19 root root 4096 Jun 20 10:32 .. -rw-r--r--. 1 root root 187644 Jul 25 2020 config-4.18.0-193.14.2.el8_2.x86_64 -rw-r--r--. 1 root root 187643 Jun 10 2020 config-4.18.0-193.6.3.el8_2.x86_64 -rw-r--r--. 1 root root 192095 Jun 1 11:22 config-4.18.0-305.3.1.el8.x86_64 -rw-r--r--. 1 root root 209768 Jun 9 15:39 config-5.12.10-1.el8.elrepo.x86_64 -rw-r--r--. 1 root root 197087 Jul 7 2020 config-5.7.8-1.el8.elrepo.x86_64 -rw-r--r--. 1 root root 201589 Aug 2 2020 config-5.8.0-1.el8.elrepo.x86_64 drwx------. 4 root root 4096 Dec 31 1969 efi drwx------. 2 root root 4096 Jun 13 11:31 grub2 -rw-------. 1 root root 71713525 Jul 5 2020 initramfs-0-rescue-fb78af0a9247484aad9831a10a928084.img -rw-------. 1 root root 50305162 Jun 11 13:59 initramfs-4.18.0-193.14.2.el8_2.x86_64.img -rw-------. 1 root root 50307138 Jun 11 13:53 initramfs-4.18.0-193.6.3.el8_2.x86_64.img -rw-------. 1 root root 18642820 Jul 5 2020 initramfs-4.18.0-193.6.3.el8_2.x86_64kdump.img -rw-------. 1 root root 51341661 Jun 11 13:58 initramfs-4.18.0-305.3.1.el8.x86_64.img -rw-------. 1 root root 22841790 Jun 12 23:21 initramfs-4.18.0-305.3.1.el8.x86_64kdump.img -rw-------. 1 root root 51525393 Jun 11 13:51 initramfs-5.12.10-1.el8.elrepo.x86_64.img -rw-------. 1 root root 50966520 Jun 11 13:51 initramfs-5.7.8-1.el8.elrepo.x86_64.img -rw-------. 1 root root 50990920 Jun 11 13:51 initramfs-5.8.0-1.el8.elrepo.x86_64.img drwxr-xr-x. 3 root root 4096 Jul 5 2020 loader drwx------. 2 root root 16384 Jul 5 2020 lost+found -rw-------. 1 root root 3910607 Jul 25 2020 System.map-4.18.0-193.14.2.el8_2.x86_64 -rw-------. 1 root root 3910484 Jun 10 2020 System.map-4.18.0-193.6.3.el8_2.x86_64 -rw-------. 1 root root 4164308 Jun 1 11:22 System.map-4.18.0-305.3.1.el8.x86_64 -rw-------. 1 root root 5019372 Jun 9 15:39 System.map-5.12.10-1.el8.elrepo.x86_64 -rw-------. 1 root root 4654688 Jul 7 2020 System.map-5.7.8-1.el8.elrepo.x86_64 -rw-------. 1 root root 4714527 Aug 2 2020 System.map-5.8.0-1.el8.elrepo.x86_64 drwxrwxrwx. 2 nobody nobody 4096 Sep 6 2020 'System Volume Information' -rwxr-xr-x. 1 root root 8106744 Jul 5 2020 vmlinuz-0-rescue-fb78af0a9247484aad9831a10a928084 -rwxr-xr-x. 1 root root 8920200 Jul 25 2020 vmlinuz-4.18.0-193.14.2.el8_2.x86_64 -rw-r--r--. 1 root root 173 Jul 25 2020 .vmlinuz-4.18.0-193.14.2.el8_2.x86_64.hmac -rwxr-xr-x. 1 root root 8913656 Jun 10 2020 vmlinuz-4.18.0-193.6.3.el8_2.x86_64 -rw-r--r--. 1 root root 172 Jun 10 2020 .vmlinuz-4.18.0-193.6.3.el8_2.x86_64.hmac -rwxr-xr-x. 1 root root 10026120 Jun 1 11:22 vmlinuz-4.18.0-305.3.1.el8.x86_64 -rw-r--r--. 1 root root 170 Jun 1 11:22 .vmlinuz-4.18.0-305.3.1.el8.x86_64.hmac -rwxr-xr-x. 1 root root 9099232 Jun 9 15:39 vmlinuz-5.12.10-1.el8.elrepo.x86_64 -rwxr-xr-x. 1 root root 8558528 Jul 7 2020 vmlinuz-5.7.8-1.el8.elrepo.x86_64 -rwxr-xr-x. 1 root root 8742176 Aug 2 2020 vmlinuz-5.8.0-1.el8.elrepo.x86_64 [root@centos /]#
為了刪除我以前或特定升級/更新的文件的包/配置的所有資訊,我需要執行哪些步驟?
例如:我想要所有數據(不留痕跡)
[root@centos /]# cat /boot/loader/entries/fb78af0a9247484aad9831a10a928084-5.12.10-1.el8.elrepo.x86_64.conf title Red Hat Enterprise Linux (5.12.10-1.el8.elrepo.x86_64) 8.4 (Ootpa) version 5.12.10-1.el8.elrepo.x86_64 linux /vmlinuz-5.12.10-1.el8.elrepo.x86_64 initrd /initramfs-5.12.10-1.el8.elrepo.x86_64.img $tuned_initrd options root=UUID=54f24598-4a21-4875-bacd-61c060de891f ro crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet $tuned_params amd_iommu=on id rhel-20210609203943-5.12.10-1.el8.elrepo.x86_64 grub_users $grub_users grub_arg --unrestricted grub_class kernel [root@centos /]#
我想刪除這些條目:
- vmlinuz-5.12.10-1.el8.elrepo.x86_64
- vmlinuz-5.7.8-1.el8.elrepo.x86_64
- vmlinuz-5.8.0-1.el8.elrepo.x86_64
提前致謝!
檢查這篇文章,只說刪除舊 核心
- https://hamkarchan.com/2021/07/09/how-to-delete-old-unused-kernels-on-centos-8/
- https://www.techiechacha.com/how-to-remove-old-and-unused-kernels-in-rhel-5-6-7-8/
- https://www.if-not-true-then-false.com/2012/delete-remove-old-kernels-on-fedora-centos-red-hat-rhel/
我正在使用馬厩
Kernel
[root@centos /]# uname -r 4.18.0-305.3.1.el8.x86_64 [root@centos /]#
使用其他命令
rpm -q kernel
[root@centos /]# rpm -q kernel kernel-4.18.0-193.6.3.el8_2.x86_64 kernel-4.18.0-193.14.2.el8_2.x86_64 kernel-4.18.0-305.3.1.el8.x86_64 [root@centos /]#
使用其他命令
rpm -q kernel-ml
[root@centos /]# rpm -q kernel-ml kernel-ml-5.7.8-1.el8.elrepo.x86_64 kernel-ml-5.8.0-1.el8.elrepo.x86_64 kernel-ml-5.12.10-1.el8.elrepo.x86_64 [root@centos /]# [root@centos /]# cat /etc/dnf/dnf.conf [main] gpgcheck=1 installonly_limit=3 clean_requirements_on_remove=True best=True skip_if_unavailable=False [root@centos /]#
如您所見,我不想刪除舊的,否則是最新的或最近的核心。
閱讀這篇文章https://www.cyberciti.biz/faq/debian-redhat-linux-delete-kernel-command/
地位:
[root@centos /]# df -H Filesystem Size Used Avail Use% Mounted on devtmpfs 8.2G 0 8.2G 0% /dev tmpfs 8.2G 260M 7.9G 4% /dev/shm tmpfs 8.2G 11M 8.2G 1% /run tmpfs 8.2G 0 8.2G 0% /sys/fs/cgroup /dev/nvme0n1p9 34G 9.4G 23G 30% / /dev/nvme0n1p7 1.1G 512M 442M 54% /boot /dev/nvme0n1p10 26G 11G 13G 46% /var /dev/nvme0n1p8 183G 73G 102G 42% /home /dev/nvme0n1p6 1.1G 7.6M 1.1G 1% /boot/efi /dev/loop0 66M 66M 0 100% /var/lib/snapd/snap/gtk-common-themes/1506 /dev/loop1 59M 59M 0 100% /var/lib/snapd/snap/core18/2074 /dev/loop2 32M 32M 0 100% /var/lib/snapd/snap/snapd/8542 /dev/loop3 58M 58M 0 100% /var/lib/snapd/snap/core18/1880 /dev/loop4 65M 65M 0 100% /var/lib/snapd/snap/core20/1081 /dev/loop5 34M 34M 0 100% /var/lib/snapd/snap/snapd/12398 /dev/loop6 102M 102M 0 100% /var/lib/snapd/snap/core/9665 /dev/loop7 105M 105M 0 100% /var/lib/snapd/snap/core/11316 /dev/loop8 69M 69M 0 100% /var/lib/snapd/snap/gtk-common-themes/1515 tmpfs 1.7G 8.4M 1.7G 1% /run/user/1000 [root@centos /]#
特別是
[root@centos /]# df -H / Filesystem Size Used Avail Use% Mounted on /dev/nvme0n1p9 34G 9.4G 23G 30% / [root@centos /]#
使用此命令列出
dnf list --installed kernel
[root@centos /]# dnf list --installed kernel Installed Packages kernel.x86_64 4.18.0-193.6.3.el8_2 @BaseOS kernel.x86_64 4.18.0-193.14.2.el8_2 @BaseOS kernel.x86_64 4.18.0-305.3.1.el8 @BaseOS [root@centos /]#
使用此命令列出
dnf list --installed kernel-ml
[root@centos /]# dnf list --installed kernel-ml Installed Packages kernel-ml.x86_64 5.7.8-1.el8.elrepo @elrepo-kernel kernel-ml.x86_64 5.8.0-1.el8.elrepo @elrepo-kernel kernel-ml.x86_64 5.12.10-1.el8.elrepo @elrepo-kernel [root@centos /]#
或者
[root@centos /]# dnf list installed kernel-* Installed Packages kernel-core.x86_64 4.18.0-193.6.3.el8_2 @BaseOS kernel-core.x86_64 4.18.0-193.14.2.el8_2 @BaseOS kernel-core.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-devel.x86_64 4.18.0-193.6.3.el8_2 @BaseOS kernel-devel.x86_64 4.18.0-193.14.2.el8_2 @BaseOS kernel-devel.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-headers.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-ml.x86_64 5.7.8-1.el8.elrepo @elrepo-kernel kernel-ml.x86_64 5.8.0-1.el8.elrepo @elrepo-kernel kernel-ml.x86_64 5.12.10-1.el8.elrepo @elrepo-kernel kernel-ml-core.x86_64 5.7.8-1.el8.elrepo @elrepo-kernel kernel-ml-core.x86_64 5.8.0-1.el8.elrepo @elrepo-kernel kernel-ml-core.x86_64 5.12.10-1.el8.elrepo @elrepo-kernel kernel-ml-devel.x86_64 5.7.8-1.el8.elrepo @elrepo-kernel kernel-ml-modules.x86_64 5.7.8-1.el8.elrepo @elrepo-kernel kernel-ml-modules.x86_64 5.8.0-1.el8.elrepo @elrepo-kernel kernel-ml-modules.x86_64 5.12.10-1.el8.elrepo @elrepo-kernel kernel-modules.x86_64 4.18.0-193.6.3.el8_2 @BaseOS kernel-modules.x86_64 4.18.0-193.14.2.el8_2 @BaseOS kernel-modules.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-tools.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-tools-libs.x86_64 4.18.0-305.3.1.el8 @BaseOS [root@centos /]#
我不確定這個解決方案 https://unix.stackexchange.com/a/600563/400726
謝謝
列出包
dnf list installed kernel*
[root@centos /]# dnf list installed kernel* Installed Packages kernel-core.x86_64 4.18.0-193.6.3.el8_2 @BaseOS kernel-core.x86_64 4.18.0-193.14.2.el8_2 @BaseOS kernel-core.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-devel.x86_64 4.18.0-193.6.3.el8_2 @BaseOS kernel-devel.x86_64 4.18.0-193.14.2.el8_2 @BaseOS kernel-devel.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-headers.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-ml.x86_64 5.7.8-1.el8.elrepo @elrepo-kernel kernel-ml.x86_64 5.8.0-1.el8.elrepo @elrepo-kernel kernel-ml.x86_64 5.12.10-1.el8.elrepo @elrepo-kernel kernel-ml-core.x86_64 5.7.8-1.el8.elrepo @elrepo-kernel kernel-ml-core.x86_64 5.8.0-1.el8.elrepo @elrepo-kernel kernel-ml-core.x86_64 5.12.10-1.el8.elrepo @elrepo-kernel kernel-ml-devel.x86_64 5.7.8-1.el8.elrepo @elrepo-kernel kernel-ml-modules.x86_64 5.7.8-1.el8.elrepo @elrepo-kernel kernel-ml-modules.x86_64 5.8.0-1.el8.elrepo @elrepo-kernel kernel-ml-modules.x86_64 5.12.10-1.el8.elrepo @elrepo-kernel kernel-modules.x86_64 4.18.0-193.6.3.el8_2 @BaseOS kernel-modules.x86_64 4.18.0-193.14.2.el8_2 @BaseOS kernel-modules.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-tools.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-tools-libs.x86_64 4.18.0-305.3.1.el8 @BaseOS [root@centos /]#
搜尋核心包
rpm -qa | grep kernel
[root@centos /]# rpm -qa | grep kernel kernel-core-4.18.0-305.3.1.el8.x86_64 kernel-core-4.18.0-193.6.3.el8_2.x86_64 kernel-core-4.18.0-193.14.2.el8_2.x86_64 kernel-tools-libs-4.18.0-305.3.1.el8.x86_64 kernel-ml-core-5.12.10-1.el8.elrepo.x86_64 kernel-ml-modules-5.7.8-1.el8.elrepo.x86_64 kernel-ml-5.12.10-1.el8.elrepo.x86_64 kernel-modules-4.18.0-193.6.3.el8_2.x86_64 kernel-ml-core-5.8.0-1.el8.elrepo.x86_64 kernel-ml-core-5.7.8-1.el8.elrepo.x86_64 kernel-4.18.0-193.14.2.el8_2.x86_64 kernel-devel-4.18.0-305.3.1.el8.x86_64 kernel-ml-5.8.0-1.el8.elrepo.x86_64 kernel-4.18.0-193.6.3.el8_2.x86_64 kernel-modules-4.18.0-193.14.2.el8_2.x86_64 kernel-devel-4.18.0-193.14.2.el8_2.x86_64 kernel-ml-devel-5.7.8-1.el8.elrepo.x86_64 kernel-headers-4.18.0-305.3.1.el8.x86_64 kernel-4.18.0-305.3.1.el8.x86_64 kernel-tools-4.18.0-305.3.1.el8.x86_64 kernel-ml-5.7.8-1.el8.elrepo.x86_64 kernel-ml-modules-5.8.0-1.el8.elrepo.x86_64 kernel-modules-4.18.0-305.3.1.el8.x86_64 kernel-ml-modules-5.12.10-1.el8.elrepo.x86_64 kernel-devel-4.18.0-193.6.3.el8_2.x86_64
$$ root@centos / $$# 對包進行分類以查看包的目標!
kernel-4.18.0-193.6.3.el8_2.x86_64 kernel-4.18.0-193.14.2.el8_2.x86_64 kernel-4.18.0-305.3.1.el8.x86_64 kernel-ml-5.7.8-1.el8.elrepo.x86_64 kernel-ml-5.8.0-1.el8.elrepo.x86_64 kernel-ml-5.12.10-1.el8.elrepo.x86_64 kernel-core-4.18.0-193.6.3.el8_2.x86_64 kernel-core-4.18.0-193.14.2.el8_2.x86_64 kernel-core-4.18.0-305.3.1.el8.x86_64 kernel-ml-core-5.7.8-1.el8.elrepo.x86_64 kernel-ml-core-5.8.0-1.el8.elrepo.x86_64 kernel-ml-core-5.12.10-1.el8.elrepo.x86_64 kernel-devel-4.18.0-193.14.2.el8_2.x86_64 kernel-devel-4.18.0-193.6.3.el8_2.x86_64 kernel-ml-devel-5.7.8-1.el8.elrepo.x86_64 kernel-modules-4.18.0-193.6.3.el8_2.x86_64 kernel-modules-4.18.0-193.14.2.el8_2.x86_64 kernel-modules-4.18.0-305.3.1.el8.x86_64 kernel-ml-modules-5.7.8-1.el8.elrepo.x86_64 kernel-ml-modules-5.8.0-1.el8.elrepo.x86_64 kernel-ml-modules-5.12.10-1.el8.elrepo.x86_64 kernel-tools-libs-4.18.0-305.3.1.el8.x86_64 kernel-headers-4.18.0-305.3.1.el8.x86_64 kernel-tools-4.18.0-305.3.1.el8.x86_64
如果我對刪除
5.7.8
版本感興趣;我需要做類似的事情:dnf remove kernel-ml-5.7.8-1.el8.elrepo.x86_64 dnf remove kernel-ml-core-5.7.8-1.el8.elrepo.x86_64 dnf remove kernel-ml-devel-5.7.8-1.el8.elrepo.x86_64 dnf remove kernel-ml-modules-5.7.8-1.el8.elrepo.x86_64
快速選擇
5.7.8
要刪除的相關包的方法:rpm -qa | grep ^kernel | grep 5\.7\.8
[root@centos /]# rpm -qa | grep ^kernel | grep 5\.7\.8 kernel-ml-modules-5.7.8-1.el8.elrepo.x86_64 kernel-ml-core-5.7.8-1.el8.elrepo.x86_64 kernel-ml-devel-5.7.8-1.el8.elrepo.x86_64 kernel-ml-5.7.8-1.el8.elrepo.x86_64 [root@centos /]#
然後
dnf remove $(rpm -qa | grep ^kernel | grep 5\.7\.8)
將刪除我需要的所有內容![root@centos /]# dnf remove $(rpm -qa | grep ^kernel | grep 5\.7\.8) Dependencies resolved. ================================================================================= Package Arch Version Repository Size ================================================================================= Removing: kernel-ml x86_64 5.7.8-1.el8.elrepo @elrepo-kernel 0 kernel-ml-core x86_64 5.7.8-1.el8.elrepo @elrepo-kernel 64 M kernel-ml-devel x86_64 5.7.8-1.el8.elrepo @elrepo-kernel 50 M kernel-ml-modules x86_64 5.7.8-1.el8.elrepo @elrepo-kernel 23 M Transaction Summary ================================================================================= Remove 4 Packages Freed space: 137 M Is this ok [y/N]: y Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Erasing : kernel-ml-5.7.8-1.el8.elrepo.x86_64 1/4 Erasing : kernel-ml-devel-5.7.8-1.el8.elrepo.x86_64 2/4 Erasing : kernel-ml-modules-5.7.8-1.el8.elrepo.x86_64 3/4 Running scriptlet: kernel-ml-modules-5.7.8-1.el8.elrepo.x86_64 3/4 Running scriptlet: kernel-ml-core-5.7.8-1.el8.elrepo.x86_64 4/4 Erasing : kernel-ml-core-5.7.8-1.el8.elrepo.x86_64 4/4 warning: file /lib/modules/5.7.8-1.el8.elrepo.x86_64/updates: remove failed: No such file or directory Running scriptlet: kernel-ml-core-5.7.8-1.el8.elrepo.x86_64 4/4 /sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.12.10-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored /sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.8.0-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored Verifying : kernel-ml-5.7.8-1.el8.elrepo.x86_64 1/4 Verifying : kernel-ml-core-5.7.8-1.el8.elrepo.x86_64 2/4 Verifying : kernel-ml-devel-5.7.8-1.el8.elrepo.x86_64 3/4 Verifying : kernel-ml-modules-5.7.8-1.el8.elrepo.x86_64 4/4 Installed products updated. Removed: kernel-ml-5.7.8-1.el8.elrepo.x86_64 kernel-ml-core-5.7.8-1.el8.elrepo.x86_64 kernel-ml-devel-5.7.8-1.el8.elrepo.x86_64 kernel-ml-modules-5.7.8-1.el8.elrepo.x86_64 Complete! [root@centos /]#
就這樣!
我得到後:
df -H /
[root@centos /]# df -H / Filesystem Size Used Avail Use% Mounted on /dev/nvme0n1p9 34G 9.2G 23G 29% / [root@centos /]#
和
df -H
[root@centos /]# df -H Filesystem Size Used Avail Use% Mounted on devtmpfs 8.2G 0 8.2G 0% /dev tmpfs 8.2G 529M 7.7G 7% /dev/shm tmpfs 8.2G 11M 8.2G 1% /run tmpfs 8.2G 0 8.2G 0% /sys/fs/cgroup /dev/nvme0n1p9 34G 9.2G 23G 29% / /dev/nvme0n1p7 1.1G 447M 506M 47% /boot /dev/nvme0n1p8 183G 73G 102G 42% /home /dev/nvme0n1p10 26G 11G 13G 46% /var /dev/nvme0n1p6 1.1G 7.6M 1.1G 1% /boot/efi /dev/loop1 59M 59M 0 100% /var/lib/snapd/snap/core18/2074 /dev/loop0 102M 102M 0 100% /var/lib/snapd/snap/core/9665 /dev/loop2 66M 66M 0 100% /var/lib/snapd/snap/gtk-common-themes/1506 /dev/loop3 32M 32M 0 100% /var/lib/snapd/snap/snapd/8542 /dev/loop4 58M 58M 0 100% /var/lib/snapd/snap/core18/1880 /dev/loop5 34M 34M 0 100% /var/lib/snapd/snap/snapd/12398 /dev/loop7 105M 105M 0 100% /var/lib/snapd/snap/core/11316 /dev/loop6 65M 65M 0 100% /var/lib/snapd/snap/core20/1081 /dev/loop8 69M 69M 0 100% /var/lib/snapd/snap/gtk-common-themes/1515 tmpfs 1.7G 11M 1.7G 1% /run/user/1000 [root@centos /]#
最後
dnf list installed kernel*
[root@centos /]# dnf list installed kernel* Installed Packages kernel.x86_64 4.18.0-193.6.3.el8_2 @BaseOS kernel.x86_64 4.18.0-193.14.2.el8_2 @BaseOS kernel.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-core.x86_64 4.18.0-193.6.3.el8_2 @BaseOS kernel-core.x86_64 4.18.0-193.14.2.el8_2 @BaseOS kernel-core.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-devel.x86_64 4.18.0-193.6.3.el8_2 @BaseOS kernel-devel.x86_64 4.18.0-193.14.2.el8_2 @BaseOS kernel-devel.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-headers.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-ml.x86_64 5.8.0-1.el8.elrepo @elrepo-kernel kernel-ml.x86_64 5.12.10-1.el8.elrepo @elrepo-kernel kernel-ml-core.x86_64 5.8.0-1.el8.elrepo @elrepo-kernel kernel-ml-core.x86_64 5.12.10-1.el8.elrepo @elrepo-kernel kernel-ml-modules.x86_64 5.8.0-1.el8.elrepo @elrepo-kernel kernel-ml-modules.x86_64 5.12.10-1.el8.elrepo @elrepo-kernel kernel-modules.x86_64 4.18.0-193.6.3.el8_2 @BaseOS kernel-modules.x86_64 4.18.0-193.14.2.el8_2 @BaseOS kernel-modules.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-tools.x86_64 4.18.0-305.3.1.el8 @BaseOS kernel-tools-libs.x86_64 4.18.0-305.3.1.el8 @BaseOS [root@centos /]#
和
rpm -qa | grep kernel
[root@centos /]# rpm -qa | grep kernel kernel-core-4.18.0-305.3.1.el8.x86_64 kernel-core-4.18.0-193.6.3.el8_2.x86_64 kernel-core-4.18.0-193.14.2.el8_2.x86_64 kernel-tools-libs-4.18.0-305.3.1.el8.x86_64 kernel-ml-core-5.12.10-1.el8.elrepo.x86_64 kernel-ml-5.12.10-1.el8.elrepo.x86_64 kernel-modules-4.18.0-193.6.3.el8_2.x86_64 kernel-ml-core-5.8.0-1.el8.elrepo.x86_64 kernel-4.18.0-193.14.2.el8_2.x86_64 kernel-devel-4.18.0-305.3.1.el8.x86_64 kernel-ml-5.8.0-1.el8.elrepo.x86_64 kernel-4.18.0-193.6.3.el8_2.x86_64 kernel-modules-4.18.0-193.14.2.el8_2.x86_64 kernel-devel-4.18.0-193.14.2.el8_2.x86_64 kernel-headers-4.18.0-305.3.1.el8.x86_64 kernel-4.18.0-305.3.1.el8.x86_64 kernel-tools-4.18.0-305.3.1.el8.x86_64 kernel-ml-modules-5.8.0-1.el8.elrepo.x86_64 kernel-modules-4.18.0-305.3.1.el8.x86_64 kernel-ml-modules-5.12.10-1.el8.elrepo.x86_64 kernel-devel-4.18.0-193.6.3.el8_2.x86_64 [root@centos /]#
檢查您目前使用的核心
uname -r
現在執行
dnf remove --oldinstallonly --setopt installonly_limit=1
檢查要解除安裝的核心是否是您想要刪除的核心。完成解除安裝,Grub 將自動更新。只需重新啟動並完成。