Repairing a Debian system that no longer boots after upgrades

Summary

In February 2012 Manuel Schmitt records a customer's guide to repairing a Debian system that no longer boots after upgrades from Lenny to Squeeze. The cause was a missing linux-image package: /boot only held a bzImage, so the GRUB update generated an empty grub.cfg. In the rescue system, chroot with bind mounts, a regenerated mdadm.conf and installing a kernel package fix it.

The repair path in the rescue system

First the boot disk is mounted under /mnt, then /dev, /sys and /proc are passed in via bind mounts, and chroot switches into the installed system. Package management and bootloader scripts then run as if the system had started normally.

Because the mdadm configuration was empty as well, mdadm --examine --scan reads the RAID metadata from the disks and appends matching ARRAY lines to /etc/mdadm/mdadm.conf. The mdadm manual page advises reviewing a file generated this way before use. Only then does aptitude install a linux-image package, so that /boot again holds a kernel GRUB can find.

Why a long upgrade path is risky

Debian 5.0 Lenny was released in February 2009, Debian 6.0 Squeeze in February 2011. The case shows that a system dutifully carried across such jumps with update, safe-upgrade and dist-upgrade can end up without a linux-image. This only shows at the next reboot.

Ideas

  • An empty grub.cfg can result when no matching linux-image is installed.
  • A rescue system with bind mounts enables package and bootloader repairs in a chroot.
  • mdadm --examine --scan rebuilds a lost RAID configuration from the disks' metadata.
  • Even careful upgrades can leave a system without a kernel package.
  • Order matters: first the RAID configuration, then the kernel package.

Insights

  • Regular package updates do not guarantee a complete boot path across several distribution jumps.
  • Bootability must be tested explicitly after kernel and RAID changes.
  • A guide from customer contact only becomes operational knowledge when written down.

Facts

  • The affected system had been upgraded from Debian Lenny to Squeeze.
  • /boot held a bzImage but no vmlinuz that GRUB would have detected during the update.
  • Debian 5.0 Lenny was released on 14 February 2009, Debian 6.0 Squeeze on 6 February 2011.
  • The mdadm manual page recommends reviewing configurations generated by a scan before use.

References

Recommendations

  • Check the kernel package, /boot usage and RAID state before a distribution upgrade.
  • Mark the kernel metapackage as manually installed so that no upgrade removes it.
  • Keep a tested rescue system and a documented chroot procedure ready.

Read the original article on Hostblogger

Search the Web Archive

Found a mistake or have something to add? Get in touch.