Hyper-V 下的 Ubuntu:保留哪个内核以及如何删除其余内核?

Hyper-V 下的 Ubuntu:保留哪个内核以及如何删除其余内核?

最近我需要在 Hyper-V 下使用 Ubuntu 18.04 TLS 快速设置全新的 VM(这不是我通常的工具箱,但这次我不能使用 Hyper-V 的任何东西)。

好的,我完成了安装(我过去在初始安装菜单中选择“hwe”安装),在尝试找到使用 Hyper-V 集成的方法时,我发现我需要做这个神奇的事情:

echo 'hv_vmbus' >> /etc/initramfs-tools/modules
echo 'hv_storvsc' >> /etc/initramfs-tools/modules
echo 'hv_blkvsc' >> /etc/initramfs-tools/modules
echo 'hv_netvsc' >> /etc/initramfs-tools/modules
apt -y install linux-virtual linux-cloud-tools-virtual linux-tools-virtual
update-initramfs -u

好的,我这样做了,一切都正常,但如何找出哪些内核和软件包我不需要保留,哪些我可以永久删除?你看,现在我有很多内核软件包,我知道我不需要其中的大多数:

# dpkg -l | grep linux
ii  console-setup-linux                  1.178ubuntu2.9                                  all          Linux specific part of console-setup
ii  libselinux1:amd64                    2.7-2build2                                     amd64        SELinux runtime shared libraries
ii  linux-base                           4.5ubuntu1                                      all          Linux image base package
ii  linux-cloud-tools-4.15.0-91          4.15.0-91.92                                    amd64        Linux kernel version specific cloud tools for version 4.15.0-91
ii  linux-cloud-tools-4.15.0-91-generic  4.15.0-91.92                                    amd64        Linux kernel version specific cloud tools for version 4.15.0-91
ii  linux-cloud-tools-common             4.15.0-91.92                                    all          Linux kernel version specific cloud tools for version 4.15.0
ii  linux-cloud-tools-virtual            4.15.0.91.83                                    amd64        Virtual Linux kernel cloud tools
ii  linux-firmware                       1.173.16                                        all          Firmware for Linux kernel drivers
ii  linux-generic-hwe-18.04              5.3.0.42.99                                     amd64        Complete Generic Linux kernel and headers
ii  linux-headers-4.15.0-91              4.15.0-91.92                                    all          Header files related to Linux kernel version 4.15.0
ii  linux-headers-4.15.0-91-generic      4.15.0-91.92                                    amd64        Linux kernel headers for version 4.15.0 on 64 bit x86 SMP
ii  linux-headers-5.3.0-42               5.3.0-42.34~18.04.1                             all          Header files related to Linux kernel version 5.3.0
ii  linux-headers-5.3.0-42-generic       5.3.0-42.34~18.04.1                             amd64        Linux kernel headers for version 5.3.0 on 64 bit x86 SMP
ii  linux-headers-generic                4.15.0.91.83                                    amd64        Generic Linux kernel headers
ii  linux-headers-generic-hwe-18.04      5.3.0.42.99                                     amd64        Generic Linux kernel headers
ii  linux-headers-virtual                4.15.0.91.83                                    amd64        Virtual Linux kernel headers
ii  linux-image-4.15.0-91-generic        4.15.0-91.92                                    amd64        Signed kernel image generic
ii  linux-image-5.3.0-42-generic         5.3.0-42.34~18.04.1                             amd64        Signed kernel image generic
ii  linux-image-generic-hwe-18.04        5.3.0.42.99                                     amd64        Generic Linux kernel image
ii  linux-image-virtual                  4.15.0.91.83                                    amd64        Virtual Linux kernel image
ii  linux-modules-4.15.0-91-generic      4.15.0-91.92                                    amd64        Linux kernel extra modules for version 4.15.0 on 64 bit x86 SMP
ii  linux-modules-5.3.0-42-generic       5.3.0-42.34~18.04.1                             amd64        Linux kernel extra modules for version 5.3.0 on 64 bit x86 SMP
ii  linux-modules-extra-5.3.0-42-generic 5.3.0-42.34~18.04.1                             amd64        Linux kernel extra modules for version 5.3.0 on 64 bit x86 SMP
ii  linux-tools-4.15.0-91                4.15.0-91.92                                    amd64        Linux kernel version specific tools for version 4.15.0-91
ii  linux-tools-4.15.0-91-generic        4.15.0-91.92                                    amd64        Linux kernel version specific tools for version 4.15.0-91
ii  linux-tools-common                   4.15.0-91.92                                    all          Linux kernel version specific tools for version 4.15.0
ii  linux-tools-virtual                  4.15.0.91.83                                    amd64        Virtual Linux kernel tools
ii  linux-virtual                        4.15.0.91.83                                    amd64        Minimal Generic Linux kernel and headers
ii  util-linux                           2.31.1-0.4ubuntu3.5                             amd64        miscellaneous system utilities

请提供建议,因为这是我多年来一直不太明白的事情。

相关内容