for example when I "sudo apt-get install libmemcache0", I got:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libmemcache0 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "zh_CN.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up linux-image-2.6.24-16-xen (2.6.24-16.30) ...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "zh_CN.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.24-16-xen
Could not find postinst hook script [update-grub].
Looked in: '/bin', '/sbin', '/usr/bin', '/usr/sbin'
dpkg: error processing linux-image-2.6.24-16-xen (--configure):
 subprocess post-installation script returned error exit status 2
Setting up linux-image-2.6.24-24-386 (2.6.24-24.61) ...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "zh_CN.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.24-24-386
Could not find postinst hook script [update-grub].
Looked in: '/bin', '/sbin', '/usr/bin', '/usr/sbin'
dpkg: error processing linux-image-2.6.24-24-386 (--configure):
 subprocess post-installation script returned error exit status 2
Errors were encountered while processing:
 linux-image-2.6.24-16-xen
 linux-image-2.6.24-24-386
E: Sub-process /usr/bin/dpkg returned an error code (1)

What can I do?

link|improve this question
Is this a VM? Do you have grub installed? – Paul Dec 6 '11 at 7:27
Your issue seems to be with GRUB. Make sure that GRUB is installed correctly (reinstall it if necessary) and that the paths in /etc/kernel-img.config are correct. See also: serverfault.com/questions/328773/… – user55325 Dec 6 '11 at 7:28
Linode vps,how do I know is there grub? – Tinyfool Dec 6 '11 at 7:28
@user55325 But when I run "which update-grub" or "which grub", there is nothing. – Tinyfool Dec 6 '11 at 7:34
@Paul use linode vps, no grub. – Tinyfool Dec 6 '11 at 7:38
show 1 more comment
feedback

1 Answer

up vote 3 down vote accepted

As you are running in a VM you don't want ubuntu to try to re-install grub after changing any kernel related stuff, as you don't have a boot loader of your own.

Edit

/etc/kernel-img.conf

And comment out the lines:

postinst_hook = update-grub
postrm_hook   = update-grub

You'll probably need an

sudo apt-get -f install

afterwards

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.