我最近在我的Ubuntu 12.04上升级到了3.4内核。之后,电脑无法启动。所以我使用了之前的内核来启动。实际上,我不想要3.4内核。那么我该如何删除它并继续使用之前的内核呢?
apt-get remove
命令来逐个卸载它们。dpkg -l | awk '/linux-[^ ]+-[0-9]/ {print $2}'
sudo apt-get purge linux-{headers,image,image-extra}-3.5.0-{7,8,9}.*
linux-headers-3.5.0-7*
linux-headers-3.5.0-8*
linux-headers-3.5.0-9*
linux-image-3.5.0-7*
linux-image-3.5.0-8*
linux-image-3.5.0-9*
linux-image-extra-3.5.0-7*
linux-image-extra-3.5.0-8*
linux-image-extra-3.5.0-9*
apt-get -s remove linux-image-3.4*
并查看它选择了哪些内容(是的,所有内核)。不用担心,该命令处于“模拟模式”,因此不会执行任何操作(也不需要root权限)。Uninstalling Mainline Kernels
The mainline kernels have their own ABI namespace so they install side by side with the stock Ubuntu kernels (each kernel has a separate directory under
/lib/modules/VERSION
for example). This means that you can keep several mainline and Ubuntu stock kernels installed at the same time and select the one you need from the GRUB boot menu.If you would like to uninstall a mainline kernel anyway, first use:
dpkg -l | grep "linux\-[a-z]*\-"
to find the exact name of the kernel packages you want to uninstall, and then do:
sudo apt-get remove KERNEL_PACKAGES_TO_REMOVE
Remember that several packages belong to one kernel version: common headers, architecture specific headers and the architecture specific image.
来源: https://wiki.ubuntu.com/Kernel/MainlineBuilds#Uninstalling_Mainline_Kernels