ubuntu 执行apt-get update报错Failed to fetch

2023-05-16

在ubuntu下执行sudo apt-get update时,经常会遇到报错:

Err http://security.ubuntu.com precise-security InReleaseErr http://security.ubuntu.com precise-security Release.gpg  Temporary failure resolving 'security.ubuntu.com'Err http://cn.archive.ubuntu.com precise InReleaseErr http://cn.archive.ubuntu.com precise-updates InReleaseErr http://cn.archive.ubuntu.com precise-backports InReleaseErr 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... DoneW: 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.

一般都会推荐使用国内的镜像源,比如163或者阿里云的镜像服务器 
将下列文本添加到/etc/apt/sources.list文件里

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  

但是执行sudo apt-get update仍然报错,问题在于DNS没有配置好。 
解决方法:

sudo vi /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 OVERWRITTENnameserver 127.0.1.1#这里用的是阿里云的DNS服务器nameserver 223.5.5.5  nameserver 223.6.6.6

之后执行sudo apt-get update就正常了。

参考: 
ubuntu apt-get update 失败解决。 
Ubuntu操作系统“Failed to fetch”错误的解决方法 

转载于:https://www.cnblogs.com/yunhua-521/p/7117547.html

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ubuntu 执行apt-get update报错Failed to fetch 的相关文章

随机推荐

  • 归并排序——C语言

    归并排序 归并排序 xff08 MERGE SORT xff09 是建立在归并操作上的一种有效的排序算法 该算法采用经典的分治 xff08 divide and conquer xff09 策略 xff08 分治法将问题分 divide 成
  • Linux设备驱动程序学习(19)-USB 驱动程序(四)

    编写 USB 驱动程序 xff08 本部分的一些示例源码来自drivers usb usb skeleton c xff0c 它是Linux内核为我们提供的最基础的USB驱动程序 xff0c USB骨架程序 xff09 驱动程序把驱动对象注
  • Linux----面试

    1 tcp和udp的区别 TCP xff1a 是面向连接的流传输控制协议 xff0c 具有高可靠性 xff0c 确保传输数据的正确性 xff0c 有验证重发机制 xff0c 因此不会出现丢失或乱序 UDP xff1a 是无连接的数据报服务
  • ssh免密码登陆失败的原因

    今天因为需要在两台服务器上进行ssh免登陆 xff0c 所以安装网上的教程 xff0c ssh keygen t rsa xff0c 然后把相互的密钥加入到对方的authorized keys 问题是我们虽然这样做了 xff0c 却一直要密
  • ESP32-s2芯片esp32-s2-saola-1开发板 micropython的repl连接

    本文只是解决通过esp32 s2 saola 1开发板 自带microUSB 作为repl与micro python通信的问题 如果你对esp32 xff0c micropython不熟 xff0c 本文不适合你 如果你用的不是esp32
  • 机械臂模拟2.0

    机械臂模拟 void MobileCrane updateHopeLength int center x int center y int center z int armNodeNum int ropePitchNum int baseN
  • Qt获取时间戳作为图片名

    Qt获取时间戳作为图片名 保存图片 void SaveRealsenseImg QString picIndexName 61 dataSavePath picIndexName append 34 34 获取当前时间 QDateTime
  • [转&精]IO_STACK_LOCATION与IRP的一点笔记

    IO STACK LOCATION和IRP算是驱动中两个很基础的东西 xff0c 为了理解这两个东西 xff0c 找了一点资料 1 IRP可以看成是Win32窗口程序中的消息 xff08 Message xff09 xff0c DEVICE
  • wireshark抓包结果很多[TCP Retransmission]怎么办?

    有一同事问用wireshark抓包时发现很多 TCP Retransmission xff0c 这些包极大影响了自己真正想看的http数据包 xff0c 如下图 我拿到pcapng后首先看到这些包的来源ip都是固定的两个 xff0c 所以首
  • MATLAB神经网络训练结果各参数解释

    最上面的图形显示的是神经网络的结构图 xff0c 可知有一个隐层一个输出层 第二部分显示的是训练算法 xff0c 这里为学习率自适应的梯度下降BP算法 xff1b 误差指标为MSE 第三部分显示训练进度 xff1a Epoch xff1a
  • SQL语句统计个数大于一的记录

    1 主要是利用Having语句进行 xff0c 由于where不能与聚合函数一起使用 xff0c 所以用having SELECT MC COUNT MC AS SL FROM JSB GROUP BY MC HAVING COUNT MC
  • You must give at least one requirement to install (see "pip help install")

    语言 python why install 后面没有参数 xff0c 也就是说没有给想要安装的包 way pip install 后面要跟想要安装的包名 转载于 https www cnblogs com 2bjiujiu p 902966
  • VHDL乘除法及转换

    首先鄙视一下这个不智能的语言 1 要进行乘法与除法 xff0c 数据类型必须是signed 2 两个16位的数相乘 xff0c 结果必须是32位的 3 乘以2的n次幂的数可以直接乘 xff0c 之后截位也比较方便 xff0c xff08 其
  • C语言真正的编译过程

    说实话 xff0c 很多人做了很久的C C 43 43 也用了很多IDE xff0c 但是对于可执行程序的底层生成一片茫然 xff0c 这无疑是一种悲哀 xff0c 可以想象到大公司面试正好被问到这样的问题 xff0c 有多悲催不言而喻 x
  • Docker 删除&清理镜像

    文章首发自个人网站 xff1a https www exception site docker docker delete image 本文中 xff0c 您将学习 Docker 如何删除及清理镜像 xff1f 一 通过标签删除镜像 通过如
  • 解决:invalid application of `sizeof' to incomplete type `({anonymous})'错误

    这个错误的原因 xff1a sizeof不能用在extern变量 xff0c sizeof 的计算发生在代码编译 的时刻 extern 标注的符号 在链接的时刻解析 所以 sizeof 不知道 这个符号到底占用了多少空间 发生错误的程序是这
  • 自制吸锡带

    焊接qfp封装芯片的时候 xff0c 由于两个引脚间距过小 xff0c 常常会在引脚上留有焊锡 xff0c 这个时候就需要吸锡带 xff0c 但是一般情况下我们手边的设备并不齐全 xff0c 所以我们可以利用手边的工具自制 工具 xff1a
  • 实验六

    芯片派生 include lt iostream gt using namespace std class Base public void add int x int y cout lt lt x lt lt 34 43 34 lt lt
  • geometry_msgs.msg.PoseStamped 代码示例

    https programtalk com python examples geometry msgs msg PoseStamped 转载于 https www cnblogs com sea stream p 11129929 html
  • ubuntu 执行apt-get update报错Failed to fetch

    在ubuntu下执行sudo apt get update时 xff0c 经常会遇到报错 xff1a Err http security ubuntu com precise security InReleaseErr http secur