FROM : http://blog.csdn.net/ronghua_liu/article/details/8609450

当运行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即可!自带源在大陆不好。

出现以下错误:

  1. /etc/apt$ sudo apt-get update
  2. Err http://security.ubuntu.com precise-security InRelease
  3. Err http://security.ubuntu.com precise-security Release.gpg
  4. Temporary failure resolving 'security.ubuntu.com'
  5. Err http://cn.archive.ubuntu.com precise InRelease
  6. Err http://cn.archive.ubuntu.com precise-updates InRelease
  7. Err http://cn.archive.ubuntu.com precise-backports InRelease
  8. Err http://cn.archive.ubuntu.com precise Release.gpg
  9. Temporary failure resolving 'cn.archive.ubuntu.com'
  10. Err http://cn.archive.ubuntu.com precise-updates Release.gpg
  11. Temporary failure resolving 'cn.archive.ubuntu.com'
  12. Err http://cn.archive.ubuntu.com precise-backports Release.gpg
  13. Temporary failure resolving 'cn.archive.ubuntu.com'
  14. Reading package lists... Done
  15. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise/InRelease
  16. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease
  17. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease
  18. W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease
  19. W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg  Temporary failure resolving 'security.ubuntu.com'
  20. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg  Temporary failure resolving 'cn.archive.ubuntu.com'
  21. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/Release.gpg  Temporary failure resolving 'cn.archive.ubuntu.com'
  22. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/Release.gpg  Temporary failure resolving 'cn.archive.ubuntu.com'
  23. W: Some index files failed to download. They have been ignored, or old ones used instead.
  24. xinju@xinjuOffice:/etc/apt$ cd ../network

阿里源:

  1. deb http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
  2. deb http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
  3. deb http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
  4. deb http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
  5. deb http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
  6. deb-src http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
  7. deb-src http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
  8. deb-src http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
  9. deb-src http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
  10. deb-src http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse

修改ip:

  1. # This file describes the network interfaces available on your system
  2. # and how to activate them. For more information, see interfaces(5).
  3. # The loopback network interface
  4. auto lo
  5. iface lo inet loopback
  6. # The primary network interfacea
  7. auto eth0
  8. iface eth0 inet static
  9. address 192.168.2.170
  10. netmask 255.255.255.0
  11. broadcast 192.168.2.255
  12. gateway 192.168.2.1
  13. dns-nameservers 192.168.2.1

修改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。即可

【转】ubuntu apt-get update 失败解决的更多相关文章

  1. Ubuntu系统 apt-get update失败解决办法

    使用apt-get的时候发现ubuntu和阿里云均已经不提供该版本的源,所以需要找到其他的替代源. 使用的ubuntu版本是14.10,属于非LTS(长期支持版本),因此前一段时间还可以使用apt-g ...

  2. ubuntu sudo apt-get update 失败 解决方法

    sudo apt-get update 报了一堆错误: Err http://cn.archive.ubuntu.com trusty InRelease Err http://cn.archive. ...

  3. ubuntu apt-get update失败 解决方法

    ubuntu apt-get update失败 1.出现错误:E:Could not get lock /var/lib/apt/lists/lock - open (11: Resource tem ...

  4. ubuntu apt-get update 失败解决

    在执行 sudo apt-get update 之后  会出现如下错误 这是要检测网络是否有问题 因为我之前只使用nfs挂载的时候,在虚拟机  编辑-> 虚拟网络编辑器里面->更改设置里面 ...

  5. Ubuntu中无法update的解决办法

    我输入 sudo apt-get update 出现错误: /etc/apt$ sudo apt-get update Err http://security.ubuntu.com precise-s ...

  6. Ubuntu 16.04 LTS: apt-get update 失败处理 Aborted (core dumped)

    在Ubuntu 16.04运行sudo apt-get update出现如下错误: rogn@ubuntu:~$ sudo apt-get update Get:1 http://us.archive ...

  7. 解决配置Windows Update失败问题

    大家都清楚电脑总是需要更新一些补丁,不过,很多系统用户发现更新了补丁之后,开机会出现windows update更新失败的情况,提示“配置Windows Update失败,还原更改,请勿关闭计算机”信 ...

  8. 解决配置Windows Update失败,还原更改问题

    问题描述 由于配置Windows Update失败,还原更改状态下无法正常关机.只能长按电源键关机后进入WinPE环境. 解决步骤 进入WinPE环境->选择Dism++->选择版本-&g ...

  9. ubuntu apt update时W: GPG error http://ppa.launchpad.net lucid Release没有公钥无法验证NO_PUBKEY签名问题解决

    在安装更新时,即在运行命令行sudo apt-get update 或者运行更新管理器的时候,出现W: GPG 错误: W: GPG error: http://ppa.launchpad.net/o ...

随机推荐

  1. 如何删除 Win10此电脑 desktop 视频 图片 文档 下载 音乐等文件夹

    更改注册表; 1. WIN+R   输入[regedit]  打开注册表管理器 2. 找到路径[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curren ...

  2. rabbitmq学习(一) —— 安装篇

    安装篇之windows: 略(楼主在windows上安装基本就是按部就班的没遇到什么坑) 安装篇值centos7: 主要记录下centos7下的安装,因为在该系统下安装稍微折腾了下 参考https:/ ...

  3. codevs 1077 多源最短路

    题目描述 Description 已知n个点(n<=100),给你n*n的方阵,a[i,j]表示从第i个点到第j个点的直接距离. 现在有Q个询问,每个询问两个正整数,a和b,让你求a到b之间的最 ...

  4. poj 1797 最短路变形dijkstra

    题意:题目大意:有n个城市,m条道路,在每条道路上有一个承载量,现在要求从1到n城市最大承载量,而最大承载量就是从城市1到城市n所有通路上的最大承载量 链接:点我 解题思路:其实这个求最大边可以近似于 ...

  5. Java内存泄露分析和解决方案及Windows自带查看工具

    Java内存泄漏是每个Java程序员都会遇到的问题,程序在本地运行一切正常,可是布署到远端就会出现内存无限制的增长,最后系统瘫痪,那么如何最快最好的检测程序的稳定性,防止系统崩盘,作者用自已的亲身经历 ...

  6. Ural 2040. Palindromes and Super Abilities 2 回文自动机

    2040. Palindromes and Super Abilities 2 题目连接: http://acm.timus.ru/problem.aspx?space=1&num=2040 ...

  7. CCCC 成都信息工程大学游记

    晚上刷智障25人本,刷到深夜四点,然后迷迷糊糊8点钟起床上车睡觉,然后就到了信息工程大学. 然后开始抢衣服,抢完衣服就开始拍照. 对了,这个学校看了下地图,好小呀,不过妹子好多呀. 然后就被老师带进机 ...

  8. iOS9UICollectionView自定义布局modifying attributes returned by UICollectionViewFlowLayout without copying them

    UICollectionViewFlowLayout has cached frame mismatch This is likely occurring because the flow layou ...

  9. C#快速找出磁盘内的所有文件

    本文只针对NTFS格式化的磁盘文件快速检索,速度不是非常快,是让你震惊. 一般用文件遍历的方法检索一个50G的文件夹需要几十分钟甚至一个小时的时间,而用本方法只需几秒. using System; u ...

  10. VGA Signal Timing

    VGA Signal Timing 640 x 350 VGA 640x350@70 Hz (pixel clock 25.175 MHz) VESA 640x350@85 Hz (pixel clo ...