正在读取软件包列表...错误!尝试通过 apt-get 更新软件包列表

正在读取软件包列表...错误!尝试通过 apt-get 更新软件包列表

当我尝试使用以下命令更新 DigitalOcean VPS 上的软件包列表时:

aran@Aran:~$ sudo apt-get update
Ign http://mirrors.digitalocean.com trusty InRelease
Hit http://mirrors.digitalocean.com trusty-updates InRelease
Hit http://mirrors.digitalocean.com trusty-backports InRelease
Hit http://security.ubuntu.com trusty-security InRelease
Hit http://mirrors.digitalocean.com trusty Release.gpg
Hit http://mirrors.digitalocean.com trusty Release
Hit http://mirrors.digitalocean.com trusty-updates/main Sources
Hit http://mirrors.digitalocean.com trusty-updates/restricted Sources
Hit http://mirrors.digitalocean.com trusty-updates/universe Sources
Hit http://mirrors.digitalocean.com trusty-updates/multiverse Sources
Hit http://mirrors.digitalocean.com trusty-updates/main amd64 Packages
Hit http://mirrors.digitalocean.com trusty-updates/restricted amd64 Packages
Hit http://mirrors.digitalocean.com trusty-updates/universe amd64 Packages
Hit http://mirrors.digitalocean.com trusty-updates/multiverse amd64 Packages
Hit http://mirrors.digitalocean.com trusty-updates/main i386 Packages
Hit http://mirrors.digitalocean.com trusty-updates/restricted i386 Packages
Hit http://mirrors.digitalocean.com trusty-updates/universe i386 Packages
Hit http://mirrors.digitalocean.com trusty-updates/multiverse i386 Packages
Hit http://mirrors.digitalocean.com trusty-updates/main Translation-en
Hit http://mirrors.digitalocean.com trusty-updates/multiverse Translation-en
Hit http://mirrors.digitalocean.com trusty-updates/restricted Translation-en
Hit http://mirrors.digitalocean.com trusty-updates/universe Translation-en
Hit http://mirrors.digitalocean.com trusty-backports/main Sources
Hit http://mirrors.digitalocean.com trusty-backports/restricted Sources
Hit http://mirrors.digitalocean.com trusty-backports/universe Sources
Hit http://mirrors.digitalocean.com trusty-backports/multiverse Sources
Hit http://mirrors.digitalocean.com trusty-backports/main amd64 Packages
Hit http://mirrors.digitalocean.com trusty-backports/restricted amd64 Packages
Hit http://mirrors.digitalocean.com trusty-backports/universe amd64 Packages
Hit http://mirrors.digitalocean.com trusty-backports/multiverse amd64 Packages
Hit http://mirrors.digitalocean.com trusty-backports/main i386 Packages
Hit http://mirrors.digitalocean.com trusty-backports/restricted i386 Packages
Hit http://mirrors.digitalocean.com trusty-backports/universe i386 Packages
Hit http://mirrors.digitalocean.com trusty-backports/multiverse i386 Packages
Hit http://mirrors.digitalocean.com trusty-backports/main Translation-en
Hit http://mirrors.digitalocean.com trusty-backports/multiverse Translation-en
Hit http://mirrors.digitalocean.com trusty-backports/restricted Translation-en
Hit http://mirrors.digitalocean.com trusty-backports/universe Translation-en
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://mirrors.digitalocean.com trusty/main Sources
Hit http://mirrors.digitalocean.com trusty/restricted Sources
Hit http://mirrors.digitalocean.com trusty/universe Sources
Hit http://mirrors.digitalocean.com trusty/multiverse Sources
Hit http://mirrors.digitalocean.com trusty/main amd64 Packages
Hit http://mirrors.digitalocean.com trusty/restricted amd64 Packages
Hit http://mirrors.digitalocean.com trusty/universe amd64 Packages
Hit http://mirrors.digitalocean.com trusty/multiverse amd64 Packages
Hit http://security.ubuntu.com trusty-security/main i386 Packages
Hit http://mirrors.digitalocean.com trusty/main i386 Packages
Hit http://mirrors.digitalocean.com trusty/restricted i386 Packages
Hit http://mirrors.digitalocean.com trusty/universe i386 Packages
Hit http://mirrors.digitalocean.com trusty/multiverse i386 Packages
Hit http://mirrors.digitalocean.com trusty/main Translation-en
Hit http://mirrors.digitalocean.com trusty/multiverse Translation-en
Hit http://security.ubuntu.com trusty-security/universe i386 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://mirrors.digitalocean.com trusty/restricted Translation-en
Hit http://mirrors.digitalocean.com trusty/universe Translation-en
Ign http://mirrors.digitalocean.com trusty/main Translation-en_US
Ign http://mirrors.digitalocean.com trusty/multiverse Translation-en_US
Ign http://mirrors.digitalocean.com trusty/restricted Translation-en_US
Ign http://mirrors.digitalocean.com trusty/universe Translation-en_US
Reading package lists... Error!

以下是sources.list的内容:

## Note, this file is written by cloud-init on first boot of an instance
## modifications made here will not survive a re-bundle.
## if you wish to make changes you can:
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
##     or do the same in user-data
## b.) add sources in /etc/apt/sources.list.d
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl
#

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.digitalocean.com/ubuntu trusty main restricted
deb-src http://mirrors.digitalocean.com/ubuntu trusty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.digitalocean.com/ubuntu trusty-updates main restricted
deb-src http://mirrors.digitalocean.com/ubuntu trusty-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.digitalocean.com/ubuntu trusty universe
deb-src http://mirrors.digitalocean.com/ubuntu trusty universe
deb http://mirrors.digitalocean.com/ubuntu trusty-updates universe
deb-src http://mirrors.digitalocean.com/ubuntu trusty-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.digitalocean.com/ubuntu trusty multiverse
deb-src http://mirrors.digitalocean.com/ubuntu trusty multiverse
deb http://mirrors.digitalocean.com/ubuntu trusty-updates multiverse
deb-src http://mirrors.digitalocean.com/ubuntu trusty-updates multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.digitalocean.com/ubuntu trusty-backports main restricted universe multive$
deb-src http://mirrors.digitalocean.com/ubuntu trusty-backports main restricted universe mul$

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty partner

deb http://security.ubuntu.com/ubuntu trusty-security main
deb-src http://security.ubuntu.com/ubuntu trusty-security main
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
# deb http://security.ubuntu.com/ubuntu trusty-security multiverse
# deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse

/var/log/apt/term.log 中的内容如下:

Log started: 2017-05-29  01:21:39
Selecting previously unselected package libxslt1.1:amd64.
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading databa$
Preparing to unpack .../libxslt1.1_1.1.28-2ubuntu0.1_amd64.deb ...
Unpacking libxslt1.1:amd64 (1.1.28-2ubuntu0.1) ...
Selecting previously unselected package nginx-common.
Preparing to unpack .../nginx-common_1.4.6-1ubuntu3.7_all.deb ...
Unpacking nginx-common (1.4.6-1ubuntu3.7) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../nginx-core_1.4.6-1ubuntu3.7_amd64.deb ...
Unpacking nginx-core (1.4.6-1ubuntu3.7) ...
Selecting previously unselected package nginx.
Preparing to unpack .../nginx_1.4.6-1ubuntu3.7_all.deb ...
Unpacking nginx (1.4.6-1ubuntu3.7) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up libxslt1.1:amd64 (1.1.28-2ubuntu0.1) ...
Setting up nginx-common (1.4.6-1ubuntu3.7) ...
Setting up nginx-core (1.4.6-1ubuntu3.7) ...
Setting up nginx (1.4.6-1ubuntu3.7) ...
Processing triggers for libc-bin (2.19-0ubuntu6.11) ...
Log ended: 2017-05-29  01:21:44

Log started: 2017-05-29  01:22:35
Selecting previously unselected package php5-fpm.
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading databa$
Preparing to unpack .../php5-fpm_5.5.9+dfsg-1ubuntu4.21_amd64.deb ...
Unpacking php5-fpm (5.5.9+dfsg-1ubuntu4.21) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up php5-fpm (5.5.9+dfsg-1ubuntu4.21) ...

Creating config file /etc/php5/fpm/php.ini with new version
php5_invoke: Enable module json for fpm SAPI
php5_invoke: Enable module gd for fpm SAPI
php5_invoke: Enable module mysqli for fpm SAPI
php5_invoke: Enable module pdo_mysql for fpm SAPI
php5_invoke: Enable module pdo for fpm SAPI
php5_invoke: Enable module opcache for fpm SAPI
php5_invoke: Enable module ssh2 for fpm SAPI
php5_invoke: Enable module readline for fpm SAPI
php5_invoke: Enable module mysql for fpm SAPI
php5-fpm start/running, process 7326
Processing triggers for ureadahead (0.100.0-16) ...
Log ended: 2017-05-29  01:22:37

以下是同一目录中 history.log 中的日志:

Start-Date: 2017-05-29  01:21:39
Commandline: apt-get install nginx
Install: nginx-core:amd64 (1.4.6-1ubuntu3.7, automatic), libxslt1.1:amd64 (1.1.28-2ubuntu0.1$
End-Date: 2017-05-29  01:21:44

Start-Date: 2017-05-29  01:22:35
Commandline: apt-get install php5-fpm
Install: php5-fpm:amd64 (5.5.9+dfsg-1ubuntu4.21)
End-Date: 2017-05-29  01:22:37

答案1

我联系了 DO 支持人员,这是他们的回复:

你好呀,

感谢您的联系!您看到的唯一错误是“正在读取软件包列表...错误!”吗?通常还会有另外一两行输出,提供有关正在发生的事情的更多详细信息,并有助于缩小问题范围。

不过,一个可能的原因是 apt 处于不一致状态。如果您运行以下命令清除一些本地缓存数据,然后尝试再次更新,那么它会起作用吗?

sudo mv /var/lib/apt/lists /var/lib/apt/lists.old  
sudo apt-get clean 
sudo apt-get update 

如果可行或者我们可以提供其他帮助,请告知我们!

问候,

Nicholas C. 平台支持倡导者 感谢您的反馈!

我认为我错误地移动或删除了某些内容!因为我得到的是:

aran@Aran:~$ sudo mv /var/lib/apt/lists /var/lib/apt/lists.old
mv: cannot stat ‘/var/lib/apt/lists’: No such file or directory

无论如何,我的问题现在在清理命令之后已经解决。

答案2

如果你去http://mirrors.digitalocean.com/它说

该镜像旨在供 DigitalOcean Droplets 使用。

该镜像旨在协助运行旧版 Ubuntu 的 DigitalOcean Droplets 的升级。

除非您专门出于特殊目的使用此镜像,否则您应该更改您的存储库。

相关内容