2

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

g0lem
  • 487
  • 3
  • 7
  • 13

2 Answers2

3

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*'
update-grub 
apt-get clean
umount /mnt
reboot 
kyodake
  • 17,808
1

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

krm
  • 111
  • 1