failed in buffer_read(fd) on Ubuntu

I was trying to install something on my machine using apt-get but it kept giving an error similar to

failed in buffer_read(fd): files list for package `linux-restricted-modules-2.6.15-23-386': Invalid Argument

I searched the net and the Ubuntu Forums but didn’t arrive on a definitive answer. The reason and the solution is below
(Thanks to C.M. Connelly at http://www.eskimo.com/~c/blog/archive/2003-05.html)

  1. This happens when there’s some issue with the file list of that particular package in Debian derived distributions, such as Ubuntu.
  2. The files are stored in /var/lib/dpkg/info/
  3. The solution is to regenerate the file list or copy it from a place which has that file

Replacing it with a working copy

  • Go into the directory/var/lib/dpkg/info/
  • List all files pertaining to that package – for example

    root@Azlan:/var/lib/dpkg/info# ls -l linux-restricted-modules-2.6.15-23-386*
    ?--------- 1 12311 67231 13097 2006-05-19 15:00 linux-restricted-modules-2.6.15-23-386.list
    -rwxrwxrwx 1 root root 16844 2006-05-19 04:30 linux-restricted-modules-2.6.15-23-386.md5sums
    -rwxrwxrwx 1 root root 86 2006-05-19 04:29 linux-restricted-modules-2.6.15-23-386.postinst
    -rwxrwxrwx 1 root root 281 2006-05-19 04:29 linux-restricted-modules-2.6.15-23-386.postrm
  • As you can see, the file linux-restricted-modules-2.6.15-23-386.list does not seem to be alright.
  • Replace it with a file which you already have in some other machine

Regenerating the file

  • If you wish to regenerate the file, then you’d require the original .deb package for it
  • You may try searching for it in /var/cache/apt/archives
  • Regenerate the file using the command below

    dpkg -c /var/cache/apt/archives/linux-restricted-modules-2.6.15-23-386_2.6.15.11-1_i386.deb > /var/lib/dpkg/info/linux-restricted-modules-2.6.15-23-386.list
Advertisement

One thought on “failed in buffer_read(fd) on Ubuntu

  1. Ubuntu: dpkg fails with “failed in buffer_read(fd)” « UNIX Administratosphere

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s