清除内核包而不是删除内核包有什么用处吗?我之所以问这个问题,是因为自动删除包不会清除它删除的所有包。(我在 中设置了自动删除/etc/apt/apt.conf.d/50unattended-upgrades
,据说它相当于apt-get autoremve
)至少dpkg-query -L
对于这样的包来说
Package 'linux-image-4.2.0-21-generic' does not contain any files (!)
因此这表明没有配置文件。dpkg-query
显示的状态。deinstall ok config-files
对于linux-image-4.2.0-21-generic
相应的头文件包linux-headers-4.2.0-21-generic
,dpkg-query
显示状态not-installed
,并且对于linux-headers-4.2.0-21
它在自动删除操作后不显示匹配项。
值得一提的是,以下是其中的摘录/var/log/unattended-upgrades/unattended-upgrades-dpkg.log
:
Removing linux-headers-4.2.0-21-generic (4.2.0-21.25) ...
Removing linux-headers-4.2.0-21 (4.2.0-21.25) ...
Removing linux-image-extra-4.2.0-21-generic (4.2.0-21.25) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.2.0-21-generic /boot/vmlinuz-4.2.0-21-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.2.0-21-generic /boot/vmlinuz-4.2.0-21-generic
Error! Your kernel headers for kernel 4.2.0-21-generic cannot be found.
Please install the linux-headers-4.2.0-21-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.2.0-21-generic cannot be found.
Please install the linux-headers-4.2.0-21-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.2.0-21-generic /boot/vmlinuz-4.2.0-21-generic
update-initramfs: Generating /boot/initrd.img-4.2.0-21-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.2.0-21-generic /boot/vmlinuz-4.2.0-21-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.2.0-21-generic /boot/vmlinuz-4.2.0-21-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.2.0-21-generic /boot/vmlinuz-4.2.0-21-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.2.0-21-generic /boot/vmlinuz-4.2.0-21-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.2.0-23-generic
Found initrd image: /boot/initrd.img-4.2.0-23-generic
Found linux image: /boot/vmlinuz-4.2.0-22-generic
Found initrd image: /boot/initrd.img-4.2.0-22-generic
Found linux image: /boot/vmlinuz-4.2.0-21-generic
Found initrd image: /boot/initrd.img-4.2.0-21-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
done
Removing linux-image-4.2.0-21-generic (4.2.0-21.25) ...
Examining /etc/kernel/prerm.d.
run-parts: executing /etc/kernel/prerm.d/dkms 4.2.0-21-generic /boot/vmlinuz-4.2.0-21-generic
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.2.0-21-generic /boot/vmlinuz-4.2.0-21-generic
update-initramfs: Deleting /boot/initrd.img-4.2.0-21-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.2.0-21-generic /boot/vmlinuz-4.2.0-21-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.2.0-23-generic
Found initrd image: /boot/initrd.img-4.2.0-23-generic
Found linux image: /boot/vmlinuz-4.2.0-22-generic
Found initrd image: /boot/initrd.img-4.2.0-22-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
done
答案1
没有任何linux-{image,image-extra,header}-<version>-generic
软件包会为 增加任何内容/etc
。您可以通过快速检查当前安装的内核软件包来确认这一点:
grep /etc /var/lib/dpkg/info/linux-{image,headers}*.list
输出将为空。.conffiles
中缺少这些软件包也进一步证实了这一点/var/lib/dpkg/info/
。 因此,您不需要清除这些软件包;对于内核软件包而言,删除和清除实际上是相同的。
删除这些包之后剩下的是dpkg
本身存储的信息(在/var/lib/dpkg/info
):postrm
软件包维护者脚本、文件列表等。清除的最后一步是运行postrm
和删除postrm
自身(以及可能包含的任何其他信息dpkg
,例如文件列表)——这通常不是正常删除所为。您可能会看到一堆linux-image*.postrm
文件/var/lib/dpkg/info/
。