Ubuntu 删除多余内核

xiaoxiao2021-02-28  71

目录

查看系统内存在的内核版本列表:查看当前Ubuntu系统使用的内核版本删除多余内核更新grub

查看系统内存在的内核版本列表:

madara@Madara-PC:~$ sudo dpkg --get-selections | grep linux [sudo] password for madara: libselinux1:amd64 install linux-firmware install linux-generic-lts-wily install linux-headers-4.2.0-41 install linux-headers-4.2.0-41-generic install linux-headers-4.2.0-42 install linux-headers-4.2.0-42-generic install linux-headers-generic-lts-wily install linux-image-4.2.0-41-generic install linux-image-4.2.0-42-generic install linux-image-extra-4.2.0-41-generic install linux-image-extra-4.2.0-42-generic install linux-image-generic-lts-wily install linux-libc-dev:amd64 install linux-sound-base install pptp-linux install syslinux install syslinux-common install syslinux-legacy install util-linux install

查看当前Ubuntu系统使用的内核版本

madara@Madara-PC:~$ uname -r 4.2.0-42-generic

删除多余内核

madara@Madara-PC:~$ sudo apt-get autoremove --purge linux-headers-4.2.0-41 linux-image-4.2.0-41-generic Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED linux-headers-4.2.0-41* linux-headers-4.2.0-41-generic* linux-image-4.2.0-41-generic* linux-image-extra-4.2.0-41-generic* 0 to upgrade, 0 to newly install, 4 to remove and 0 not to upgrade. After this operation, 295 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 202891 files and directories currently installed.) Removing linux-headers-4.2.0-41-generic (4.2.0-41.48~14.04.1) ... Removing linux-headers-4.2.0-41 (4.2.0-41.48~14.04.1) ... Removing linux-image-extra-4.2.0-41-generic (4.2.0-41.48~14.04.1) ... run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.2.0-41-generic /boot/vmlinuz-4.2.0-41-generic run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.2.0-41-generic /boot/vmlinuz-4.2.0-41-generic update-initramfs: Generating /boot/initrd.img-4.2.0-41-generic run-parts: executing /etc/kernel/postinst.d/pm-utils 4.2.0-41-generic /boot/vmlinuz-4.2.0-41-generic run-parts: executing /etc/kernel/postinst.d/update-notifier 4.2.0-41-generic /boot/vmlinuz-4.2.0-41-generic run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.2.0-41-generic /boot/vmlinuz-4.2.0-41-generic Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.2.0-42-generic Found initrd image: /boot/initrd.img-4.2.0-42-generic Found linux image: /boot/vmlinuz-4.2.0-41-generic Found initrd image: /boot/initrd.img-4.2.0-41-generic Found memtest86+ image: /memtest86+.elf Found memtest86+ image: /memtest86+.bin Found Windows 7 (loader) on /dev/sda1 done Purging configuration files for linux-image-extra-4.2.0-41-generic (4.2.0-41.48~14.04.1) ... Removing linux-image-4.2.0-41-generic (4.2.0-41.48~14.04.1) ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.2.0-41-generic /boot/vmlinuz-4.2.0-41-generic update-initramfs: Deleting /boot/initrd.img-4.2.0-41-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.2.0-41-generic /boot/vmlinuz-4.2.0-41-generic Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.2.0-42-generic Found initrd image: /boot/initrd.img-4.2.0-42-generic Found memtest86+ image: /memtest86+.elf Found memtest86+ image: /memtest86+.bin Found Windows 7 (loader) on /dev/sda1 done The link /vmlinuz.old is a damaged link Removing symbolic link vmlinuz.old you may need to re-run your boot loader[grub] The link /initrd.img.old is a damaged link Removing symbolic link initrd.img.old you may need to re-run your boot loader[grub] Purging configuration files for linux-image-4.2.0-41-generic (4.2.0-41.48~14.04.1) ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.2.0-41-generic /boot/vmlinuz-4.2.0-41-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.2.0-41-generic /boot/vmlinuz-4.2.0-41-generic

更新grub

madara@Madara-PC:~$ sudo update-grub Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.2.0-42-generic Found initrd image: /boot/initrd.img-4.2.0-42-generic Found memtest86+ image: /memtest86+.elf Found memtest86+ image: /memtest86+.bin Found Windows 7 (loader) on /dev/sda1 done
转载请注明原文地址: https://www.6miu.com/read-28178.html

最新回复(0)