1. 程式人生 > >ubuntu apt-get update 失敗解決。

ubuntu apt-get update 失敗解決。

當執行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.
[email protected]
:/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 失敗解決

當執行apt-get update後出現如下錯誤時: E: Some index files failed to download, they have been ignored, or old ones used instead.可以將目錄下/var/lib/apt/li

Ubuntu系統 apt-get update失敗解決辦法

(測試系統Ubuntu14.10和9.10) 使用apt-get的時候發現ubuntu和阿里雲均已經不提供該版本的源,所以需要找到其他的替代源。使用的ubuntu版本是14.10,屬於非LTS(長期支援版本),因此前一段時間還可以使用apt-get update來更新源,現

Ubuntu apt-get update錯誤解決

命令 ase sig lib partial 執行 upd -- 罷工 用apt-get命令安裝開發軟件非常方便,但由於各種原因,經常鏈接不上軟件源,於是需要使用sudo apt-get update命令來更新軟件源。 而屋漏偏逢連夜雨,這時候更新命令也罷工,出現各種錯誤。

Ubuntu apt-get update 失敗

情景:apt-get碰上了”fetch http://……失敗”。。。 原因:自帶源在國內連線性不好。。。 解決:改用”阿里雲Ubuntu源”: https://www.yurendu.c

apt-get update失敗解決方案

剛準備入坑hadoop,結果在虛擬機器上面搭建環境的第一步就被難住了,對,我在jdk的安裝上面被難住了!!!長話短說,在執行sudo apt-get  update時,出現了錯誤:“E:Some index files failed to download.They have

解決ubuntuapt-get update失敗的問題

由於ubuntu官方提供的地址國內連線不穩定,容易出現失敗的情況,可以根據目前的版本在/etc/apt/source.list中更替為相應的版本。填入的連線內容見網頁:https://mirrors.ustc.edu.cn/repogen/

ubuntu 14.04 apt-get update失敗解決辦法

ubuntu 14.04 apt-get update失敗解決方法 在ubuntu14.04版本(虛擬機器)安裝jdk之前,一般我們會執行以下命令從源下載更新到系統 sudo apt-get install update 但這時總會出現形似:”fetc

ubuntu apt-get update 更新源失敗解決辦法

用虛擬機器新裝了ubuntu12.04,更新源的時候出了問題。如圖所示 解決辦法;如圖所示 sudo rm /var/cache/apt/archives/lock sudo rm /var/lib/dpkg/lock

Ubuntu 14.10執行apt-get update失敗

一、問題描述: 因為經常使用apt-get命令安裝所需要的開發軟體,但經常由於連結不上軟體源不能正常安裝,於是就是用sudo apt-get update命令來更新軟體源,但這條更新命令也經常不能正常使用,出現大量的錯誤:W: Failed to fetch ***  40

Ubuntu】搭建環境安裝軟體前apt-get update失敗,怎麼辦?

**我一般更新或安裝軟體使用的都是root許可權,自己的測試虛擬機器無所謂,如果你使用伺服器請慎用root許可權。** 命令列下輸入 sudo apt-get update 報了一堆錯誤:Err

Ubuntu 16.04.3 LTS: apt-get update 失敗處理 Aborted (core dumped)

7ffeed1eb000-7ffeed1ed000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-f

Ubuntu apt-get update install失敗

想用apt-get install下載包卻發現總是packet not available. 可能是: 網路問題?(已排除) 源太舊? 或者其它問題? 於是輸入apt-get update,更新源,發現報警告: W: Failed to fetch http://... W

Ubuntu--ubuntu apt-get update更換源也無法解決的一種情況

這種情況就是DNS配置問題,之所以難發現,是因為ping的通就以為網路沒問題了,但是源還是需要DNS來服務的 解決步驟: 1.用編輯器開啟resolv.conf vi /etc/resolv.c

關於ubuntu17.04之apt-get失敗 解決辦法

失敗 解決 ted apt-get 關於 back 軟件源 成功 source 這個是清華的apt-get源,適用於ubuntu17.04 命令行:cd /etc/apt/sources.list.d 命令行:sudo vi /etc/apt/sources.list

Ubuntu apt-get update出現 Hash 校驗和不符

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

Ubuntu apt-get update 錯誤:忽略和404

Ubuntu的update錯誤,報404和忽略的錯誤。原因是很多源不能使用或失效。 在【系統設定】—【軟體更新】中將【其他軟體】的√取消 之後在【Ubuntu軟體】中點選【下載自】選擇【其他站點】,在選擇下載伺服器中點選【選擇最佳伺服器】,之後等待測試下載伺服器...

ubuntu apt-get update 升級報錯處理

問題: upd ttl www. str 判斷 eas down icmp 一、問題:ubuntu16.04.3升級 apt-get update報錯root@setHostName:~# apt-get updateErr:1 http://security.ubuntu

sudo apt-get update 失敗

問題: ubuntu16.04 下 , sudo apt-get install 失敗 ,於是按照谷歌上的教程 更新源 sudo apt-get update 結果出錯了。 解決方案: sudo dpkg --print-architecture sudo d

ubuntu 使用sudo apt-get update 出現 被配置多次導致無法升級錯誤解決方法

code 開發機 goup 使用 lin logs 配置 周末 ubun 這個周六周末在考慮升級自己GPU開發機,在琢磨使用docker來按轉tensorflow環境,在升級軟件的時候爆出了如下錯誤 在 /etc/apt/sources.list.d/sogoupin

2017-9-24-Linux移植:ubuntu server 16.04無法聯網&無法apt-get update解決

配置 ack src clas ron con span 技術 修改 無法上網!!!不能忍。。 現象:ifconfig 毛都沒有,想找一下ip都找不到。 ifconfig –a 可以列出所有網卡設備,確認VM VirtualBox網卡開對了,已經給到了虛擬機。 編輯/e