【转】ubuntu apt-get update 失败解决
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即可!自带源在大陆不好。
出现以下错误:
- /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
阿里源:
- deb http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
修改ip:
- # This file describes the network interfaces available on your system
- # and how to activate them. For more information, see interfaces(5).
- # The loopback network interface
- auto lo
- iface lo inet loopback
- # The primary network interfacea
- auto eth0
- iface eth0 inet static
- address 192.168.2.170
- netmask 255.255.255.0
- broadcast 192.168.2.255
- gateway 192.168.2.1
- 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 失败解决的更多相关文章
- Ubuntu系统 apt-get update失败解决办法
使用apt-get的时候发现ubuntu和阿里云均已经不提供该版本的源,所以需要找到其他的替代源. 使用的ubuntu版本是14.10,属于非LTS(长期支持版本),因此前一段时间还可以使用apt-g ...
- ubuntu sudo apt-get update 失败 解决方法
sudo apt-get update 报了一堆错误: Err http://cn.archive.ubuntu.com trusty InRelease Err http://cn.archive. ...
- ubuntu apt-get update失败 解决方法
ubuntu apt-get update失败 1.出现错误:E:Could not get lock /var/lib/apt/lists/lock - open (11: Resource tem ...
- ubuntu apt-get update 失败解决
在执行 sudo apt-get update 之后 会出现如下错误 这是要检测网络是否有问题 因为我之前只使用nfs挂载的时候,在虚拟机 编辑-> 虚拟网络编辑器里面->更改设置里面 ...
- Ubuntu中无法update的解决办法
我输入 sudo apt-get update 出现错误: /etc/apt$ sudo apt-get update Err http://security.ubuntu.com precise-s ...
- 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 ...
- 解决配置Windows Update失败问题
大家都清楚电脑总是需要更新一些补丁,不过,很多系统用户发现更新了补丁之后,开机会出现windows update更新失败的情况,提示“配置Windows Update失败,还原更改,请勿关闭计算机”信 ...
- 解决配置Windows Update失败,还原更改问题
问题描述 由于配置Windows Update失败,还原更改状态下无法正常关机.只能长按电源键关机后进入WinPE环境. 解决步骤 进入WinPE环境->选择Dism++->选择版本-&g ...
- 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 ...
随机推荐
- CSS------如何让div中的div处于右下角
如图: 代码: <div style="width:300px;height:300px"> <div style="position:absolute ...
- [ 转载 ] Python Web 框架:Django、Flask 与 Tornado 的性能对比
本文的数据涉及到我面试时遇到过的问题,大概一次 http 请求到收到响应需要多少时间.这个问题在实际工作中与框架有比较大的关系,因此特别就框架的性能做了一次分析. 这里使用 2016 年 6 月 9 ...
- spring boot学习总结(二)-- 关于@SpringBootApplication的一些基础知识点
1.@SpringBootApplication 它是一个复合Annotation,实际上对于SpringBoot应用来说,最重要的是只有三个 @Target(ElementType.TYPE) @R ...
- 使用GSON和泛型解析约定格式的JSON串(转)
时间紧张,先记一笔,后续优化与完善. 解决的问题: 使用GSON和泛型解析约定格式的JSON串. 背景介绍: 1.使用GSON来进行JSON串与java代码的互相转换. 2.JSON的格式如下三种: ...
- Introduction to Cortex Serial Wire Debugging
Serial Wire Debug (SWD) provides a debug port for severely pin limited packages, often the case for ...
- <table>标签的结构和合并单元格的方法
1.<table>标签的结构 示例代码: <table border="1"> <caption>信息统计表</captio ...
- WCF消息传递
通过了解了WCF的一些基本概念并创建和编写WCF应用中的相应方法,实现了WCF服务和客户端之间的调用,就能够理解WCF应用是如何进行通信的.了解了一些基本的WCF概念后,还需要深入了解WCF消息的概念 ...
- [Asp.net mvc]国际化
摘要 在实际项目中,经常遇到,开发的项目要提供给不同的国家使用,如果根据国家来开发不同的站点,肯定是非常耗时又耗成本的.asp.net中,提供了一种比较方便的方式,可以使用资源文件的方式,使我们的站点 ...
- 微软收购跨平台移动开发公司Xamarin
摘要:北京时间2月25日早间消息,微软周三宣布收购创业公司Xamarin,这也是该公司为了吸引更多软件工程师为其云计算服务编写程序而采取的最新举措.古斯里表示,总部位于旧金山的Xamarin创立于20 ...
- 阅读Linux内核源码时建立tags索引
比如在阅读arm架构的Linux内核代码时想建立arm架构相关的索引,可以使用下面的命令: make ARCH=arm tags