0

I am running Ubuntu 14.04.1 LTS on a t1.micro on ec2. Just a moment ago I logged in, ran sudo apt-get update and got Reading package lists... Error!

I also realized that I no longer can install packages using sudo apt-get install.

Any idea what went wrong here? And how to fix it?

I have tried the answer suggested in this thread https://unix.stackexchange.com/questions/139441/reading-package-lists-error but that did not fix the problem. What makes things a little annoying also is the lack of error logs (or the fact I do not know where to look). For example the sudo apt-get install just fails and I do not know how to run it in verbose mode or where to look to find the specific reason why it is failing...

Here is the content of /var/lib/apt/lists

total 105476
drwxr-xr-x 3 root root     4096 Mar 15 23:05 .
drwxr-xr-x 6 root root     4096 Mar  9 05:58 ..
-rw-r----- 1 root root        0 Mar 15 20:02 lock
drwxr-xr-x 2 root root     4096 Mar 15 23:05 partial
-rw-r--r-- 1 root root      822 Mar 15 19:23 pkg.jenkins-ci.org_debian_binary_Packages
-rw-r--r-- 1 root root     2046 Mar 15 19:23 pkg.jenkins-ci.org_debian_binary_Release
-rw-r--r-- 1 root root      181 Mar 15 19:23 pkg.jenkins-ci.org_debian_binary_Release.gpg
-rw-r--r-- 1 root root    19466 Mar 13 10:29 ppa.launchpad.net_webupd8team_java_ubuntu_dists_trusty_main_binary-amd64_Packages
-rw-r--r-- 1 root root     6192 Mar 13 10:29 ppa.launchpad.net_webupd8team_java_ubuntu_dists_trusty_main_i18n_Translation-en
-rw-r--r-- 1 root root    15111 Mar 13 10:29 ppa.launchpad.net_webupd8team_java_ubuntu_dists_trusty_Release
-rw-r--r-- 1 root root      316 Mar 13 10:29 ppa.launchpad.net_webupd8team_java_ubuntu_dists_trusty_Release.gpg
-rw-r--r-- 1 root root  1410166 Mar 12 21:35 security.ubuntu.com_ubuntu_dists_trusty-security_main_binary-amd64_Packages
-rw-r--r-- 1 root root  1140580 Mar 11 00:34 security.ubuntu.com_ubuntu_dists_trusty-security_main_i18n_Translation-en
-rw-r--r-- 1 root root   349379 Mar 12 21:40 security.ubuntu.com_ubuntu_dists_trusty-security_main_source_Sources
-rw-r--r-- 1 root root    61968 Mar 12 21:40 security.ubuntu.com_ubuntu_dists_trusty-security_Release
-rw-r--r-- 1 root root      933 Mar 12 21:40 security.ubuntu.com_ubuntu_dists_trusty-security_Release.gpg
-rw-r--r-- 1 root root   542657 Mar 12 21:35 security.ubuntu.com_ubuntu_dists_trusty-security_universe_binary-amd64_Packages
-rw-r--r-- 1 root root   250304 Mar 11 00:34 security.ubuntu.com_ubuntu_dists_trusty-security_universe_i18n_Translation-en
-rw-r--r-- 1 root root    72494 Mar 12 21:40 security.ubuntu.com_ubuntu_dists_trusty-security_universe_source_Sources
-rw-r--r-- 1 root root  8234934 May  8  2014 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty_main_binary-amd64_Packages
-rw-r--r-- 1 root root  4149211 Apr 15  2014 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty_main_i18n_Translation-en
-rw-r--r-- 1 root root  5000095 May  8  2014 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty_main_source_Sources
-rw-r--r-- 1 root root    58512 May  8  2014 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty_Release
-rw-r--r-- 1 root root      933 May  8  2014 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty_Release.gpg
-rw-r--r-- 1 root root 31726252 May  8  2014 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty_universe_binary-amd64_Packages
-rw-r--r-- 1 root root 18635427 May  8  2014 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty_universe_i18n_Translation-en
-rw-r--r-- 1 root root 27857155 May  8  2014 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty_universe_source_Sources
-rw-r--r-- 1 root root  2881415 Mar 15 22:58 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty-updates_main_binary-amd64_Packages
-rw-r--r-- 1 root root  1784682 Mar 12 18:07 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty-updates_main_i18n_Translation-en
-rw-r--r-- 1 root root   938350 Mar 15 22:58 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty-updates_main_source_Sources
-rw-r--r-- 1 root root    61966 Mar 15 22:58 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty-updates_Release
-rw-r--r-- 1 root root      933 Mar 15 22:58 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty-updates_Release.gpg
-rw-r--r-- 1 root root  1538422 Mar 15 22:58 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty-updates_universe_binary-amd64_Packages
-rw-r--r-- 1 root root   669587 Mar 12 18:27 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty-updates_universe_i18n_Translation-en
-rw-r--r-- 1 root root   510829 Mar 15 22:58 us-west-2.ec2.archive.ubuntu.com_ubuntu_dists_trusty-updates_universe_source_Sources

and a little snippet from /var/lib/dpkg/status

Package: node-normalize-package-data
Status: install ok installed
Priority: extra
Section: web
Installed-Size: 58
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: all
Version: 0.2.2-1
Depends: nodejs, node-github-url-from-git, node-semver (>= 2)
Description: Normalizes package metadata - Node.js module
 This module is used by node-read-package-json to normalize data it
 reads from a package.json file typically found in Node.js modules,
 but in principle it could come from any source.
 .
 Node.js is an event-based server-side javascript engine.
Original-Maintainer: Debian Javascript Maintainers <pkg-javascript-devel@lists.alioth.debian.org>
Homepage: https://github.com/meryn/normalize-package-data
Community
  • 1
  • 1
dade
  • 3,340
  • 4
  • 32
  • 53
  • http://unix.stackexchange.com/questions/139441/reading-package-lists-error – tedder42 Mar 15 '15 at 16:11
  • @tedder42 I have tried the suggestions in the link you shared but still did not work. I have updated the question to include this fact. I am at a loss at the reason for this failure and worse is the fact I have no visibility into the cause. Do not know where to look to find the error logs or run the command in verbose mode. Any ideas? – dade Mar 15 '15 at 20:09
  • Is there anything useful in `/var/log/dpkg.log`? – Will Mar 15 '15 at 20:11
  • @Will Nope. The file is empty – dade Mar 15 '15 at 23:07
  • The error is the first text you get when running `update`? show us the contents of `ls -al /var/lib/apt/lists/`. Also contents of `/var/lib/dpkg/status`. You can edit your question or put it in as a gist. I really suspect it's that status file. You should start with an empty status file. – tedder42 Mar 15 '15 at 23:18

2 Answers2

0

A restart of the instance fixed the issue. Why this worked, I cannot explain!

dade
  • 3,340
  • 4
  • 32
  • 53
0

You can try out the below commands to fix the issue

sudo rmdir /var/lib/dpkg/status
sudo touch /var/lib/dpkg/status
sudo apt-get update

The first command will remove the empty directory, second will create the new directory and the last command will populate the lists files. Also, Restart your EC2 instance to make the above changes effective.

Muffi
  • 33
  • 5