VPS: Debian squeeze apt-get update returned an error code (1)

Also known as “E: Sub-process /usr/bin/dpkg returned an error code (1)“.
Well you are trying to run apt-get upgrade on a virtual private server running Debian squeeze (it can happen on Lenny too) hosted on several Xen based platforms.
It happens because grub cannot find your disk in order to rewrite your initrd image.

Since Xen kernel management is transparent to your machine itself, and it is all you need in order to boot your machine, you can remove grub with no fear, typing:

root@apple.com:~#apt-get remove grub-legacy grub-common

And yes, finally you will go to the end of your apt-get upgrade process.

Hope this can help out there!

 

Output of my machine follows:

Setting up linux-image-2.6.32-5-amd64 (2.6.32-39squeeze1) ...
Running depmod.
Running update-initramfs.
update-initramfs: Generating /boot/initrd.img-2.6.32-5-amd64
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
Searching for GRUB installation directory ... found: /boot/grub
warning: grub-probe can't find drive for /dev/xvda1.
grub-probe: error: cannot find a GRUB drive for /dev/xvda1.  Check your device.map.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-2.6.32-5-amd64.postinst line 799.
dpkg: error processing linux-image-2.6.32-5-amd64 (--configure):
subprocess installed post-installation script returned error exit status 2
Setting up linux-image-2.6.32-5-xen-amd64 (2.6.32-39squeeze1) ...
configured to not write apport reports
Running depmod.
Running update-initramfs.
update-initramfs: Generating /boot/initrd.img-2.6.32-5-xen-amd64
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32-5-xen-amd64 /boot/vmlinuz-2.6.32-5-xen-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 2.6.32-5-xen-amd64 /boot/vmlinuz-2.6.32-5-xen-amd64
Searching for GRUB installation directory ... found: /boot/grub
warning: grub-probe can't find drive for /dev/xvda1.
grub-probe: error: cannot find a GRUB drive for /dev/xvda1.  Check your device.map.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-2.6.32-5-xen-amd64.postinst line 799.
dpkg: error processing linux-image-2.6.32-5-xen-amd64 (--configure):
subprocess installed post-installation script returned error exit status 2
configured to not write apport reports
Errors were encountered while processing:
linux-image-2.6.32-5-amd64
linux-image-2.6.32-5-xen-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

After the cure, finally:

root@apple.com:~# apt-get remove grub-legacy grub-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
gettext-base libfreetype6 ucf os-prober
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
grub-common grub-legacy
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 5,931 kB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 17063 files and directories currently installed.)
Removing grub-legacy ...
Removing grub-common ...
Processing triggers for man-db ...
Processing triggers for install-info ...
Setting up linux-image-2.6.32-5-amd64 (2.6.32-39squeeze1) ...
Running depmod.
Running update-initramfs.
update-initramfs: Generating /boot/initrd.img-2.6.32-5-amd64
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
Setting up linux-image-2.6.32-5-xen-amd64 (2.6.32-39squeeze1) ...
Running depmod.
Running update-initramfs.
update-initramfs: Generating /boot/initrd.img-2.6.32-5-xen-amd64
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32-5-xen-amd64 /boot/vmlinuz-2.6.32-5-xen-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 2.6.32-5-xen-amd64 /boot/vmlinuz-2.6.32-5-xen-amd64

et voilà

And now

Some music

 

Incoming search terms:

  • raspbmc dpkg: error processing network-manager (--configure): (10)
  • debian upgrade dpkg: error al procesar linux-image-2 6 32-5-amd64 (--configure) (1)
  • kode initramfs (1)
  • mengrmbalikan apt get update (1)
(Visited 2,930 times, 1 visits today)

Author: Giuseppe Urso

Giuseppe lives in Haarlem now with his shiny dog, Filippa In 1982 received his first home computer, a Commodore 64, followed by Datasette and a 1541 Floppy Disk Drive. In 1999 he installed his first Linux distro (LRH6). In 2006 he switched to Debian as favourite OS. Giuseppe Urso actively sustains the Free Software Fundation and his founder Richard Mattew Stallman, he speaks to people trying to convince them to join the fight now, and about how important is to use Free Software only. He has a job as Infra Specialist at Hippo Enterprise Java Cms an Open Source Enterprise class Content Management System, one of the coolest company ever, in Amsterdam. He's always ready to install Debian on other people computers for free.

6 thoughts on “VPS: Debian squeeze apt-get update returned an error code (1)”

Leave a Reply

Your email address will not be published. Required fields are marked *