总的步骤
- 查询当前内核版本: uname -a
- 列出所有内核: dpkg –get-selections | grep linux-image
- 删除老的内核: sudo apt-get remove linux-image-xxxx
Example
flying-bird@flyingbird:~$ dpkg --get-selections | grep linux-image linux-image-3.13.0-33-generic deinstall linux-image-3.13.0-34-generic deinstall linux-image-3.13.0-35-generic deinstall linux-image-3.13.0-36-generic deinstall linux-image-3.13.0-37-generic deinstall linux-image-3.13.0-39-generic deinstall linux-image-3.13.0-40-generic deinstall linux-image-3.13.0-43-generic deinstall linux-image-3.13.0-44-generic deinstall linux-image-3.13.0-46-generic deinstall linux-image-3.13.0-48-generic deinstall linux-image-3.13.0-49-generic deinstall linux-image-3.13.0-53-generic deinstall linux-image-3.13.0-55-generic deinstall linux-image-3.13.0-57-generic deinstall linux-image-3.13.0-58-generic deinstall linux-image-3.13.0-85-generic deinstall linux-image-3.13.0-86-generic deinstall linux-image-3.13.0-87-generic deinstall linux-image-3.13.0-93-generic install linux-image-3.2.0-24-generic-pae deinstall linux-image-3.2.0-67-generic-pae install linux-image-4.4.0-34-generic deinstall linux-image-extra-3.13.0-33-generic deinstall linux-image-extra-3.13.0-34-generic deinstall linux-image-extra-3.13.0-35-generic deinstall linux-image-extra-3.13.0-36-generic deinstall linux-image-extra-3.13.0-37-generic deinstall linux-image-extra-3.13.0-39-generic deinstall linux-image-extra-3.13.0-40-generic deinstall linux-image-extra-3.13.0-43-generic deinstall linux-image-extra-3.13.0-44-generic deinstall linux-image-extra-3.13.0-46-generic deinstall linux-image-extra-3.13.0-48-generic deinstall linux-image-extra-3.13.0-49-generic deinstall linux-image-extra-3.13.0-53-generic deinstall linux-image-extra-3.13.0-55-generic deinstall linux-image-extra-3.13.0-57-generic deinstall linux-image-extra-3.13.0-58-generic deinstall linux-image-extra-3.13.0-85-generic deinstall linux-image-extra-3.13.0-86-generic deinstall linux-image-extra-3.13.0-87-generic deinstall linux-image-extra-3.13.0-93-generic install linux-image-extra-4.4.0-34-generic deinstall flying-bird@flyingbird:~$ uname -a Linux flyingbird 3.13.0-93-generic #140-Ubuntu SMP Mon Jul 18 21:20:08 UTC 2016 i686 i686 i686 GNU/Linux flying-bird@flyingbird:~$ sudo apt-get remove linux-image-3.2.0-67-generic-pae [sudo] password for flying-bird: Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: account-plugin-identica account-plugin-twitter fcitx-libs-gclient gir1.2-ebook-1.2 gir1.2-ebookcontacts-1.2 gir1.2-edataserver-1.2 gir1.2-messagingmenu-1.0 gir1.2-networkmanager-1.0 libllvm3.8 libmircommon5 snap-confine ubuntu-core-launcher Use 'sudo apt autoremove' to remove them. The following packages will be REMOVED: linux-image-3.2.0-67-generic-pae 0 upgraded,0 newly installed,1 to remove and 3 not upgraded. After this operation,114 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 320329 files and directories currently installed.) Removing linux-image-3.2.0-67-generic-pae (3.2.0-67.101) ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-67-generic-pae /boot/vmlinuz-3.2.0-67-generic-pae update-initramfs: Deleting /boot/initrd.img-3.2.0-67-generic-pae run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-67-generic-pae /boot/vmlinuz-3.2.0-67-generic-pae Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.13.0-93-generic Found initrd image: /boot/initrd.img-3.13.0-93-generic Found memtest86+ image: /boot/memtest86+.elf Found memtest86+ image: /boot/memtest86+.bin Found Ubuntu 12.04 LTS (12.04) on /dev/sda7 done flying-bird@flyingbird:~$
这里的12.04 LTS是当初升级Ubuntu时备份的老的操作系统。