Ubuntu删除多余内核
生活随笔
收集整理的這篇文章主要介紹了
Ubuntu删除多余内核
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
第一步:查看當(dāng)前內(nèi)核
rew $ uname -a
Linux rew 4.15.0-42-generic #45~16.04.1-Ubuntu SMP Mon Nov 19 13:02:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
當(dāng)前使用版本為:4.15.0-42-generic
第二步:查看所有內(nèi)核
dpkg --get-selections | grep linux
rew $ dpkg --get-selections | grep linux
console-setup-linux install
libselinux1:amd64 install
libselinux1:i386 install
linux-base install
linux-firmware install
linux-generic-hwe-16.04 install
linux-headers-4.15.0-42 install
linux-headers-4.15.0-39 install
linux-headers-4.15.0-39-generic install
linux-headers-4.15.0-42-generic install
linux-headers-generic-hwe-16.04 install
linux-image-4.15.0-39-generic install
linux-image-4.15.0-42-generic install
linux-image-generic-hwe-16.04 install
linux-libc-dev:amd64 install
linux-libc-dev:i386 install
linux-modules-4.15.0-39-generic install
linux-modules-4.15.0-42-generic install
linux-modules-extra-4.15.0-39-generic install
linux-modules-extra-4.15.0-42-generic install
linux-sound-base install
pptp-linux install
syslinux install
syslinux-common install
syslinux-legacy install
util-linux install
第三步:移除冗余內(nèi)核
多余的內(nèi)核可以通過(guò)命令刪除 需要?jiǎng)h除header和image
sudo apt-get remove linux-image-*.*.*-**(*號(hào)用你想刪除的實(shí)際情況改寫)
sudo apt-get remove linux-headers-*.*.*-**(*號(hào)用你想刪除的實(shí)際情況改寫)
所有39版本的對(duì)我來(lái)說(shuō)都是多余的,進(jìn)行刪除:
rew $ sudo apt-get remove \
linux-headers-4.15.0-39 \
linux-headers-4.15.0-39-generic \
linux-image-4.15.0-39-generic \
linux-modules-4.15.0-39-generic \
linux-modules-extra-4.15.0-39-generic
卸載后重新檢查:
dpkg --get-selections | grep linux
rew $ dpkg --get-selections | grep linux
console-setup-linux install
libselinux1:amd64 install
libselinux1:i386 install
linux-base install
linux-firmware install
linux-generic-hwe-16.04 install
linux-headers-4.15.0-42 install
linux-headers-4.15.0-42-generic install
linux-headers-generic-hwe-16.04 install
linux-image-4.15.0-39-generic deinstall
linux-image-4.15.0-42-generic install
linux-image-generic-hwe-16.04 install
linux-libc-dev:amd64 install
linux-libc-dev:i386 install
linux-modules-4.15.0-39-generic deinstall
linux-modules-4.15.0-42-generic install
linux-modules-extra-4.15.0-39-generic deinstall
linux-modules-extra-4.15.0-42-generic install
linux-sound-base install
pptp-linux install
syslinux install
syslinux-common install
syslinux-legacy install
util-linux install
狀態(tài)為deinstall即已經(jīng)卸載,如果覺(jué)得看著不舒服的話可以使用purge連配置文件里一起徹底刪除,清理內(nèi)核列表
rew $ sudo apt-get purge \
linux-headers-4.15.0-39 \
linux-headers-4.15.0-39-generic \
linux-image-4.15.0-39-generic \
linux-modules-4.15.0-39-generic \
linux-modules-extra-4.15.0-39-generic
第四步:更新系統(tǒng)引導(dǎo)
刪除內(nèi)核后需要更新grub移除失效的啟動(dòng)項(xiàng)
rew $ sudo update-grub #根據(jù)情況選擇grub/grub2
還有一種通過(guò)正則表達(dá)式匹配內(nèi)核然后除最新的統(tǒng)統(tǒng)統(tǒng)統(tǒng)刪除的。
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/-/\1/")"'/d;s/^[^ ]* [^ ]*?.*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
作者:hwrenx
鏈接:https://www.jianshu.com/p/f284bc90944f
總結(jié)
以上是生活随笔為你收集整理的Ubuntu删除多余内核的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Ubuntu 16.04 安装搜狗输入法
- 下一篇: ubuntu禁止自动更新系统内核