I was updating Ubuntu 16.04, and it hung at:

Setting up grub2-common (2.02~beta2-36ubuntu3.17) ...
Setting up grub-efi-amd64-bin (2.02~beta2-36ubuntu3.17) ...
Setting up grub-efi-amd64 (2.02~beta2-36ubuntu3.17) ...
Installing for x86_64-efi platform.

I now know this was probably stupid, but I switched the machine off after a while, and Ubuntu no longer boots properly. In the grub prompt I located the relevant files and ran:

linux /vmlinuz-4.10.0-33-generic
initrd /initrd.img-4.10.0-33-generic

and then it boots in grub, up until "Please unlock disk sda3_crypt:"

I have tried the usual passphrase, and every combination I can think of but it won't unlock - "cryptosetup failed".

I recall an issue with the keyboard layout swapping two of the characters round when I first made the passphrase, so I wonder if it is something to do with this? It seems the boot is working, but is it possible to restore the GUI version of this unlock prompt? I thought that might help to enter the correct passphrase if it's something to do with the keyboard layout.

I have since then also booted a live CD and used boot-repair, but that did not restore the GUI.

OK, update: I used crytosetup -v luksOpen /dev/sda3 sda3_crypt, from the >initramfs prompt that was left after it failed to decrypt/boot - it appears it is in US keyboard layout as suspected, I entered the passphrase by pressing the keys that would be the correct passphrase in US layout (instead of UK keyboard), and it says Key slot 0 unlocked, which I guess is progress? It just hangs here however.

Success! I think... Rebooted, and entered using the altered key combination, and it now decrypts - I think the above just gave me more chances to try out passphrases, which was the aim as I was fed up of rebooting - it then said, welcome to emergency mode.. I wasn't sure what that was and after a bit of faffing around (update-grub, grub-install etc. did not work), I rebooted and input "normal" instead of "boot" in grub and now I am in ubuntu full GUI. However boot is still broken, so how to fix - perhaps might have to leave this one until tomorrow, but seems like some success, any input on where to go from here would be much appreciated as I can only boot through grub at the moment (tried update-grub through ubuntu GUI, no errors, but didn't fix it).

  • What do you mean by "I can only boot through grub at the moment"? You want to get rid of the Grub menu and boot straight away on your ubuntu ? Or you still need to boot via grub terminal ? – Simon Van Machin Mar 1 '18 at 7:22
  • I can only boot via the >grub prompt, grub menu/normal booting of ubuntu does not work - I only have Ubuntu 16.04 installed on this computer – sumade Mar 1 '18 at 18:26

As you still have access to your system (if not, do it after mounting your FS via a liveUSB/CD), try running :

sudo grub-install /dev/sda3
sudo grub-install --recheck /dev/sda3
sudo update-grub

See How to Ubuntu : how to repair/reinstall Grub2 for further reading.

  • in the end very similar to this worked, i booted from >grub prompt (did not require live CD) and used sudo update-grub, followed by sudo grub-install, it now boots correctly into the GUI - previously I did not issue grub-install so presumably the files were still missing when I rebooted – sumade Mar 2 '18 at 10:42
  • Good for you;) By doing it the other way around, you juste take the logical steps, back from the begining (installing -wiping old tables-updating), but I think that grub-install do the wiping/updating by itself nowadays;) – Simon Van Machin Mar 2 '18 at 13:32

I had exactly the same problem when updated 16.04 week ago. Also my system was encrypted.

I did not manage to solve with those different manual grub updates.

Create persistent ubuntulive usb that keeps your settings and other changes, helps a lot when re-starting system many times.

Then via ubuntulive:

cryptsetup open --type luks /dev/sda3 lvm
mkdir /mnt/a3
mount /dev/ubuntu-vg/root /mnt/a3
cd /mnt/a3

opened everything else than my home directory where I had most of the content. (When you install Ubuntu, then in the addition of whole disk LUKS, there is that option to have extra encryption for home directory, found out that its encryption is opened just when you give your ubuntu password).

For my case

sudo ecryptfs-recover-private

with this suggested unmounting of gvfs solved: “sudo ecryptfs-recover-private” gives “find: ‘/run/user/1000/gvfs’: Permission denied” - Files Lost?

in that way I got copy of my files. After all those I still tried to update grub but did not manage and then finally re-installed Ubuntu, this time without that home directory encryption (because I have LUKS anyway).

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.