露白宇宁 發表於 2024-3-15 00:00:00

删除ubuntu系统多余的旧内核启动菜单项的方法

<p>
        Linux/Ubuntu系统用的时间久了,经常会有一些系统更新,除了一些系统补丁、工具补丁、工具升级之外,内核也经常对一些问题进行修改升级,这样就会产生一些新的内核,我们更新了新的内核后,就会自动帮我们添加到开机启动菜单选项中,那些旧的内核启动项,对于我们来说已经没有用了,可以删除,删除后可以让我们在开机的时候能快速的选择要启动的菜单项,同时也能清理出一些磁盘空间出来,小编下面就来分享如何删除多余的内核启动菜单项</p>
<p>
        小编的这个建议只适合于10.10之前版本的ubuntu系统,后面的11.04,11.10。。。14.04系统因为采用的默认桌面不同,所以本经验不适用,若要使用,那么请安装GNOME桌面</p>
<p>
        1</p>
<p>
        打开“应用程序”,然后在弹出菜单中点击“附件”,选择并打开“终端”,打开终端命令窗口</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="删除ubuntu系统多余的旧内核启动菜单项的方法" alt="删除ubuntu系统多余的旧内核启动菜单项的方法" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/7b01382e725e46afc5867ddcd6a446d7.jpg" width="500"></p>
<p>
        2</p>
<p>
        在终端命令窗口中输入并执行下面的命令:uname -a,查看我们当前使用的内核,不要删除错误了,或者当我们使用的是旧内核进入系统,想删除这个内核启动项,这样也是不能删除的。只能在开机时选择别的内核启动项进入系统才能删除</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="删除ubuntu系统多余的旧内核启动菜单项的方法" alt="删除ubuntu系统多余的旧内核启动菜单项的方法" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/62a4c1a7ff47d95fb8edf21a4c685598.jpg" width="500"></p>
<p>
        3</p>
<p>
        输入下面的命令,查看当前我们系统中有哪些内核启动项,同时也可以方便我们复制的操作,具体命令是:</p>
<p>
        dpkg --get-selections | grep linux</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="删除ubuntu系统多余的旧内核启动菜单项的方法" alt="删除ubuntu系统多余的旧内核启动菜单项的方法" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/d6004278972620b85d12537b01ce1b69.jpg" width="500"></p>
<p>
        4</p>
<p>
        下面就开始删除内核启动项,先选择内核启动项,然后复制,这样方便操作,然后输入下面的命令:</p>
<p>
        sudo apt-get remove linux-image-2.6.32.21-generic</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="删除ubuntu系统多余的旧内核启动菜单项的方法" alt="删除ubuntu系统多余的旧内核启动菜单项的方法" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/a549f8d914e89db03013c5e679926f86.jpg" width="500"></p>
<p>
        5</p>
<p>
        执行过程中会警告我们确实要执行这个操作,输入字母y,然后回车,就开始卸载旧内核了</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="删除ubuntu系统多余的旧内核启动菜单项的方法" alt="删除ubuntu系统多余的旧内核启动菜单项的方法" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/336192a9a92e178e3cd34f82fb85155f.jpg" width="500"></p>
<p>
        6</p>
<p>
        之后就是一些具体的卸载过程的提示,已经更新系统启动项的信息</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="删除ubuntu系统多余的旧内核启动菜单项的方法" alt="删除ubuntu系统多余的旧内核启动菜单项的方法" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/b07b4259702b9ddd26432fdfe5bd6715.jpg" width="500"></p>
<p>
        7</p>
<p>
        我们再次使用命令:dpkg --get-selections | grep linux 来查看当前的内核情况:</p>
<p>
        在linux-image-2.6.32.21-generic 后面显示deinstall,表示已经卸载了</p>
<p>
        linux-headers-2.6.32.21和linux-headers-2.6.32.21-generic是之前我们卸载的内核相关联的头文件,现在对于我们也没有用,也可以卸载了,卸载了可以帮我们清理出不少磁盘空间,具体命令是:</p>
<p>
        sudo apt-get remove linux-headers-2.6.32-21</p>
<p>
        sudo apt-get remove linux-headers-2.6.32-21-generic</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="删除ubuntu系统多余的旧内核启动菜单项的方法" alt="删除ubuntu系统多余的旧内核启动菜单项的方法" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/93e6defcc38d19888f48171dea811e02.jpg" width="500"></p>
<p>
        8</p>
<p>
        删除完后,再用命令:dpkg --get-selections | grep linux 查看当前内核启动选项相关信息:</p>
<p>
        linux-headers-2.6.32-21 已经没有了,被删除了</p>
<p>
        linux-headers-2.6.32-21-generic已经没有了,被删除了</p>
<p>
        linux-image-2.6.32-21-generic 显示为deinstall,表示被卸载删除了</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="删除ubuntu系统多余的旧内核启动菜单项的方法" alt="删除ubuntu系统多余的旧内核启动菜单项的方法" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/fe6bd200f1b7375301824c66844684c3.jpg" width="500"></p>
<p>
        9</p>
<p>
        虽然在卸载旧内核的时候提示信息说已经帮我们更新了系统启动项,但为了保险起见我们执行sudo update-grub更新开机启动控制文件。</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="删除ubuntu系统多余的旧内核启动菜单项的方法" alt="删除ubuntu系统多余的旧内核启动菜单项的方法" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/b9007aeb8e8f26aee642f46b49fa1afa.jpg" width="500"></p>
<p>
        注意事项</p>
<p>
        小编用的是10.04的Ubuntu,其它版本的Ubuntu略有不同,请根据实际版本操作。</p>
頁: [1]
查看完整版本: 删除ubuntu系统多余的旧内核启动菜单项的方法