我输入 sudo apt-get update 出现错误:
/etc/apt$ sudo apt-get update
Err http://security.ubuntu.com precise-security InRelease
Err http://security.ubuntu.com precise-security Release.gpg
Temporary failure resolving 'security.ubuntu.com'
Err http://cn.archive.ubuntu.com precise InRelease
Err http://cn.archive.ubuntu.com precise-updates InRelease
Err http://cn.archive.ubuntu.com precise-backports InRelease
Err http://cn.archive.ubuntu.com precise Release.gpg
Temporary failure resolving 'cn.archive.ubuntu.com'
Err http://cn.archive.ubuntu.com precise-updates Release.gpg
Temporary failure resolving 'cn.archive.ubuntu.com'
Err http://cn.archive.ubuntu.com precise-backports Release.gpg
Temporary failure resolving 'cn.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise/InRelease
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg Temporary failure resolving 'cn.archive.ubuntu.com'
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/Release.gpg Temporary failure resolving 'cn.archive.ubuntu.com'
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/Release.gpg Temporary failure resolving 'cn.archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
xinju@xinjuOffice:/etc/apt$ cd ../network
(错误当时没有记录下来上网找到了同样错误的提示!)
——-下面我们就一起讨论下这个情况!
所有停止维护的版本都可以使用old源。所以在元列表中把原来的地址改为带有old源的就可以了。
首先,备份系统中的源列表,打开终端,输入
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
4.输入
sudo gedit /etc/apt/sources.list
打开源列表文件,ctrl+A,然后delete,删除全部内容
然后把下面的地址复制到该文件中:
deb http://old-releases.ubuntu.com/ubuntu utopic main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu utopic-security main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu utopic-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu utopic-proposed main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu utopic-backports main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu utopic main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu utopic-security main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu utopic-updates main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu utopic-proposed main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu utopic-backports main restricted universe multiverse
5.需要注意的是上面地址中的 utopic是ubuntu系统版本的名称,我的ubuntu系统是14.10,对应的版本名称是utopic。只要把这里的utopic换车你自己系统版本的名称即可,如果不知道版本名称的话,可以运行以下命令获得
lsb_release -a
其中,Codename就是了。
6.保存好源列表文件后,进入到终端,一定要再输入以下命令
sudo apt-get update
来进行更新,会看到没有失败的提示了,转而出现“命中,获取中”等字眼。
本文为转载,出处为图片 上的网址。