Fix grub of full disk encrypted ubuntu 14.04 x64 with uefi boot

After rebooting my crashed ubuntu following error popped up:

No bootable device -- Insert boot disk and press any key

The grub of my encrypted xubuntu needs to be reinstalled. Therefore i started on the same maschine with a ubuntu sick. It’s important to start in the same way your os is booting up. In my case it’s a 64 bit starting in efi mode not BIOS mode.
After booting up with the thumbdrive you check if it’s the right boot mode:

[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS
UEFI

Thats the right mode for my, next we switch to root:

sudo su

Something like this will show up:

root@ubuntu:/home/ubuntu#

Show the partitions of our disk (sda):

fdisk -l
Disk /dev/sda: 100 GiB, 1000000000 bytes, 100000000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 123123123-123123-123123-123123-123123
 
Device       Start       End   Sectors  Size Type
/dev/sda1     1223   1231231   1231231  111M EFI System
/dev/sda2  1231231   1231231    123123  111M Linux filesystem
/dev/sda3  1231231 123123123 123123123 1111G Linux filesystem

In order to use the encrypted filesystem we have to load a kernel module called dm-crypt:

modprobe dm-crypt

We need to open the LUKS partition, which can be done with cryptsetup:

cryptsetup luksOpen /dev/sda3 linux
Enter passphrase for /dev/sda3:

Scan if volume group is there:

vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "xubuntu-vg" using metadata type lvm2

Activate volume group:

vgchange -ay xubuntu-vg
  2 logical volume(s) in volume group "xubuntu-vg" now active
lvscan
  ACTIVE            '/dev/xubuntu-vg/root' [123 GiB] inherit
  ACTIVE            '/dev/xubuntu-vg/swap_1' [12 GiB] inherit

Prepare chroot environment:

mkdir /mnt/linux
mount /dev/xubuntu-vg/root /mnt/linux
mount -o bind /proc /mnt/linux/proc
mount -o bind /dev /mnt/linux/dev
mount -o bind /sys /mnt/linux/sys
chroot /mnt/linux /bin/bash

Something like this should follow:

root@ubuntu:/#

We are now in your chrooted into the filesystem that needs care.
Mount /boot from /dev/sda2 and /efi from /dev/sda1:

mount /dev/sda2 /boot
mount /dev/sda1 /boot/efi

Grub install:

grub-install /dev/sda
Installing for x86_64-efi platform.
Installation finished. No error reported.

Update grub:

update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.13.0-66-generic
Found initrd image: /boot/initrd.img-3.13.0-66-generic
Found linux image: /boot/vmlinuz-3.13.0-65-generic
Found initrd image: /boot/initrd.img-3.13.0-65-generic
Found linux image: /boot/vmlinuz-3.13.0-63-generic
Found initrd image: /boot/initrd.img-3.13.0-63-generic
Found linux image: /boot/vmlinuz-3.13.0-53-generic
Found initrd image: /boot/initrd.img-3.13.0-53-generic
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
Adding boot menu entry for EFI firmware configuration
done
root@ubuntu-mate:/#

Just reboot with your repaired system!