My installation is a Ubuntu 12.04 64 bits (Classic "legacy" MBR - No EFI/UEFI here) with two partition :

  1. A separate boot partition
  2. An encrypted LUKS volume that contains the system Logical Volumes

I seems I accidentaly deleted all the current kernel files with:

sudo apt-get purge 'linux-image-3.8*' 

I applied the updates with Ubuntu Software Update, rebooted and then: Ubuntu can't boot.

I tried to boot on a live DVD with a 14.04.1 Ubuntu and can still see my partitions (described later):

/dev/sda1 (boot) /dev/sda2 (Encrypted volume) /dev/sda5 (Logical Volume container)

What are the steps to recover/reinstall the kernel files and dependencies in order to cleanly reboot my installed system?

Thanks in advance


Test this:

Start the computer with a live-dvd / usb.

Open a terminal.

Run it:

sudo -i
apt-get update
apt-get install lvm2 cryptsetup
modprobe dm-crypt
cryptsetup luksOpen /dev/sda2 crypt1
*##Write the passphrase##*
vgscan --mknodes
*##Save the volume name##*
mount /dev/<volume-name>/root /mnt
mount /dev/sda1 /mnt/boot
mount --bind /dev /mnt/dev 
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
cp /etc/resolv.conf /mnt/etc/resolv.conf
chroot /mnt
apt-get update
apt-get install --reinstall 'linux-image-3.8*'
apt-get clean
umount /mnt
  • Thanks for this procedure, I'm going to test it. Question: my home folder is also encrypted (with ecryptfs), is there an impact regarding your procedure? Are their some config files residing within the (encrypted) home folder needed to re-install the kernel & rebuild grub? – g0lem Sep 25 '14 at 11:27
  • Ubuntu repositories URLs aren't resolved in the chrooted environment, so apt-get can't gather informations from the Internet. I can ping internal & external IPs from the chrooted environment, but can't resolve hostnames. How can I set the name resolution? I booted from Ubuntu 14.04 DVD and the installed system I'm trying to recover is 12.04.2, does it matter? – g0lem Oct 12 '14 at 16:48
  • I wonder if copying the /etc/apt/sources.list from the chrooted environment (Ubuntu 12.04.3 Precise) to the live session (Ubuntu 14.04 trusty) /etc/apt/sources.list would get the Ubuntu repositories to be resolved correctly or mess things... I'd rather try a 12.04 DVD instead. There(s definitely a problem regarding the difference of the live session and the installed system version. – g0lem Oct 12 '14 at 17:10
  • This worked for me, combined with krm's comment below. Saved me hours of agony, thank you! – Andreas Jansson Aug 27 '17 at 12:45

I tried kyodake's answer above but kept getting this error after installation of the kernel: cryptsetup: WARNING: invalid line in /etc/crypt1 -. It would then reboot into an initramfs shell.

I got information from this answer that I had to unlock the encrypted volume, which was /dev/sda5 in my case, with the same name that the installed system expected.

Therefore I had to do cryptsetup luksOpen /dev/sda5 sda5_crypt for that particular step, which worked. Both the installed system and the live usb were 14.04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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