apt-get 安装软件时出现:“文件尺寸不符” 问题
阅读原文时间:2023年07月12日阅读:1

报错信息

命中:1 http://packages.deepin.com/deepin panda InRelease
命中:2 http://linux.teamviewer.com/deb stable InRelease
忽略:3 http://update.send-anywhere.com/linux/debian stable InRelease
获取:4 http://update.send-anywhere.com/linux/debian stable Release [2,392 B]
获取:5 http://update.send-anywhere.com/linux/debian stable Release.gpg [490 B]
获取:7 http://update.send-anywhere.com/linux/debian stable/main amd64 Packages [496 B]
获取:6 http://219.238.7.73/files/112100000261AD1F/debian.cn99.com/debian stable/main i386 Packages [499 B]
错误:6 http://219.238.7.73/files/112100000261AD1F/debian.cn99.com/debian stable/main i386 Packages
  文件尺寸不符(6568728 != 499)。您使用的镜像正在同步中? [IP: 219.238.7.73 80]
  Hashes of expected file:
   - Filesize:499 [weak]
   - SHA256:65b2922437745feedb69fb9b4e2e54a96b7e8da08c55efa4b7779ea43a53d7ae
   - SHA1:ae261f282f20cc3cf9c946ef329d7431fa6716f1 [weak]
   - MD5Sum:cc9d77dd377a41a714e37e09ae26e57c [weak]
  Release file created at: Thu, 19 Jul 2018 10:34:47 +0000
已下载 2,882 B,耗时 3秒 (957 B/s)
正在读取软件包列表... 完成
E: 无法下载 http://219.238.7.73/files/112100 ... y-i386/Packages.bz2  文件尺寸不符(6568728 != 499)。您使用的镜像正在同步中? [IP: 219.238.7.73 80]
   Hashes of expected file:
    - Filesize:499 [weak]
    - SHA256:65b2922437745feedb69fb9b4e2e54a96b7e8da08c55efa4b7779ea43a53d7ae
    - SHA1:ae261f282f20cc3cf9c946ef329d7431fa6716f1 [weak]
    - MD5Sum:cc9d77dd377a41a714e37e09ae26e57c [weak]
   Release file created at: Thu, 19 Jul 2018 10:34:47 +0000
E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。

问题分析

报错是因为需要安装某个依赖库,但是在安装过程中找不到该依赖,原因位置。可尝试解决方法:

  • 代理
  • 修改软件源

问题修复

1)备份源文件:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2)查看版本信息

如是Linux Mint等Ubuntu衍生版,执行:

cat /etc/upstream-release/lsb-release

如是Ubuntu直接执行:

lsb_release -c

确认当前系统代号(Codename)为:bionic。如是其他版本,请使用其他版本的软件源,其中:

Ubuntu 12.04 (LTS)代号为precise。
Ubuntu 14.04 (LTS)代号为trusty。
Ubuntu 15.04 代号为vivid。
Ubuntu 15.10 代号为wily。
Ubuntu 16.04 (LTS)代号为xenial。

3)修改sources.list:

修改/etc/apt/sources.list为以下内容:

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

4)检查更新

sudo apt-get update

5)重新安装软件

sudo apt-get install XXX

参考资料

https://blog.csdn.net/zhangjiahao14/article/details/80554616

https://bbs.deepin.org/forum.php?mod=viewthread&tid=167810