为什么命令 dpkg -l 'linux-*' 返回大量文件?

为什么命令 dpkg -l 'linux-*' 返回大量文件?

海因内玛:

我尝试将您请求的项目添加到我的原始帖子中,但超出了允许的总字符数(30000)。

因此,我删除了原始输出dpkg -l 'linux-*'

我还将输出:添加ls -al / 到您的所需项目列表中。

希望我正确插入了屏幕截图。

tscale:~$ ls -al /boot
total 308929
drwxr-xr-x  5 root root     4096 Mar  5 08:36 .
drwxr-xr-x 26 root root     4096 Feb 19 06:54 ..
-rw-r--r--  1 root root  1501359 Feb 16  2018 abi-4.13.0-36-generic
-rw-r--r--  1 root root  1501359 Mar  7  2018 abi-4.13.0-37-generic
-rw-r--r--  1 root root  1501528 May 28  2018 abi-4.13.0-45-generic
-rw-r--r--  1 root root   213212 Feb 16  2018 config-4.13.0-36-generic
-rw-r--r--  1 root root   213212 Mar  7  2018 config-4.13.0-37-generic
-rw-r--r--  1 root root   213212 May 28  2018 config-4.13.0-45-generic
-rw-r--r--  1 root root   217495 Jan 17 06:59 config-4.15.0-76-generic
-rw-r--r--  1 root root   217495 Feb 11 11:53 config-4.15.0-88-generic
drwxr-xr-x  7 root root     1024 Dec 31  1969 efi
drwxr-xr-x  5 root root     4096 Mar  5 08:37 grub
drwxr-xr-x  5 root root     4096 Jul  5  2018 grub.bak
-rw-r--r--  1 root root 58409773 Feb 22  2018 initrd.img-4.13.0-36-generic
-rw-r--r--  1 root root 29349761 May  9  2018 initrd.img-4.13.0-37-generic
-rw-r--r--  1 root root 59796351 Jun 21  2018 initrd.img-4.13.0-45-generic
-rw-r--r--  1 root root 39391724 Feb 28 13:43 initrd.img-4.15.0-76-generic
-rw-r--r--  1 root root 39401888 Feb 28 13:43 initrd.img-4.15.0-88-generic
-rw-r--r--  1 root root   182704 Jan 28  2016 memtest86+.bin
-rw-r--r--  1 root root   184380 Jan 28  2016 memtest86+.elf
-rw-r--r--  1 root root   184840 Jan 28  2016 memtest86+_multiboot.bin
-rw-r--r--  1 root root     2860 Feb 16  2018 retpoline-4.13.0-36-generic
-rw-r--r--  1 root root     2860 Mar  7  2018 retpoline-4.13.0-37-generic
-rw-r--r--  1 root root      255 May 28  2018 retpoline-4.13.0-45-generic
-rw-------  1 root root  3880918 Feb 16  2018 System.map-4.13.0-36-generic
-rw-------  1 root root  3880918 Mar  7  2018 System.map-4.13.0-37-generic
-rw-------  1 root root  3884611 May 28  2018 System.map-4.13.0-45-generic
-rw-------  1 root root  4068355 Jan 17 06:59 System.map-4.15.0-76-generic
-rw-------  1 root root  4069510 Feb 11 11:53 System.map-4.15.0-88-generic
-rw-------  1 root root  7870224 Feb 16  2018 vmlinuz-4.13.0-36-generic
-rw-------  1 root root  7872152 Feb 22  2018 vmlinuz-4.13.0-36-generic.efi.signed
-rw-------  1 root root  7870224 Mar  7  2018 vmlinuz-4.13.0-37-generic
-rw-------  1 root root  7872152 Mar 15  2018 vmlinuz-4.13.0-37-generic.efi.signed
-rw-------  1 root root  7870224 May 28  2018 vmlinuz-4.13.0-45-generic
-rw-------  1 root root  7872152 Jun 12  2018 vmlinuz-4.13.0-45-generic.efi.signed
-rw-------  1 root root  8367768 Jan 17 07:27 vmlinuz-4.15.0-76-generic
-rw-------  1 root root  8371864 Feb 11 11:57 vmlinuz-4.15.0-88-generic
tscale:~$ 



tscale:/$ ls -al
total 711520
drwxr-xr-x  26 root root      4096 Feb 19 06:54 .
drwxr-xr-x  26 root root      4096 Feb 19 06:54 ..
drwxr-xr-x   2 root root      4096 Feb 21 11:08 bin
drwxr-xr-x   5 root root      4096 Mar  5 08:36 boot
drwxr-xr-x   5 root root      4096 Jul  5  2018 boot_bak
drwxr-xr-x   2 root root      4096 Dec  4  2017 cdrom
drwxr-xr-x  21 root root      4660 Mar  6 11:12 dev
drwxr-xr-x 161 root root     12288 Mar  3 06:56 etc
drwxr-xr-x   6 root root      4096 Jul  5  2018 home
lrwxrwxrwx   1 root root        33 Feb 19 06:54 initrd.img -> boot/initrd.img-4.15.0-88-generic
lrwxrwxrwx   1 root root        33 Feb 19 06:54 initrd.img.old -> boot/initrd.img-4.15.0-76-generic
drwxr-xr-x  22 root root      4096 Jul  6  2018 lib
drwxr-xr-x   2 root root      4096 Feb 12 11:50 lib32
drwxr-xr-x   2 root root      4096 Jul  6  2018 lib64
drwx------   2 root root     16384 Dec  4  2017 lost+found
drwxr-xr-x   4 root root      4096 Sep  3  2018 media
drwxr-xr-x   4 root root      4096 Jul  4  2018 mnt
drwxr-xr-x   3 root root      4096 Nov 24 19:29 opt
dr-xr-xr-x 363 root root         0 Mar  5 11:37 proc
drwx------  10 root root      4096 Dec 30 13:54 root
drwxr-xr-x  33 root root      1020 Mar  6 11:12 run
drwxr-xr-x   2 root root     12288 Feb 26 10:10 sbin
drwxr-xr-x   5 root root      4096 Feb 14 15:43 snap
drwxr-xr-x   2 root root      4096 Oct 18  2017 srv
-rw-------   1 root root 728458240 Dec  4  2017 swapfile
dr-xr-xr-x  13 root root         0 Mar  6 11:15 sys
drwxrwxrwt  20 root root     16384 Mar  6 11:13 tmp
drwxr-xr-x  12 root root      4096 Feb 15 08:46 usr
drwxr-xr-x  14 root root      4096 Oct 18  2017 var
lrwxrwxrwx   1 root root        30 Feb 19 06:54 vmlinuz -> boot/vmlinuz-4.15.0-88-generic
lrwxrwxrwx   1 root root        30 Feb 19 06:54 vmlinuz.old -> boot/vmlinuz-4.15.0-76-generic


tscale:~$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
udev            16426044         0  16426044   0% /dev
tmpfs            3289692      2072   3287620   1% /run
/dev/sdb1       21835256  18707476   1998976  91% /
tmpfs           16448440     36400  16412040   1% /dev/shm
tmpfs               5120         4      5116   1% /run/lock
tmpfs           16448440         0  16448440   0% /sys/fs/cgroup
/dev/loop0         25344     25344         0 100% /snap/snapd/6434
/dev/loop2         25344     25344         0 100% /snap/snapd/6240
/dev/loop1         56064     56064         0 100% /snap/core18/1668
/dev/sda2          98304     36348     61956  37% /boot/efi
/dev/sdb4      502914096 287878256 189419468  61% /home
tmpfs            3289688        16   3289672   1% /run/user/121
tmpfs            3289688        52   3289636   1% /run/user/1000
/dev/sdc1      976730108 664244408 312485700  69% /media/tscale/NTFS_1Tb

GPARTED 的屏幕截图,用于相关驱动器

答案1

它不仅显示标记为 的实际安装的内核ii,还显示过去安装的内核或软件包,即使它们现在已被删除。很可能您已在未使用 的情况下删除了它们purge

参考

如果您尝试通过 卸载 Linux 内核sudo apt purge linux-image-5.3.0-18-generic,您可能会得到以下结果:

Purging configuration files for linux-image-5.3.0-18-generic (5.3.0-18.19+1) ...
rmdir: failed to remove '/lib/modules/5.3.0-18-generic': Directory not empty

此内核从 grub 中消失,并已从/boot文件夹中删除,但仍保留在/lib/modules/

$ sudo apt purge linux-image-5.3.0-18-generic linux-headers-5.3.0-18
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'linux-image-5.3.0-18-generic' is not installed, so not removed
The following package was automatically installed and is no longer required:
  linux-modules-5.3.0-18-generic
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
  linux-headers-5.3.0-18* linux-headers-5.3.0-18-generic*
0 upgraded, 0 newly installed, 2 to remove and 22 not upgraded.
After this operation, 84,8 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 353685 files and directories currently installed.)
Removing linux-headers-5.3.0-18-generic (5.3.0-18.19) ...
Removing linux-headers-5.3.0-18 (5.3.0-18.19) ...

在此之后,当我运行时,linux-headers-5.3.0-18linux-image-5.3.0-18-generic不再列出dpkg -l linux-* | grep ii,但是我之前已删除它们,但没有purge选择。

如果要清除特定版本,请使用:

sudo apt purge linux-*5.3.0-18*

相关内容