我读过各种问题和答案。我尝试了很多方法,但无法删除启动分区内的任何文件。它不让我做任何事情,因为显然,在卸载某些东西的过程中,它需要安装(我猜)卸载程序。考虑到没有剩余空间,此过程会关闭删除过程。我尝试过一个接一个地删除它们。我不知道该怎么做。
我正在附加该屏幕的副本。
我附上了“df -h”的打印输出,磁盘上确实有多余的空间,但“/boot”除外,这个分区给我带来了麻烦。我无法安装 Synaptic 或 Janitor 之类的东西,因为每次我尝试安装时,它都会告诉我没有可用空间。
mauricio@FileServer:~$ df -h 文件系统 大小 已用 可用 使用率% 挂载于 udev 2.0G 0 2.0G 0% /dev tmpfs 397M 6.8M 390M 2% /run /dev/mapper/FileServer--vg-root 70G 19G 47G 29% / tmpfs 2.0G 164K 2.0G 1% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/sda1 236M 230M 0 100% /boot cgmfs 100K 0 100K 0% /run/cgmanager/fs tmpfs 397M 52K 397M 1% /run/user/1000 /home/mauricio/.Private 70G 19G 47G 29% /home/mauricio
如果删除有问题,有没有办法将这些文件移动到有 47G 的分区?完成后,它可能会让我安装 Synaptic,然后完全删除它们。mauricio@FileServer:~$ sudo apt-get purge linux-image-3.19.0.32-generic 正在读取软件包列表... 完成 构建依赖关系树
正在读取状态信息... 完成 注意,为正则表达式“linux-image-3.19.0.32-generic”选择“linux-image-3.19.0-32-generic” 软件包“linux-image-3.19.0-32-generic”未安装,因此未被删除 以下软件包已自动安装,不再需要: linux-headers-3.19.0-28 linux-headers-3.19.0-28-generic linux-image-3.19.0-28-generic linux-image-extra-3.19.0-28-generic 使用“apt-get autoremove”将其删除。 以下软件包将被删除: linux-image-extra-3.19.0-30-generic linux-image-extra-3.19.0-68-generic 升级了 0 个软件包,新安装了 0 个软件包,要删除 2 个软件包,未升级 250 个软件包。 4 未完全安装或删除。此操作后,将释放 240 MB 磁盘空间。是否要继续? [Y/n] y(正在读取数据库...当前安装了 429896 个文件和目录。)正在删除 linux-image-extra-3.19.0-30-generic(3.19.0-30.34)... depmod:严重错误:无法加载 /boot/System.map-3.19.0-30-generic:没有此文件或目录 run-parts:正在执行 /etc/kernel/postinst.d/apt-auto-removal 3.19.0-30-generic /boot/vmlinuz-3.19.0-30-generic run-parts:正在执行 /etc/kernel/postinst.d/initramfs-tools 3.19.0-30-generic /boot/vmlinuz-3.19.0-30-generic update-initramfs:正在生成 /boot/initrd.img-3.19.0-30-generic grep: /boot/config-3.19.0-30-generic:没有此文件或目录 depmod:警告:无法打开 /tmp/mkinitramfs_63yTe9/lib/modules/3.19.0-30-generic/modules.order:没有此文件或目录 depmod:警告:无法打开 /tmp/mkinitramfs_63yTe9/lib/modules/3.19.0-30-generic/modules.builtin:没有此文件或目录 run-parts:执行 /etc/kernel/postinst.d/pm-utils 3.19.0-30-generic /boot/vmlinuz-3.19.0-30-generic run-parts:执行 /etc/kernel/postinst.d/unattended-upgrades 3.19.0-30-generic /boot/vmlinuz-3.19.0-30-generic运行部分:执行 /etc/kernel/postinst.d/update-notifier 3.19.0-30-generic /boot/vmlinuz-3.19.0-30-generic 运行部分:执行 /etc/kernel/postinst.d/zz-update-grub 3.19.0-30-generic /boot/vmlinuz-3.19.0-30-generic 正在生成 grub 配置文件... 找到 linux 映像:/boot/vmlinuz-3.19.0-28-generic 找到 linux 映像:/boot/vmlinuz-3.19.0-26-generic 找到 initrd 映像:/boot/initrd.img-3.19.0-26-generic 找到 linux 映像:/boot/vmlinuz-3.19.0-25-generic 找到 initrd 映像: /boot/initrd.img-3.19.0-25-generic 找到 linux 映像:/boot/vmlinuz-3.19.0-23-generic 找到 initrd 映像:/boot/initrd.img-3.19.0-23-generic 找到 linux 映像:/boot/vmlinuz-3.19.0-22-generic 找到 initrd 映像:/boot/initrd.img-3.19.0-22-generic 找到 linux 映像:/boot/vmlinuz-3.19.0-15-generic 找到 initrd 映像:/boot/initrd.img-3.19.0-15-generic 找到 memtest86+ 映像:/memtest86+.elf 找到 memtest86+ 映像:/memtest86+.bin 完成 正在删除 linux-image-extra-3.19.0-68-generic (3.19.0-68.76)... depmod:严重:无法加载 /boot/System.map-3.19.0-68-generic:没有此文件或目录 run-parts:执行 /etc/kernel/postinst.d/apt-auto-removal 3.19.0-68-generic /boot/vmlinuz-3.19.0-68-generic run-parts:执行 /etc/kernel/postinst.d/initramfs-tools 3.19.0-68-generic /boot/vmlinuz-3.19.0-68-generic update-initramfs:生成 /boot/initrd.img-3.19.0-68-generic grep:/boot/config-3.19.0-68-generic:没有此文件或目录 depmod:警告:无法打开 /lib/modules/3.19.0-68-generic/modules.order:没有此文件或目录 depmod:警告:无法打开/lib/modules/3.19.0-68-generic/modules.builtin:没有此文件或目录 depmod:警告:无法打开 /tmp/mkinitramfs_AdGJ3X/lib/modules/3.19.0-68-generic/modules.order:没有此文件或目录 depmod:警告:无法打开 /tmp/mkinitramfs_AdGJ3X/lib/modules/3.19.0-68-generic/modules.builtin:没有此文件或目录
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.19.0-68-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.19.0-68-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-3.19.0-68-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
mauricio@FileServer:~$ dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | xargs sudo apt-get -y purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.19.0-28 linux-headers-3.19.0-28-generic linux-image-3.19.0-28-generic linux-image-extra-3.19.0-28-generic
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
linux-image-3.19.0-15-generic* linux-image-3.19.0-22-generic* linux-image-3.19.0-23-generic* linux-image-3.19.0-25-generic*
linux-image-extra-3.19.0-15-generic* linux-image-extra-3.19.0-22-generic* linux-image-extra-3.19.0-23-generic*
linux-image-extra-3.19.0-25-generic* linux-image-extra-3.19.0-68-generic
0 upgraded, 0 newly installed, 9 to remove and 250 not upgraded.
3 not fully installed or removed.
After this operation, 745 MB disk space will be freed.
(Reading database ... 429896 files and directories currently installed.)
Removing linux-image-extra-3.19.0-68-generic (3.19.0-68.76) ...
depmod: FATAL: could not load /boot/System.map-3.19.0-68-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-68-generic /boot/vmlinuz-3.19.0-68-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-68-generic /boot/vmlinuz-3.19.0-68-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-68-generic
grep: /boot/config-3.19.0-68-generic: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_qJmuNX/lib/modules/3.19.0-68-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_qJmuNX/lib/modules/3.19.0-68-generic/modules.builtin: No such file or directory
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.19.0-68-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.19.0-68-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-3.19.0-68-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
mauricio@FileServer:~$ echo $(dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p') $(dpkg --list | grep linux-headers | awk '{ print $2 }' | sort -V | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p') | xargs sudo apt-get -y purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.19.0-28 linux-headers-3.19.0-28-generic linux-image-3.19.0-28-generic linux-image-extra-3.19.0-28-generic
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
linux-headers-3.19.0-15* linux-headers-3.19.0-15-generic* linux-headers-3.19.0-22* linux-headers-3.19.0-22-generic*
linux-headers-3.19.0-23* linux-headers-3.19.0-23-generic* linux-headers-3.19.0-25* linux-headers-3.19.0-25-generic*
linux-image-3.19.0-15-generic* linux-image-3.19.0-22-generic* linux-image-3.19.0-23-generic* linux-image-3.19.0-25-generic*
linux-image-extra-3.19.0-15-generic* linux-image-extra-3.19.0-22-generic* linux-image-extra-3.19.0-23-generic*
linux-image-extra-3.19.0-25-generic* linux-image-extra-3.19.0-68-generic
0 upgraded, 0 newly installed, 17 to remove and 250 not upgraded.
3 not fully installed or removed.
After this operation, 1,064 MB disk space will be freed.
(Reading database ... 429896 files and directories currently installed.)
Removing linux-image-extra-3.19.0-68-generic (3.19.0-68.76) ...
depmod: FATAL: could not load /boot/System.map-3.19.0-68-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-68-generic /boot/vmlinuz-3.19.0-68-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-68-generic /boot/vmlinuz-3.19.0-68-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-68-generic
grep: /boot/config-3.19.0-68-generic: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_Mv7Ib3/lib/modules/3.19.0-68-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_Mv7Ib3/lib/modules/3.19.0-68-generic/modules.builtin: No such file or directory
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.19.0-68-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.19.0-68-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-3.19.0-68-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
mauricio@FileServer:~$ dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'|grep -E "(image|headers)" | xargs sudo apt-get -y purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-image-3.19.0-28-generic linux-image-extra-3.19.0-28-generic
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
linux-headers-3.19.0-15* linux-headers-3.19.0-15-generic* linux-headers-3.19.0-22* linux-headers-3.19.0-22-generic*
linux-headers-3.19.0-23* linux-headers-3.19.0-23-generic* linux-headers-3.19.0-25* linux-headers-3.19.0-25-generic*
linux-headers-3.19.0-28* linux-headers-3.19.0-28-generic* linux-headers-3.19.0-30* linux-headers-3.19.0-30-generic*
linux-headers-3.19.0-31* linux-headers-3.19.0-31-generic* linux-headers-3.19.0-32* linux-headers-3.19.0-32-generic*
linux-headers-3.19.0-68* linux-headers-3.19.0-68-generic* linux-headers-generic* linux-image-3.19.0-15-generic*
linux-image-3.19.0-22-generic* linux-image-3.19.0-23-generic* linux-image-3.19.0-25-generic*
linux-image-extra-3.19.0-15-generic* linux-image-extra-3.19.0-22-generic* linux-image-extra-3.19.0-23-generic*
linux-image-extra-3.19.0-25-generic* linux-image-extra-3.19.0-68-generic
0 upgraded, 0 newly installed, 28 to remove and 250 not upgraded.
3 not fully installed or removed.
After this operation, 1,464 MB disk space will be freed.
(Reading database ... 429896 files and directories currently installed.)
Removing linux-image-extra-3.19.0-68-generic (3.19.0-68.76) ...
depmod: FATAL: could not load /boot/System.map-3.19.0-68-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-68-generic /boot/vmlinuz-3.19.0-68-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-68-generic /boot/vmlinuz-3.19.0-68-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-68-generic
grep: /boot/config-3.19.0-68-generic: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_5SBtjc/lib/modules/3.19.0-68-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_5SBtjc/lib/modules/3.19.0-68-generic/modules.builtin: No such file or directory
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.19.0-68-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.19.0-68-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-3.19.0-68-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
检查启动分区上的可用空间df -h
。根据输出“gzip:stdout:设备上没有剩余空间”,可能需要释放一些空间或将分区调整得更大
答案2
我最初认为 @GrannySez 为您指明了正确的方向。这可能仍然是正确的。可能整个驱动器都已满,或者 /var 或 /boot 分区已满。如果您按照老式的做法“将所有内容放在单独的分区中”,那么您现在会看到损坏。另一方面,如果您将所有内容都放在 / 中的一个大分区中,那么您会看到允许 /home 或 /tmp 填满垃圾的危险。
重新阅读您的消息后,我认为您的命令行输入有误。您的包名称错误。如果您更仔细地查看输出,则需要删除名为以下内容的内容:
Linux-映像-3.19.0-28-通用
但是命令行末尾有“0.28”。看看你的输出,你就会明白我的意思。
这种拼写错误让人很郁闷。如果 apt-get 对你有用,我会说“安装 synaptic,一个不错的 GUI 包管理器”。使用它删除包更容易,因为它会处理拼写问题。但由于 apt-get 卡住了,我怀疑现在行不通了。
首先,假设您在 /、/var 和 /tmp 中有足够的空间。而 /boot 已满。“df”会告诉您是否有 /boot。实际上,这是最好的情况!这对我来说似乎不太可能,因为现在默认安装不会有单独的 /boot。
我保留了 2 个旧内核。在 shell 中运行“dpkg -l | grep linux-image”以获取您拥有的所有内核的列表。这将打印出完整名称,您可以将其复制/粘贴到删除多余内核的命令中。
我建议使用 dpkg --purge 而不是 apt-get 来删除旧版本。我担心 apt-get 软件包数据库可能处于不良状态。我会直接运行 dpkg,完全绕过 apt-get 子系统。
dpkg --purge linux-image-4.4.0-32-generic
我相信我输入的是正确的。如果您遇到“/boot”太满的问题,这种事情可以完全解决问题。我通常在系统中保留 2 个旧内核。
顺便问一下,apt-get 输出中推荐的“autoremove”功能有效吗?我担心它会失败,因为 apt-get 无法获得处理软件包数据库所需的可用空间。
当 /boot 已满,而您又无法让系统将其清除时,您最后的绝望之举就是打开 /boot 并查看您拥有的内容。如果您看到大量“vmlinuz**”文件,您就会知道。如果您运行“ls -la”,您可能会惊讶地看到大量巨型文件“initrd.img-*”。当包管理器出现故障时,我有时会手动删除文件,然后再删除。然而,这是最后的绝望之举。那些 initrd 文件已经变得如此巨大,旧的文件毫无用处。
如果您的磁盘确实已满,而不仅仅是 /boot 分区,则尽快清理空间很重要,否则您很可能很快就会出现内核恐慌,并且许多重要的记录保存系统将失败。我担心在我发布这篇文章时它已经失败了。
删除一些东西,快点 :)。如果 /home 不在单独的分区中,您可能会发现您的某个用户用星球大战的旧副本填满了 /home,从而填满了整个 / 分区。/tmp 也可能充满了旧垃圾。