当然可能会有其它原因引起上面报错(校验和不符),这里仅供参考。
最近刚学习Linux,安装了Ubuntu,碰到了一些问题:
1、运行apt-get update时,会有些包报错:
W: Failed to fetch gzip:/var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_trusty_main_binary-amd64_Packages Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.
2、运行apt-get install nvidia-331时,会报错:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nvidia-331 : Depends: dkms but it is not installable
Depends: lib32gcc1 but it is not installable
Depends: libc6-i386 but it is not installable
Recommends: nvidia-settings (>= 331.20) but it is not installable
Recommends: nvidia-prime (>= 0.5) but it is not installable or
bumblebee but it is not installable
Recommends: libcuda1-331 but it is not going to be installed
Recommends: nvidia-libopencl1-331 but it is not going to be installed
Recommends: nvidia-opencl-icd-331 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
后来发现好像是网络的问题,我在北京,宽带是长城宽带,然后我有Goagent的代理(服务器端在GAE),在直接下载和使用代理下载同一个文件时发现两个下载的文件大小不一致,使用代理时文件是正确的。
我下载的文件是:
http://archive.ubuntu.com/ubuntu/dists/trusty/main/binary-amd64/Packages.bz2
从http://archive.ubuntu.com/ubuntu/dists/trusty/Release 可以看到上面文件的正确长度是1350329:
eb5ec6102dfe1dd632fda76e55a33f07 1350329 main/binary-amd64/Packages.bz2
而我不用代理直接下载的包只有1263292字节,所以md5肯定不对,所以会报错:Hash Sum mismatch
所以最后我设置代理后,再次运行了apt-get update,然后就没Hash Sum mismatch的问题了。
源正确后,又试了下apt-get install nvidia-331,发现也不报错了,可以正确安装了。
看来这网络环境真是让人担忧啊,下个东西都有问题。。。
来源:oschina
链接:https://my.oschina.net/u/1382972/blog/265746