怎么在Ubuntu中删除多余内核?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
第一步:查看当前内核
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
当前使用版本为: 4.15.0-42-generic
第二步:查看所有内核
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
第三步:移除冗余内核
所有 39 版本的对我来说都是多余的,进行删除:
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
卸载后重新检查:
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
状态为 deinstall 即已经卸载,如果觉得看着不舒服的话可以使用 purge 连配置文件里一起彻底删除,清理内核列表
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
第四步:更新系统引导
删除内核后需要更新 grub 移除失效的启动项
rew $ sudo update-grub #根据情况选择grub/grub2
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。