当运行apt-get update后出现如下错误时:
E: Some index files failed to download, they have been ignored, or old ones used instead.
可以将目录下/var/lib/apt/lists/partial/所有的文件清掉,再次运行apt-get update即可!自带源在大陆不好。
出现以下错误:
-
root@ubs1110x64v3:~# apt-get update
-
Ign http://us.archive.ubuntu.com oneiric InRelease
-
Ign http://us.archive.ubuntu.com oneiric-updates InRelease
-
Ign http://security.ubuntu.com oneiric-security InRelease
-
Ign http://security.ubuntu.com oneiric-security Release.gpg
-
Ign http://security.ubuntu.com oneiric-security Release
-
Ign http://security.ubuntu.com oneiric-security/main Sources/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric-backports InRelease
-
Ign http://security.ubuntu.com oneiric-security/restricted Sources/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric Release.gpg
-
Ign http://security.ubuntu.com oneiric-security/universe Sources/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric-updates Release.gpg
-
Ign http://us.archive.ubuntu.com oneiric-backports Release.gpg
-
Ign http://us.archive.ubuntu.com oneiric Release
-
Ign http://us.archive.ubuntu.com oneiric-updates Release
-
Ign http://us.archive.ubuntu.com oneiric-backports Release
-
Ign http://us.archive.ubuntu.com oneiric/main Sources/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric/restricted Sources/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric/universe Sources/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric/multiverse Sources/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric/main amd64 Packages/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric/restricted amd64 Packages/DiffIndex
-
Ign http://security.ubuntu.com oneiric-security/multiverse Sources/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric/universe amd64 Packages/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric/multiverse amd64 Packages/DiffIndex
-
Ign http://security.ubuntu.com oneiric-security/main amd64 Packages/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric/main i386 Packages/DiffIndex
-
Ign http://security.ubuntu.com oneiric-security/restricted amd64 Packages/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric/restricted i386 Packages/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric/universe i386 Packages/DiffIndex
-
Ign http://security.ubuntu.com oneiric-security/universe amd64 Packages/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric/multiverse i386 Packages/DiffIndex
-
Ign http://security.ubuntu.com oneiric-security/multiverse amd64 Packages/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric/main TranslationIndex
-
Ign http://us.archive.ubuntu.com oneiric/multiverse TranslationIndex
-
Ign http://us.archive.ubuntu.com oneiric/restricted TranslationIndex
-
Ign http://us.archive.ubuntu.com oneiric/universe TranslationIndex
-
Ign http://us.archive.ubuntu.com oneiric-updates/restricted Sources/DiffIndex
-
Ign http://security.ubuntu.com oneiric-security/main i386 Packages/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric-updates/multiverse Sources/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric-updates/restricted amd64 Packages/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric-updates/multiverse amd64 Packages/DiffIndex
-
Ign http://us.archive.ubuntu.com oneiric-updates/restricted i386 Packages/DiffIndex
-
root@ubs1110x64v3:~# rm -rf /var/lib/apt/lists/partial/*
-
root@ubs1110x64v3:~# apt-get update
-
Ign http://cn.archive.ubuntu.com lucid InRelease
-
Ign http://cn.archive.ubuntu.com lucid-updates InRelease
-
Get:1 http://cn.archive.ubuntu.com lucid Release.gpg [189 B]
-
Get:2 http://cn.archive.ubuntu.com lucid-updates Release.gpg [198 B]
-
Get:3 http://cn.archive.ubuntu.com lucid Release [57.2 kB]
-
Get:4 http://cn.archive.ubuntu.com lucid-updates Release [58.3 kB]
-
Get:5 http://cn.archive.ubuntu.com lucid/main Sources [659 kB]
-
Get:6 http://cn.archive.ubuntu.com lucid/restricted Sources [3,775 B]
-
Get:7 http://cn.archive.ubuntu.com lucid/universe Sources [3,165 kB]
-
Get:8 http://cn.archive.ubuntu.com lucid/multiverse Sources [119 kB]
-
Ign http://security.ubuntu.com lucid-security InRelease
-
Get:9 http://security.ubuntu.com lucid-security Release.gpg [198 B]
-
Get:10 http://security.ubuntu.com lucid-security Release [57.3 kB]
-
Get:11 http://cn.archive.ubuntu.com lucid/main amd64 Packages [1,383 kB]
-
Get:12 http://security.ubuntu.com lucid-security/main Sources [242 kB]
-
Get:13 http://cn.archive.ubuntu.com lucid/restricted amd64 Packages [6,193 B]
-
Get:14 http://cn.archive.ubuntu.com lucid/universe amd64 Packages [5,430 kB]
-
Get:15 http://security.ubuntu.com lucid-security/restricted Sources [1,267 B]
-
Get:16 http://security.ubuntu.com lucid-security/universe Sources [46.7 kB]
-
Get:17 http://security.ubuntu.com lucid-security/multiverse Sources [2,347 B]
-
Get:18 http://security.ubuntu.com lucid-security/main amd64 Packages [554 kB]
-
Get:19 http://cn.archive.ubuntu.com lucid/multiverse amd64 Packages [176 kB]
-
Get:20 http://cn.archive.ubuntu.com lucid/main i386 Packages [1,386 kB]
-
Get:21 http://cn.archive.ubuntu.com lucid/restricted i386 Packages [6,208 B]
-
Get:22 http://cn.archive.ubuntu.com lucid/universe i386 Packages [5,448 kB]
-
Get:23 http://cn.archive.ubuntu.com lucid/multiverse i386 Packages [180 kB]
-
root@ubs1110x64v3:~# rm -rf /var/lib/apt/lists/partial/*
-
root@ubs1110x64v3:~# apt-get update
-
Ign http://cn.archive.ubuntu.com lucid InRelease
-
Ign http://cn.archive.ubuntu.com lucid-updates InRelease
-
Get:1 http://cn.archive.ubuntu.com lucid Release.gpg [189 B]
-
Get:2 http://cn.archive.ubuntu.com lucid-updates Release.gpg [198 B]
-
Get:3 http://cn.archive.ubuntu.com lucid Release [57.2 kB]
-
Get:4 http://cn.archive.ubuntu.com lucid-updates Release [58.3 kB]
修改dns:
1,重启生效:
sudo vi /etc/resolvconf/resolv.conf.d/base(这个文件默认是空的)
在里面插入:
nameserver 8.8.8.8
nameserver 8.8.4.4
如果有多个DNS就一行一个
修改好保存,然后执行
sudo resolvconf -u
再看/etc/resolv.conf,最下面就多了2行:
cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 8.8.4.4
可以看到我们的设置已经加上了,然后再ping一个域名,当时就可以解析了,无需重启。
2,重启失效:
配置文件地址 /etc/resolv.conf
使用编辑器打开
改为如下内容:
search localdomain
nameserver 202.96.128.86 希望修改成的DNS
nameserver 202.96.128.166 备用DNS
重启网络:sudo /etc/init.d/networking restart。即可
阅读(9461) | 评论(2) | 转发(0) |