2

I am running a VPS using Debian unstable with this kernel version:

2.6.32-274.7.1.el5.028stab095.1

I just upgraded my packages and for some odd reason APT wants me to install linux-image-3.2.0-3-amd64, which is strange, seeing as I can't modify the kernel as it's a VPS. I tried installing it anyway, but as I suspected it didn't work:

root@youmu:~# apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? Y
Setting up linux-image-3.2.0-3-amd64 (3.2.23-1) ...
Running depmod.
vmlinuz(/boot/vmlinuz-3.2.0-3-amd64
) points to /boot/vmlinuz-3.2.0-3-amd64
 (/boot/vmlinuz-3.2.0-3-amd64) -- doing nothing at /var/lib/dpkg/info/linux-image-3.2.0-3-amd64.postinst line 268.
initrd.img(/boot/initrd.img-3.2.0-3-amd64
) points to /boot/initrd.img-3.2.0-3-amd64
 (/boot/initrd.img-3.2.0-3-amd64) -- doing nothing at /var/lib/dpkg/info/linux-image-3.2.0-3-amd64.postinst line 268.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.2.0-3-amd64 /boot/vmlinuz-3.2.0-3-amd64
update-initramfs: Generating /boot/initrd.img-3.2.0-3-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.2.0-3-amd64 /boot/vmlinuz-3.2.0-3-amd64
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... Generating /boot/grub/default file and setting the default boot entry to 0
entry not specified.
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-3.2.0-3-amd64.postinst line 696.
dpkg: error processing linux-image-3.2.0-3-amd64 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 linux-image-3.2.0-3-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@youmu:~# 

So I tried to remove it, but it still failed.

I am wondering if there is a way to get APT to ignore a package as if it didn't exist so it won't bug me every time I install a package. I tried putting the package on hold but it still wants to re-configure it.

Any suggestions?

End of postinst file:

## Run user hook script here, if any
if ($postinst_hook) {
  &run_hook("postinst", $postinst_hook);
}

if (-d "/etc/kernel/postinst.d") {
  print STDERR "Examining /etc/kernel/postinst.d.\n";
  system ("run-parts --verbose --exit-on-error --arg=$version " .
          "--arg=$realimageloc$kimage-$version " .
          "/etc/kernel/postinst.d") &&
            die "Failed to process /etc/kernel/postinst.d";
}

if (-d "/etc/kernel/postinst.d/$version") {
  print STDERR "Examining /etc/kernel/postinst.d/$version.\n";
  system ("run-parts --verbose --exit-on-error --arg=$version " .
          "--arg=$realimageloc$kimage-$version " .
          "/etc/kernel/postinst.d/$version") &&
            die "Failed to process /etc/kernel/postinst.d/$version";
}

exit 0;

__END__
Mark
  • 357
  • 1
  • 4
  • 10
  • _I tried putting the package on hold but it still wants to re-configure it._ --> show us the output? – quanta Sep 07 '12 at 07:09
  • It's the exact same as the output in the question -- the way I put it on hold was with `echo linux-image-3.2.0-3-amd64 hold|dpkg --set-selections` – Mark Sep 07 '12 at 07:12
  • Post some lines around the line 696 in `/var/lib/dpkg/info/linux-image-3.2.0-3-amd64.postinst`? – quanta Sep 07 '12 at 07:19
  • Added to question, line 696 is the line starting with system in the first if block. I'm pretty sure the reason it's failing to install is because (as far as I am aware) it's not possible to change the kernel on a VPS. – Mark Sep 07 '12 at 07:24
  • Which VPS are you running? http://people.redhat.com/~rjones/virt-what/ – quanta Sep 07 '12 at 07:46
  • It tells me `openvz`. – Mark Sep 07 '12 at 07:52

2 Answers2

1

As a temporary, comment out the exec update-grub in the /etc/kernel/postinst.d/zz-update-grub by running:

$ sudo sed -i.bak '/exec update-grub/s/^/#/' /etc/kernel/postinst.d/zz-update-grub

then run the configuration script:

$ sudo dpkg --configure -a

If it works, you can restore the zz-update-grub file to its original content.

quanta
  • 50,327
  • 19
  • 152
  • 213
0

The accepted answer to ignore updating boot scripts for apt, no longer works as update-grub is now wrapped in an if block, which fails when there's nothing in-between. Here's a more effective way:

 $ sudo mv /usr/sbin/update-grub /usr/sbin/update-grub.disabled
 $ sudo mv /usr/sbin/update-initramfs /usr/sbin/update-initramfs.disabled
 $ sudo mv /usr/sbin/cryptsetup /usr/sbin/cryptsetup.disabled

This is an effective workaround if you're on NFS. Better would be to check the official Debian documentation, or improve the apt scripts so that it doesn't fail for NFS clients.

Related answer: How do I get apt-get to ignore some dependencies?

Dagelf
  • 589
  • 4
  • 14