Fixing a dpkg io error
I encountered a dpkg related error a little while ago while upgrading packages on my Ubuntu Lucid server. I couldn’t find a fix on the internet and spent a little while investigating the cause. You can see from the command output that dpkg failed to properly install the Linux kernel package:
root@aeroplane:~# apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be upgraded: linux-image-2.6.32-33-generic 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 3 not fully installed or removed. Need to get 0B/31.6MB of archives. After this operation, 0B of additional disk space will be used. Do you want to continue [Y/n]? y (Reading database ... 178303 files and directories currently installed.) Preparing to replace linux-image-2.6.32-33-generic 2.6.32-33.70 (using .../linux-image-2.6.32-33-generic_2.6.32-33.71_i386.deb) ... Done. Unpacking replacement linux-image-2.6.32-33-generic ... dpkg-deb: subprocess paste killed by signal (Broken pipe) dpkg: error processing /var/cache/apt/archives/linux-image-2.6.32-33-generic_2.6.32-33.71_i386.deb (--unpack): short read in buffer_copy (backend dpkg-deb during `./lib/modules/2.6.32-33-generic/kernel/drivers/ata/sata_mv.ko') No apport report written because the error message indicates a dpkg I/O error Running postrm hook script /usr/sbin/update-grub. Generating grub.cfg ... Found initrd image: /boot/initrd.img-2.6.32-33-generic Found linux image: /boot/vmlinuz-2.6.32-32-generic Found initrd image: /boot/initrd.img-2.6.32-32-generic Found linux image: /boot/vmlinuz-2.6.32-31-generic Found initrd image: /boot/initrd.img-2.6.32-31-generic Found linux image: /boot/vmlinuz-2.6.32-30-generic Found initrd image: /boot/initrd.img-2.6.32-30-generic Found linux image: /boot/vmlinuz-2.6.32-29-generic Found initrd image: /boot/initrd.img-2.6.32-29-generic Found linux image: /boot/vmlinuz-2.6.32-28-generic Found initrd image: /boot/initrd.img-2.6.32-28-generic Found linux image: /boot/vmlinuz-2.6.32-27-generic Found initrd image: /boot/initrd.img-2.6.32-27-generic Found linux image: /boot/vmlinuz-2.6.32-26-generic Found initrd image: /boot/initrd.img-2.6.32-26-generic Found linux image: /boot/vmlinuz-2.6.32-25-generic Found initrd image: /boot/initrd.img-2.6.32-25-generic Found linux image: /boot/vmlinuz-2.6.32-24-generic Found initrd image: /boot/initrd.img-2.6.32-24-generic Found linux image: /boot/vmlinuz-2.6.32-21-generic Found initrd image: /boot/initrd.img-2.6.32-21-generic Found memtest86+ image: /boot/memtest86+.bin done Errors were encountered while processing: /var/cache/apt/archives/linux-image-2.6.32-33-generic_2.6.32-33.71_i386.deb E: Sub-process /usr/bin/dpkg returned an error code (1) root@aeroplane:~#
Somehow the package archive file /var/cache/apt/archives/linux-image-2.6.32-33-generic_2.6.32-33.71_i386.deb became corrupt. Cleaning the local cache of deb packages and then upgrading again fixed the issue:
root@aeroplane:~# apt-get clean root@aeroplane:~# apt-get dist-upgrade