我经常遇到升级时可用磁盘空间不足,因为 Ubuntu 安装创建的启动分区太小。按照接受的答案,我发现了一堆看上去属于旧内核的东西。
$ uname -r
3.19.0-51-generic
$ ll /boot
total 96958
drwxr-xr-x 4 root root 3072 Apr 14 09:54 ./
drwxr-xr-x 23 root root 4096 Mar 2 10:08 ../
-rw-r--r-- 1 root root 1271904 Jan 22 04:40 abi-3.19.0-49-generic
-rw-r--r-- 1 root root 1271993 Feb 27 00:51 abi-3.19.0-51-generic
-rw-r--r-- 1 root root 177800 Jan 22 04:40 config-3.19.0-49-generic
-rw-r--r-- 1 root root 177800 Feb 27 00:51 config-3.19.0-51-generic
drwxr-xr-x 5 root root 1024 Apr 14 09:54 grub/
-rw-r--r-- 1 root root 9796008 Jan 21 11:09 initrd.img-3.19.0-31-generic
-rw-r--r-- 1 root root 32580082 Feb 17 13:02 initrd.img-3.19.0-49-generic
-rw-r--r-- 1 root root 32580270 Mar 2 10:08 initrd.img-3.19.0-51-generic
drwx------ 2 root root 12288 Apr 17 2015 lost+found/
-rw-r--r-- 1 root root 164216 Mar 6 2015 memtest86+.bin
-rw-r--r-- 1 root root 165892 Mar 6 2015 memtest86+.elf
-rw-r--r-- 1 root root 166396 Mar 6 2015 memtest86+_multiboot.bin
-rw------- 1 root root 3624223 Jan 22 04:40 System.map-3.19.0-49-generic
-rw------- 1 root root 3624551 Feb 27 00:51 System.map-3.19.0-51-generic
-rw------- 1 root root 6625856 Jan 22 04:40 vmlinuz-3.19.0-49-generic
-rw------- 1 root root 6627648 Feb 27 00:51 vmlinuz-3.19.0-51-generic
$ dpkg -l | grep 3.19.0
ii linux-generic 3.19.0.51.50 amd64 Complete Generic Linux kernel and headers
ii linux-headers-3.19.0-26 3.19.0-26.28 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-26-generic 3.19.0-26.28 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-28 3.19.0-28.30 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-28-generic 3.19.0-28.30 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-30 3.19.0-30.34 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-30-generic 3.19.0-30.34 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-31 3.19.0-31.36 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-31-generic 3.19.0-31.36 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-32 3.19.0-32.37 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-32-generic 3.19.0-32.37 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-33 3.19.0-33.38 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-33-generic 3.19.0-33.38 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-37 3.19.0-37.42 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-37-generic 3.19.0-37.42 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-42 3.19.0-42.48 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-42-generic 3.19.0-42.48 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-43 3.19.0-43.49 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-43-generic 3.19.0-43.49 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-49 3.19.0-49.55 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-49-generic 3.19.0-49.55 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-51 3.19.0-51.58 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-51-generic 3.19.0-51.58 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-generic 3.19.0.51.50 amd64 Generic Linux kernel headers
ii linux-image-3.19.0-49-generic 3.19.0-49.55 amd64 Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii linux-image-3.19.0-51-generic 3.19.0-51.58 amd64 Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii linux-image-extra-3.19.0-49-generic 3.19.0-49.55 amd64 Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii linux-image-extra-3.19.0-51-generic 3.19.0-51.58 amd64 Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii linux-image-generic 3.19.0.51.50 amd64 Generic Linux kernel image
ii linux-libc-dev:amd64 3.19.0-51.58 amd64 Linux Kernel Headers for development
看起来有些东西是旧版本遗留下来的,比如linux-headers-3.19.0-26
在输出中dpkg
。但也有/boot/initrd.img-3.19.0-31-generic
,它似乎来自更旧的版本,就像我3.19.0.51-generic
现在的一样。
我可以安全地移除其中哪些东西?我应该一直移除apt-get purge
它们吗?还是还有一些东西我可以移除rm
?
答案1
您可以安全地清除所有旧版本的 linux-headers 包。
在您的案例版本中3.19.0-26 - 3.19.0-43
。
切勿删除由 安装dpkg
或apt
手动使用 的文件rm
。