Debian Bug report logs - #497041
Full disk results in corrupted /var/lib/dpkg/updates/ filled filled with "#padding" entries

version graph

Package: dpkg; Maintainer for dpkg is Dpkg Developers <debian-dpkg@lists.debian.org>; Source for dpkg is src:dpkg.

Reported by: Moritz Muehlenhoff <jmm@inutil.org>

Date: Fri, 29 Aug 2008 13:15:01 UTC

Severity: serious

Merged with 499070

Found in versions dpkg/1.14.20, dpkg/1.14.22

Fixed in version dpkg/1.14.23

Done: Guillem Jover <guillem@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#497041; Package dpkg. Full text and rfc822 format available.

Acknowledgement sent to Moritz Muehlenhoff <jmm@inutil.org>:
New Bug report received and forwarded. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Moritz Muehlenhoff <jmm@inutil.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Full disk results in corrupted /var/lib/dpkg/updates/ filled filled with "#padding" entries
Date: Fri, 29 Aug 2008 15:07:10 +0200
Package: dpkg
Version: 1.14.20
Severity: normal

I did an installation of a package with many deps on a current Lenny,
which resulted in the disk filling up completely. After having freed
some diskspace I wanted to run "dpkg --configure -a", which failed:

lennytest:/home/jmm/foobar/swig1.3-1.3.33# LANG=C dpkg --configure -a
dpkg: parse error, in file `/var/lib/dpkg/updates/0161' near line 1:
 newline in field name `#padding'

(Actually all dpkg calls fail)

There are 165 files in /var/lib/dpkg/updates:

lennytest:/var/lib/dpkg/updates# ls
0000  0009  0018  0027  0036  0045  0054  0063  0072  0081  0090  0099  0108  0117  0126  0135  0144  0153  0162
0001  0010  0019  0028  0037  0046  0055  0064  0073  0082  0091  0100  0109  0118  0127  0136  0145  0154  0163
0002  0011  0020  0029  0038  0047  0056  0065  0074  0083  0092  0101  0110  0119  0128  0137  0146  0155  tmp.i
0003  0012  0021  0030  0039  0048  0057  0066  0075  0084  0093  0102  0111  0120  0129  0138  0147  0156
0004  0013  0022  0031  0040  0049  0058  0067  0076  0085  0094  0103  0112  0121  0130  0139  0148  0157
0005  0014  0023  0032  0041  0050  0059  0068  0077  0086  0095  0104  0113  0122  0131  0140  0149  0158
0006  0015  0024  0033  0042  0051  0060  0069  0078  0087  0096  0105  0114  0123  0132  0141  0150  0159
0007  0016  0025  0034  0043  0052  0061  0070  0079  0088  0097  0106  0115  0124  0133  0142  0151  0160
0008  0017  0026  0035  0044  0053  0062  0071  0080  0089  0098  0107  0116  0125  0134  0143  0152  0161

The corrupted one is 0161:

lennytest:/var/lib/dpkg/updates# cat 0161
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
#padding
Package: man-db
Status: install ok half-configured
Priority: important
Section: doc
Installed-Size: 2712
Maintainer: Colin Watson <cjwatson@debian.org>
Architecture: amd64
Version: 2.5.2-2
Config-Version: 2.5.2-2
Replaces: man, manpages-de (<< 0.5-4), nlsutils
Provides: man, man-browser
Depends: groff-base (>= 1.17.2-2), bsdmainutils, debconf (>= 1.2.0) | debconf-2.0, dpkg (>= 1.9.0), libc6 (>= 2.7-1), libgdbm3, zlib1g (>= 1:1.1.4)
Suggests: groff, less, www-browser
Conflicts: man, suidmanager (<< 0.50)
Conffiles:
 /etc/cron.weekly/man-db abb6867338adafff84d4474adf36bbc1
 /etc/manpath.config 220ffd7853c7c0c7fb71e6c25d15ab97

I'm aware that out of diskspace errors are difficult, but this looks like a bug.

Cheers,
        Moritz




Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#497041; Package dpkg. Full text and rfc822 format available.

Acknowledgement sent to Guillem Jover <guillem@debian.org>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. Full text and rfc822 format available.

Message #10 received at 497041@bugs.debian.org (full text, mbox):

From: Guillem Jover <guillem@debian.org>
To: Alexander Prinsier <debian@aphexer.mailhaven.com>, 499070@bugs.debian.org
Cc: Moritz Muehlenhoff <jmm@inutil.org>, 497041@bugs.debian.org
Subject: Re: Bug#499070: dpkg leaves system in unusable state after running out of diskspace
Date: Tue, 16 Sep 2008 23:14:04 +0300
forcemerge 499070 497041
thanks

On Tue, 2008-09-16 at 01:06:05 +0200, Alexander Prinsier wrote:
> Package: dpkg
> Version: 1.14.22
> Severity: serious
> 
> I was installing php5 while my system ran out of disk space. dpkg
> breaks, and leaves the system in a state where I can no longer use dpkg.
> To find out the version number of dpkg I used /var/log/dpkg.log, as I
> couldn't use dpkg to find it's own version number... Hope it's the
> correct one.

> This is what happened:
> 
> [...]
> Selecting previously deselected package libjpeg62.
> Unpacking libjpeg62 (from .../libjpeg62_6b-14_i386.deb) ...
> dpkg: error processing /var/cache/apt/archives/libjpeg62_6b-14_i386.deb
> (--unpack):
>  failed in buffer_write(fd) (10, ret=-1): backend dpkg-deb during
> `./usr/share/doc/libjpeg62/copyright': Disk quota exceeded
> Selecting previously deselected package libdjvulibre21.
> Unpacking libdjvulibre21 (from .../libdjvulibre21_3.5.20-8_i386.deb) ...
> dpkg: error processing
> /var/cache/apt/archives/libdjvulibre21_3.5.20-8_i386.deb (--unpack):
>  failed in buffer_write(fd) (10, ret=-1): backend dpkg-deb during
> `./usr/lib/libdjvulibre.so.21.0.0': Disk quota exceeded
> dpkg-deb: subprocess paste killed by signal (Broken pipe)
> Selecting previously deselected package libxpm4.
> Unpacking libxpm4 (from .../libxpm4_1%3a3.5.7-1_i386.deb) ...
> Selecting previously deselected package libgd2-xpm.
> Unpacking libgd2-xpm (from .../libgd2-xpm_2.0.36~rc1~dfsg-3_i386.deb) ...
> dpkg: error processing
> /var/cache/apt/archives/libgd2-xpm_2.0.36~rc1~dfsg-3_i386.deb (--unpack):
>  unable to flush /var/lib/dpkg/updates/tmp.i after padding: Disk quota exceeded

Here's where the problem starts. That «tmp.i» file is the one that has
been filled with '#padding' lines, the fflush() in createimptmp() fails,
and it ohshite()s, but just before it has been able to rewind the file to
the beginning.

> Processing triggers for man-db ...
> /usr/bin/mandb: can't write to /var/cache/man/19933: Disk quota exceeded
> gdbm fatal: read error
> dpkg: failed to write status record about `libcairo2' to
> `/var/lib/dpkg/status': Disk quota exceeded
> E: Sub-process /usr/bin/dpkg returned an error code (2)
> A package failed to install.  Trying to recover:
> dpkg: parse error, in file `/var/lib/dpkg/updates/0119' near line 1:
>  newline in field name `#padding'
> Press return to continue.

The second problem is that even if the ohshite() called from
createimptmp() is protected inside an onerr_abort section, the execution
continues in archivefiles(), out of process_archive() but into
process_queue(), which at some point calls a modstatdb_note(), moving
the «tmp.i» file into the «0119» one, then another ohshite() is called
and the onerr_abort is sensed again, making process_queue() terminate
its loop.

> # dpkg --configure -a
> dpkg: parse error, in file `/var/lib/dpkg/updates/0119' near line 1:
>  newline in field name `#padding'
> #

But at the point that modstat_note() was called the function wrote at
the end of it, preserving all the '#padding' lines, and making dpkg
barf subsequently.


So I think there's two things to fix here, one is that the fseek() in
createimptmp() should be done just before the fwrite() in
modstatdb_note_core() to guarantee that we are going to be always at the
beginning, and we make proper use of the reserved space allocated
previously with those '#padding' lines to avoid the out of space
condition. That's a 4-liner patch, which should be fine for lenny, and
prevents this bogus condition were the user most probably is going to
remove that file to be able to continue, which might produce an
inconsistent state in the dpkg db. And the real problem is that there
might not be an easy manual fix by the users if the status data could
not be completely written to the update file.

The other is that when onerr_abort is signaled dpkg should not
continue processing anything anymore, it should just do whatever cleanup
is required and exit. But that can wait probably post-lenny.

regards,
guillem




Forcibly Merged 497041 499070. Request was from Guillem Jover <guillem@debian.org> to control@bugs.debian.org. (Tue, 16 Sep 2008 20:18:07 GMT) Full text and rfc822 format available.

Tags added: pending Request was from Guillem Jover <guillem@debian.org> to control@bugs.debian.org. (Fri, 14 Nov 2008 08:45:07 GMT) Full text and rfc822 format available.

Tags added: pending Request was from Guillem Jover <guillem@debian.org> to control@bugs.debian.org. (Fri, 14 Nov 2008 08:45:09 GMT) Full text and rfc822 format available.

Reply sent to Guillem Jover <guillem@debian.org>:
You have taken responsibility. (Tue, 18 Nov 2008 11:57:07 GMT) Full text and rfc822 format available.

Notification sent to Moritz Muehlenhoff <jmm@inutil.org>:
Bug acknowledged by developer. (Tue, 18 Nov 2008 11:57:08 GMT) Full text and rfc822 format available.

Message #21 received at 497041-close@bugs.debian.org (full text, mbox):

From: Guillem Jover <guillem@debian.org>
To: 497041-close@bugs.debian.org
Subject: Bug#497041: fixed in dpkg 1.14.23
Date: Tue, 18 Nov 2008 11:47:04 +0000
Source: dpkg
Source-Version: 1.14.23

We believe that the bug you reported is fixed in the latest version of
dpkg, which is due to be installed in the Debian FTP archive:

dpkg-dev_1.14.23_all.deb
  to pool/main/d/dpkg/dpkg-dev_1.14.23_all.deb
dpkg_1.14.23.dsc
  to pool/main/d/dpkg/dpkg_1.14.23.dsc
dpkg_1.14.23.tar.gz
  to pool/main/d/dpkg/dpkg_1.14.23.tar.gz
dpkg_1.14.23_i386.deb
  to pool/main/d/dpkg/dpkg_1.14.23_i386.deb
dselect_1.14.23_i386.deb
  to pool/main/d/dpkg/dselect_1.14.23_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 497041@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Guillem Jover <guillem@debian.org> (supplier of updated dpkg package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Tue, 18 Nov 2008 11:50:56 +0200
Source: dpkg
Binary: dpkg dpkg-dev dselect
Architecture: source i386 all
Version: 1.14.23
Distribution: unstable
Urgency: low
Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
Changed-By: Guillem Jover <guillem@debian.org>
Description: 
 dpkg       - Debian package management system
 dpkg-dev   - Debian package development tools
 dselect    - Debian package management front-end
Closes: 367226 497041 498585 499028 499070 499736 500188 504123 504135 505735 505777 505836 505869 505910 506024
Changes: 
 dpkg (1.14.23) unstable; urgency=low
 .
   [ Raphael Hertzog ]
   * Blacklist "__gnu_local_gp" symbol for dpkg-gensymbols. Closes: #500188
     Thanks to Thiemo Seufer <ths@debian.org>.
   * Important bugfix in dpkg-gensymbols for people using includes in symbol
     files: the current object didn't flow back from the included file to
     the including file.
   * Fix Dpkg::Version comparison code. Closes: #504135
 .
   [ Guillem Jover ]
   * Untangle fatal abort condition from the “too many errors” one in the
     archives and packages processing loop. Closes: #367226
   * Abort on unrecoverable fatal errors instead of continuing execution, as
     the recovery code assumed the execution would not be reaching it again
     and some times bogus update files were created either with incompletely
     written content or with '#padding' lines. Closes: #497041, #499070
 .
   [ Updated dpkg translations ]
   * Brazilian Portuguese (Felipe Augusto van de Wiel).
   * Catalan (Jordi Mallach).
   * Czech (Miroslav Kure). Closes: #505910
   * French (Christian Perrier)
   * German (Sven Joachim).
   * Greek (Emmanuel Galatoulas). Closes: #498585
   * Japanese (Kenshi Muto).
   * Korean (Changwoo Ryu). Closes: #505777
   * Norwegian Bokmål (Hans F. Nordhaug).
   * Polish (Wiktor Wandachowicz).
   * Portuguese (Miguel Figueiredo). Closes: #505869
   * Russian (Yuri Kozlov). Closes: #499028, #505735
   * Romanian (Eddy Petrișor).
   * Slovak (Ivan Masár). Closes: #506024
   * Spanish (Javier Fernandez-Sanguino). Closes: #505836
 .
   [ Updated scripts translations ]
   * Fix typo in Russian. Closes: #499736
   * Fix wrong translation in French. Closes: #504123
   * French (Christian Perrier).
 .
   [ Updated manpages translations ]
   * German (Helge Kreutzmann).
Checksums-Sha1: 
 0dd87deec35b82fc020fbc9b60a65dce9ad1d9c5 1215 dpkg_1.14.23.dsc
 eb7014513d456b5ca11066fc2b4b46e352b8c9d6 6812928 dpkg_1.14.23.tar.gz
 279eaab3adf8b3e278abc52c419e7df287652ae6 2339510 dpkg_1.14.23_i386.deb
 e14406b0780d8bfbc89915758fef4b65c7a87105 784340 dselect_1.14.23_i386.deb
 159c145aa08c98184c9dd7092075b4c0c0a19e5f 763584 dpkg-dev_1.14.23_all.deb
Checksums-Sha256: 
 b641f26c25f29eb740b36d7788a53bfc471e6925dfe1c8c192af8710147c142a 1215 dpkg_1.14.23.dsc
 7d27f2389e05b8727c6a7126c0b65d67749c170ba143e648912a88f2fe707bca 6812928 dpkg_1.14.23.tar.gz
 6bada1e9b5170baece0786b1e14705ee987d2343e5c349893745d0019200e070 2339510 dpkg_1.14.23_i386.deb
 4ebadd51f4a47cb3b532e6d85c955390850d94ac853e7d397b0096c3f5ae1474 784340 dselect_1.14.23_i386.deb
 c6bc25c01c03a51306f30fd1114cbbb0ba7898ba7e9ad414554c748e041b1680 763584 dpkg-dev_1.14.23_all.deb
Files: 
 8204e822903dc1bc2bc0ad67ae2f1dc8 1215 admin required dpkg_1.14.23.dsc
 9c1744d32ceed71cbe1db863f64d329d 6812928 admin required dpkg_1.14.23.tar.gz
 bda6bda1074beab3bc77ef73dbe03c7f 2339510 admin required dpkg_1.14.23_i386.deb
 f2baef23074ff20ffe867830e655a9a9 784340 admin optional dselect_1.14.23_i386.deb
 df9cc0fc162b00f1bccc863403aafe2e 763584 utils optional dpkg-dev_1.14.23_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkkipgIACgkQuW9ciZ2SjJv8rwCghE1ePP0t55ygTp4pF9C66mir
aPgAnRmi0pwE9dYz3LV81QYfm85dpstQ
=tJ6g
-----END PGP SIGNATURE-----





Reply sent to Guillem Jover <guillem@debian.org>:
You have taken responsibility. (Tue, 18 Nov 2008 11:57:09 GMT) Full text and rfc822 format available.

Notification sent to Alexander Prinsier <debian@aphexer.mailhaven.com>:
Bug acknowledged by developer. (Tue, 18 Nov 2008 11:57:10 GMT) Full text and rfc822 format available.

Tags removed: Request was from Ben Hutchings <ben@decadent.org.uk> to control@bugs.debian.org. (Sat, 22 Nov 2008 20:57:08 GMT) Full text and rfc822 format available.

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sun, 28 Dec 2008 07:34:41 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Apr 17 06:40:55 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.