无法读取路径的状态(即将安装):输入/输出错误

无法读取路径的状态(即将安装):输入/输出错误

我正在使用没有 systemd 的 Debian bullseye(devuan),今天我想升级我的软件包。所以我输入了

sudo apt upgrade

它不起作用,因为我收到以下错误(请注意,此错误是使用谷歌翻译从瑞典语操作系统翻译成英语的):

dpkg: error processing archive /var/cache/apt/archives/linux-image-5.10.0-25-amd64_5.10.191-1_amd64.deb (--unpack):
  could not read status of "./boot/System.map-5.10.0-25-amd64" (which was just about to install): Input/output error
dpkg-deb: error: subprocess paste was killed by signal (The pipe was broken)
W: Last kernel image has been removed, so removing the default symlinks
An error occurred while processing:
 /var/cache/apt/archives/linux-image-5.10.0-25-amd64_5.10.191-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

当我尝试使用时apt --fix-broken install,它仍然不起作用。

我尝试在 Google 上搜索,但没有找到类似问题。这是什么意思?我该如何调试和修复它?


编辑:

$ cat /etc/apt/sources.list
# deb cdrom:[Devuan GNU/Linux 4.0 chimaera amd64 - desktop 20211012]/ chimaera contrib main non-free

deb http://deb.devuan.org/merged chimaera main
deb-src http://deb.devuan.org/merged chimaera main

deb http://pkgmaster.devuan.org/merged chimaera-security main
deb-src http://pkgmaster.devuan.org/merged chimaera-security main

# chimaera-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://deb.devuan.org/merged chimaera-updates main
deb-src http://deb.devuan.org/merged chimaera-updates main

编辑 2:我解决了我的问题。问题是我的 /boot 目录位于可移动 USB 驱动器上,我在启动后将其删除。当我尝试在插入 USB 驱动器的情况下重复该过程时,一切正常。

答案1

几个月后,我终于解决了这个问题。评论中建议将解决方案写成答案。问题是,我的 /boot 目录位于可移动 USB 驱动器上,启动后我会将其拔下。当我尝试在插入 USB 驱动器的情况下重复该过程时,一切正常。所以这是一个输入/输出错误是由于硬件问题导致的示例。

答案2

您可以LC_ALL=C在命令前添加将语言环境设置为 C 的前缀,这样输出结果就会以英语显示。实际的英语错误可能如下所示:

dpkg: error processing archive /var/cache/apt/archives/linux-image-5.10.0-25-amd64_5.10.191-1_amd64.deb (--unpack):
  unable to stat './boot/System.map-5.10.0-25-amd64' (which I was about to install): Input/output error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
W: Last kernel image has been removed, so removing the default symlinks
Errors were encountered while processing:
  /var/cache/apt/archives/linux-image-5.10.0-25-amd64_5.10.191-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

这意味着apt无法读取deb位于的已下载包的存档,特别是目录中的/var/cache/apt/archives/linux-image-5.10.0-25-amd64_5.10.191-1_amd64.deb文件。这可能是由于从存储库获取时将包的存档写入磁盘或下载不正确。此处的 I/O 错误可能是由于无法将解包子进程的输出作为进一步处理的输入传递。System.map-5.10.0-25-amd64bootlinux-image-5.10.0-25-amd64

我会尝试清理整个apt缓存,包括下载的存档,然后再次进行升级。

$ sudo apt clean
$ sudo apt update
$ sudo apt upgrade

Devuan Chimaera 4.0 的默认 apt 源列表,基于 Debian Bullseye 11.1 并具有 Linux 内核 5.10, 是:

$ cat /etc/apt/sources.list
# deb cdrom:[Devuan GNU/Linux 4.0 chimaera amd64 - netinstall 20211012]/ chimaera contrib main non-free

#deb cdrom:[Devuan GNU/Linux 4.0 chimaera amd64 - netinstall 20211012]/ chimaera contrib main non-free

deb http://deb.devuan.org/merged chimaera main
deb-src http://deb.devuan.org/merged chimaera main

deb http://pkgmaster.devuan.org/merged chimaera-security main contrib non-free
deb-src http://pkgmaster.devuan.org/merged chimaera-security main contrib non-free

# chimaera-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://deb.devuan.org/merged chimaera-updates main contrib non-free
deb-src http://deb.devuan.org/merged chimaera-updates main contrib non-free

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.

注释掉的每行都#可以跳过,因为它只是一条未使用的注释。如果您正在使用这些存储库中的软件,例如笔记本电脑常见的非免费 Wi-Fi 固件,则可能需要contrib non-free在后面添加。以 开头的行用于源,在软件包的常规安装和升级中不使用。maindeb-src

附加源条目可能隐藏在sources.list.d目录中,默认情况下该目录为空:

$ ls /etc/apt/sources.list.d
$

答案3

这可能是几个原因,磁盘错误本身可能就是其中之一,请尝试 fsck 并查看是否有帮助。sudo fsck -f /dev/{device}

其次,我会尝试彻底清理 apt 缓存“sudo apt clean”

然后尝试重新配置/重新安装

sudo dpkg --configure -a

sudo apt-get install --reinstall {affected package}

除此之外,这可能会变成一些脑部手术,最终变得不值得,系统可能会被简单地摧毁/重新加载。

相关内容