16.04升级:无法获取空文件无法成为有效的存档

从15.10升级到16.04后,我在apt-get update上收到以下错误:

 Reading package lists... Done E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/restricted/source/Sources Empty files can't be valid archives E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/universe/source/Sources Empty files can't be valid archives E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/multiverse/source/Sources Empty files can't be valid archives E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/restricted/binary-amd64/Packages Empty files can't be valid archives E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/restricted/binary-i386/Packages Empty files can't be valid archives E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/restricted/i18n/Translation-en Empty files can't be valid archives E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/universe/binary-amd64/Packages Empty files can't be valid archives E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/universe/binary-i386/Packages Empty files can't be valid archives E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/universe/i18n/Translation-en Empty files can't be valid archives E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/multiverse/binary-amd64/Packages Empty files can't be valid archives E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/multiverse/binary-i386/Packages Empty files can't be valid archives E: Some index files failed to download. They have been ignored, or old ones used instead. 

有谁知道如何解决这个错误?

转到“Ubuntu软件中心 – >编辑 – >软件源”
从“下载自”中选择并选择“其他…”,然后单击“选择最佳服务器”。 这需要一些时间……它为您提供最好的服务器。 然后选择该服务器并再次输入以下命令,

 sudo apt-get update 

解决了这个问题:

 sudo cd /etc/apt sudo mv sources.list sources.list.ok sudo echo < sources.list sudo apt-get clean sudo apt-get update 

更新和升级后,您可以将sources.list恢复为原始!!

我在升级后的几个月里得到了这个,但只是运行:

 apt-get clean 

固定它。 无需像其他人所建议的那样更改源服务器。

 apt-get clean 

为我工作的同时:

 apt-key update 

并按照这个答案中的步骤:

无法解决GPG错误