apt-get install debian-wizard

Insider infos, master your Debian/Ubuntu distribution

  • About
    • About this blog
    • About me
    • My free software history
  • Support my work
  • Get the newsletter
  • More stuff
    • Support Debian Contributors
    • Other sites
      • My company
      • French Blog about Free Software
      • Personal Website (French)
  • Mastering Debian
  • Contributing 101
  • Packaging Tutorials
You are here: Home / Documentation / Deciphering one of dpkg’s weirdest errors: short read on buffer copy

Deciphering one of dpkg’s weirdest errors: short read on buffer copy

June 27, 2011 by Raphaël Hertzog

As a Debian/Ubuntu user, you’re likely to be exposed at some point to an error reported by dpkg. In a series of articles, I’ll explain some of the errors that you might encounter.

Some error messages can be confusing at times. Most of the error strings do not appear very often and developers thus tend to use very terse description of the underlying problem. In other cases the architecture of the software makes it difficult to pin-point the real problem because the part that displays the error is several layers above the one that generated the initial error.

This is for example the case with this error of dpkg:

Unpacking replacement xulrunner-1.9.2 ...
dpkg-deb (subprocess): data: internal gzip read error: '<fd:0>: too many length or distance symbols'
dpkg-deb: error: subprocess <decompress> returned error exit status 2
dpkg: error processing /var/cache/apt/archives/xulrunner-1.9.2_1.9.2.17+build3+nobinonly-0ubuntu1_amd64.deb (--unpack):
 short read on buffer copy for backend dpkg-deb during `./usr/lib/xulrunner-1.9.2.17/components/libdbusservice.so'

First, the decompression layer discovers something unexpected in the data read in the .deb file and dpkg-deb outputs the error message coming from zlib (“too many length or distance symbols”). This causes the premature end of dpkg-deb --fsys-tarfile that dpkg had executed to extract the .data.tar archive from the deb file. In turn, dpkg informs us that dpkg-deb did not send all the data that were announced (and hence the “short read” in the error message) and that were meant to be part of the file ‘/usr/lib/xulrunner-1.9.2.17/components/libdbusservice.so’.

That’s all nice but it doesn’t help you much in general. What you must understand from the above is that the .deb file is corrupted (sometimes just truncated). In theory it should not happen since APT verifies the checksums of files when they are downloaded. But computers are not infallible and even if the downloaded data was good, it can have been corrupted when stored on disk (for example cheap SSD disks are known to not last very well).

Try removing the file (usually with apt-get clean since it’s stored in APT’s cache) and let APT download it again. Chances are that it will work on the second try. Otherwise consider doing a memory and HDD check as something is probably broken in your computer.

Join my free newsletter and learn more tips for users. Or click here to support my work on dpkg with Flattr, consider subscribing for a few months.

Filed Under: Documentation, User Documentation Tagged With: APT, corruption, deb, Debian, dpkg, error, Ubuntu

Comments

  1. Paul Grandperrin says

    June 27, 2011 at 1:48 pm

    Hi, I’m having another weird error message with aptitude which is not easily understandable…

    “Internal error: found 2 (choice -> promotion) mappings for a single choice.”

    Aptitude is telling me this error dozens or even hundreds times while searching for solutions.

    Do you know what this means?

    And BTW, thanks for all your work.

    • Raphaël Hertzog says

      June 27, 2011 at 1:53 pm

      Paul, check this out: http://bugs.debian.org/587087

  2. Benjamin says

    July 2, 2011 at 12:28 am

    It would be nice if the dpkg error message would be improved. It should tell me the possible causes for it and give me a hint how to deal with it. dpkg should print what you wrote, but in short.

    • Raphaël Hertzog says

      July 3, 2011 at 10:00 am

      I agree, I tried to improve the situation (see http://bugs.debian.org/621763 ) but then Guillem asked me to wait for some internal API rework and he has still not done it… and it’s also blocking multiarch. 🙁

  3. Peter says

    January 10, 2012 at 1:16 am

    Thanks very much! This article helped me clear up an upgrade problem I was having due to the mysterious “short read on buffer copy for backend dpkg-deb” message.

Trackbacks

  1. Understand dpkg and don’t get stuck with a maintainer script failure says:
    September 13, 2011 at 2:11 pm

    […] a maintainer script failure September 13, 2011 By Raphaël Hertzog Leave a Comment Continuing my series of articles on dpkg’s errors, this time I’ll cover a pretty common one which has […]

Get the Debian Handbook

Available as paperback and as ebook.
Book cover

Email newsletter

Get updates and exclusive content by email, join the Debian Supporters Guild:

Follow me

  • Email
  • Facebook
  • GitHub
  • RSS
  • Twitter

Discover my French books

Planets

  • Planet Debian

Archives

I write software, books and documentation. I'm a Debian developer since 1998 and run my own company. I want to share my passion and knowledge of the Debian ecosystem. Read More…

Tags

3.0 (quilt) Activity summary APT aptitude Blog Book Cleanup conffile Contributing CUT d-i Debconf Debian Debian France Debian Handbook Debian Live Distro Tracker dpkg dpkg-source Flattr Flattr FOSS Freexian Funding Git GNOME GSOC HOWTO Interview LTS Me Multiarch nautilus-dropbox News Packaging pkg-security Programming PTS publican python-django Reference release rolling synaptic Ubuntu WordPress

Recent Posts

  • Freexian is looking to expand its team with more Debian contributors
  • Freexian’s report about Debian Long Term Support, July 2022
  • Freexian’s report about Debian Long Term Support, June 2022
  • Freexian’s report about Debian Long Term Support, May 2022
  • Freexian’s report about Debian Long Term Support, April 2022

Copyright © 2005-2021 Raphaël Hertzog