1

I accidentally removed my current linux kernel from my Ubuntu 14.04.4 LTS by using this command: sudo apt-get purge linux-image-3.13.0-{77,79}-generic

Unable to boot into the system, now I found this good post on how to re-install kernel.

But, problem is sudo parted -l is showing boot flag is set for sda1 but ext4 partition is in disk /dev/mapper/ubuntu--vg-root as opposed to usual sdaX. Output of sudo parted -l.

Now, I'm unable to decide which filesystem to mount for re-installing kernel:

sudo mount /dev/sda1 /mnt

Or

sudo mount /dev/mapper/ubuntu--vg-root /mnt/boot

Here is Pastebin of Boot-Repair

curious
  • 13

2 Answers2

1

If I were to guess, you have a separate partition for /boot. That's not unusual, the installer does that when using LVM.

First mount /dev/mapper/ubuntu--vg-root at /mnt, and then mount /dev/sda2 at /mnt/boot.

muru
  • 197,895
  • 55
  • 485
  • 740
  • I'm still confused for /dev/sda2. Why it is not /dev/sda1 when boot flag is set for it? Also, should it be /dev/mapper/ubuntu--vg-root OR /dev/mapper/ubuntu--vg-root1 – curious Jun 16 '16 at 02:39
  • /boot contains files for the GRUB bootloader to use after it has started booting. It doesn't have to be flagged boot. And I don't see a /dev/mapper/ubuntu--vg-root1 anywhere. – muru Jun 16 '16 at 02:41
0

I was able to restore my linux kernel using commands provided in this post. Special thanks to @muru for extending help.

For reference, here are commands I executed:

ubuntu@ubuntu:~$ sudo mount /dev/mapper/ubuntu--vg-root /mnt
ubuntu@ubuntu:~$ sudo mount --bind /dev /mnt/dev
ubuntu@ubuntu:~$ ls /mnt/boot
efi
ubuntu@ubuntu:~$ sudo mount /dev/sda2 /mnt/boot
ubuntu@ubuntu:~$ sudo chroot /mnt

root@ubuntu:/# mount -t proc none /proc
root@ubuntu:/# mount -t sysfs none /sys
root@ubuntu:/# mount -t devpts none /dev/pts
root@ubuntu:/# export HOME=/root
root@ubuntu:/# export LC_ALL=C

root@ubuntu:/# apt-get update
root@ubuntu:/# apt-get -y install linux-image-generic

root@ubuntu:/# umount /proc || umount -lf /proc
root@ubuntu:/# umount /sys /dev/pts
root@ubuntu:/# exit
exit
ubuntu@ubuntu:~$ sudo umount /mnt/dev /mnt
curious
  • 13