由于 GPG 错误,apt-get 更新在 Ubuntu 14.04 中失败

由于 GPG 错误,apt-get 更新在 Ubuntu 14.04 中失败

我目前使用的是 Ubuntu 14.04(Ubuntu 新手,最近迁移)。

“apt-get install” 运行正常,我的连接也运行正常。但是当我运行 apt-get update 时,发生了以下情况

100% [InRelease gpgv 3,627 B] [Connecting to security.ubuntu.com  
(91.189.91.13)Splitting up /var/lib/apt/lists/partial
/in.archive.ubuntu.com_ubuntu_dists_trustyIgn 
http://in.archive.ubuntu.com trusty InRelease                              

E: GPG error: http://in.archive.ubuntu.com trusty InRelease: 
Clearsigned file isn't valid, got 'NODATA' 
(does the network require authentication?)

在网上进行了详尽的搜索,但没有找到任何明确的解决方案。到目前为止,我尝试过的方法:

wget https://dl.dropbox.com/u/8850924/fixpackage
chmod +x ./fixpackage
sudo./fixpackage

对于懒人来说,fixpackage 中包含的内容如下:

sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
sudo rm -rf /var/lib/dpkg/updates/*
sudo rm -rf /var/lib/apt/lists
sudo mkdir /var/lib/apt/lists
sudo mkdir /var/lib/apt/lists/partial
sudo apt-get clean
sudo apt-get update
sudo dpkg --clear-avail
sudo dpkg --configure -a
sudo apt-get install -f
sudo apt-get update
sudo apt-get dist-upgrade

输出:

100% [InRelease gpgv 3,627 B] [Waiting for headers]Splitting up /var/lib
/apt/lists/partial/security.ubuntu.com_ubuntu_dists_trusty-
security_InRelease into data Ign http://security.ubuntu.com trusty-
security InRelease

E: GPG error: http://security.ubuntu.com trusty-security InRelease: 
Clearsigned file isn't valid, got 'NODATA' (does the network require 
authentication?)

Setting up google-chrome-stable (43.0.2357.124-1) ...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
100% [InRelease gpgv 3,627 B]Splitting up /var/lib/apt/lists/partial
/in.archive.Ign http://in.archive.ubuntu.com trusty InReleasea and 
signature failed
E: GPG error: http://in.archive.ubuntu.com trusty InRelease: Clearsigned
file isn't valid, got 'NODATA' (does the network require 
authentication?)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

我也尝试过这个解决方案

sudo apt-get clean
sudo mv /var/lib/apt/lists /var/lib/apt/lists.broke
sudo mkdir -p /var/lib/apt/lists/partial
sudo apt-get update

这两种解决方案对我来说都不起作用。

如果需要更多详细信息,请告诉我。

答案1

我遇到了同样的问题,因为我在公司使用代理。解决方案是

  1. 您需要设置环境变量

http_proxy

  1. 使用 sudo 命令并加上选项

-E

sudo -E apt-get 更新

该选项指示 sudo 命令执行保存环境变量。

相关内容