公升級核心後如何刪除舊核心

2021-09-08 16:32:09 字數 4180 閱讀 8177

在公升級新的核心後,如何刪除舊的核心檔案?

舉例來說,假設我們剛剛執行了 apt-get dist-upgrade 公升級到了倉庫中最新的核心版本(如從 3.2.0-30 公升級到了 3.2.0-34)

default

$ sudo apt-get dist-upgrade

reading package lists… done

building dependency tree

reading state information… done

calculating upgrade… done

the following new packages will be installed:

libframe6 libgeis1 libgrail5 linux-headers-3.2.0-34

linux-headers-3.2.0-34-generic linux-image-3.2.0-34-generic

the following packages will be upgraded:

libgrip0 linux-headers-generic linux-image-generic

3 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.

need to get 50.9 mb of archives.

after this operation, 181 mb of additional disk space will be used.

do you want to continue [y/n]? y

…$ sudo apt-get dist-upgrade

reading package lists… done

building dependency tree

reading state information… done

calculating upgrade… done

the following new packages will be installed:

libframe6 libgeis1 libgrail5 linux-headers-3.2.0-34

linux-headers-3.2.0-34-generic linux-image-3.2.0-34-generic

the following packages will be upgraded:

libgrip0 linux-headers-generic linux-image-generic

3 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.

need to get 50.9 mb of archives.

after this operation, 181 mb of additional disk space will be used.

do you want to continue [y/n]? y

…首先我們需要知道已經安裝了哪些核心版本,可以使用下面的命令:

default

$ dpkg --get-selections | grep linux

fonts-linuxlibertine install

libselinux1 install

linux-firmware install

linux-headers-3.2.0-30 install

linux-headers-3.2.0-30-generic install

linux-headers-3.2.0-34 install

linux-headers-3.2.0-34-generic install

linux-headers-generic install

linux-image-3.2.0-30-generic install

linux-image-3.2.0-34-generic install

linux-image-generic install

linux-libc-dev install

linux-sound-base install

pptp-linux install

syslinux install

syslinux-common install

util-linux install

$ dpkg --get-selections | grep linux

fonts-linuxlibertine install

libselinux1 install

linux-firmware install

linux-headers-3.2.0-30 install

linux-headers-3.2.0-30-generic install

linux-headers-3.2.0-34 install

linux-headers-3.2.0-34-generic install

linux-headers-generic install

linux-image-3.2.0-30-generic install

linux-image-3.2.0-34-generic install

linux-image-generic install

linux-libc-dev install

linux-sound-base install

pptp-linux install

syslinux install

syslinux-common install

util-linux install

這樣,我們就可以從中找到舊的核心檔案(linux-headers-3.2.0-30 linux-headers-3.2.0-30-generic linux-image-3.2.0-30-generic),相應地將他們刪除:

default

$ sudo apt-get purge linux-headers-3.2.0-30 linux-headers-3.2.0-30-generic linux-image-3.2.0-30-generic

reading package lists… done

building dependency tree

reading state information… done

the following packages will be removed:

linux-headers-3.2.0-30* linux-headers-3.2.0-30-generic*

linux-image-3.2.0-30-generic*

0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.

after this operation, 180 mb disk space will be freed.

do you want to continue [y/n]? y

…$ sudo apt-get purge linux-headers-3.2.0-30 linux-headers-3.2.0-30-generic linux-image-3.2.0-30-generic

reading package lists… done

building dependency tree

reading state information… done

the following packages will be removed:

linux-headers-3.2.0-30* linux-headers-3.2.0-30-generic*

linux-image-3.2.0-30-generic*

0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.

after this operation, 180 mb disk space will be freed.

do you want to continue [y/n]? y

…linux deepin 在使用 apt-get 更新與刪除舊核心後會自動呼叫 update-grub 更新 grub.cfg 檔案,這樣,我們就不用擔心刪除舊核心後因為 grub 的配置原因而無法從新的核心啟動的問題。

重啟後,我們即可在新的 grub 選單中從新核心啟動。

更新CentOS核心後刪除舊核心

yum update 更新系統之後,如果有並且使用新核心,則舊核心可以刪除。檢視當前核心 root test uname a linux test.test1 3.10.0 229.el7.x86 64 1 smp fri mar 6 11 36 42 utc 2015 x86 64 x86 64 ...

Fedora 刪除舊核心

由於fedora更新公升級非常的頻繁,所以,非常有必要清除陳舊的核心,方法如下 1.檢視當前系統中已安裝的核心相關包 root knityster rpm qa grep kernel kernel headers 2.6.32.12 115.fc12.i686 kernel firmware 2....

Fedora 刪除舊核心

由於fedora更新公升級非常的頻繁,所以,非常有必要清除陳舊的核心,方法如下 root knityster rpm qa grep kernel kernel headers 2.6.32.12 115.fc12.i686 kernel firmware 2.6.32.12 115.fc12.no...