問題描述
我可以使用我的移動寬帶通過 Firefox 訪問互聯網,但是當我想從終端安裝任何軟件包或發出 ‘apt-get update’ 命令時,我收到以下錯誤:
got 'NODATA' (does the network require authentication?)
apt-get更新輸出:
Get:1 extras.ubuntu.com trusty InRelease [213 B] 98% [1 InRelease gpgv 213 B] [Connecting to archive.ubuntu.com]
Splitting up /var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_trusty_InRelease into data
Ign extras.ubuntu.com trusty InRelease E: GPG error: extras.ubuntu.com trusty InRelease: Clearsigned file isn't valid, got 'NODATA' (does the network require authentication?)
`cat /var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_trusty_InRelease 的輸出
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>404</title> <meta http-equiv="Cache-Control" content="no-cache"/> </head> <body> <p> Not Found </p> </body> </html>
wget的輸出:
wget -O - http://extras.ubuntu.com/ubuntu/dists/trusty/InRelease
--2014-06-01 09:23:35-- http://extras.ubuntu.com/ubuntu/dists/trusty/InRelease
Resolving extras.ubuntu.com (extras.ubuntu.com)... 91.189.92.152
Connecting to extras.ubuntu.com (extras.ubuntu.com)|91.189.92.152|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 213 [text/html]
Saving to: ‘STDOUT’
0% [ ] 0 --.-K/s <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>404</title>
<meta http-equiv="Cache-Control" content="no-cache"/>
</head>
<body>
<p>
Not Found
</p>
</body>
</html>
最佳回答
您的移動寬帶提供商運行的 transparent proxy 有故障。 URL http://extras.ubuntu.com/ubuntu/dists/trusty/InRelease 應返回“404 Not Found”。相反,它返回“200 OK”但發送 404 內容。由於URL是”OK”,apt將內容複製到/var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_trusty_InRelease
並嘗試使用,然後抱怨不正確。
這裏的問題不是 Ubuntu,而是您的移動寬帶提供商的透明代理。您也許可以聯係他們進行修複。
這是正常互聯網連接的輸出:
$ wget -O - http://extras.ubuntu.com/ubuntu/dists/trusty/InRelease
--2014-06-01 10:25:36-- http://extras.ubuntu.com/ubuntu/dists/trusty/InRelease
Resolving extras.ubuntu.com (extras.ubuntu.com)... 91.189.92.152
Connecting to extras.ubuntu.com (extras.ubuntu.com)|91.189.92.152|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2014-06-01 10:25:36 ERROR 404: Not Found.
有關移動連接上透明代理引起的問題的一些詳細信息,請參閱問題 How to stop javascript injection from vodafone proxy? 的答案
次佳回答
我隻是有同樣的問題。我認為我的 ISP 也使用了一個相當討厭的代理。
雖然 solution proposed by bain 可能是正確的做法 (TM),但我發現了一個更直接和實用的 solution on the Linux Mint forum,它基本上涉及從 /var/lib/apt/lists
目錄(或者更確切地說,整個目錄)中刪除可能損壞的條目:
$ cd /var/lib/apt
$ sudo mv lists lists.old
$ sudo mkdir -p lists/partial
$ sudo apt-get update
這些命令為我解決了這個問題。
第三種回答
我在 VMWare 中運行 Ubuntu 14.04 時遇到了同樣的問題。上麵的評論提示我嘗試網絡設置。一旦我從默認 NAT 更改為橋接,我的問題就解決了。
第四種回答
在我添加一個引用被我公司的代理 (*.dropbox.com) 阻止的域的 ppa ( Dropbox ) 後,我遇到了同樣的問題。由於 apt-get update
無法讀取 http://linux.dropbox.com/ubuntu
,因此會拋出此 “NODATA” 錯誤。
我結束了 removing the ppa :
sudo rm /etc/apt/sources.list.d/dropbox.list
第五種回答
當 apt-get 配置為使用不存在的代理時,也會發生這種情況(duh!)。就我而言,我移動了一台位於代理網絡上的機器,但忘記刪除此文件中的 apt-get proxy configuration:
/etc/apt/apt.conf
值得讚揚的是,我刪除了 environment variable 條目 ( also see here ),但隻是忘記了 apt-get 配置文件。