Ubuntu Pastebin

Paste from e at Fri, 9 Dec 2016 09:55:01 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
try pressing f10 or f12, choose ubuntu from the uefi list
if that doesn't work get an ubuntu live usb, boot it in uefi mode
type sudo apt-get install efibootmgr

then type sudo efibootmgr -v

you should get a list of boot entries with numbers
disable the windows entry with sudo efibootmgr -A -b <number here>
(sudo efibootmgr -a -b <number here> re-enables it)

if it still boots into windows
try pressing f10 or f12, choose ubuntu from the uefi list
if it works skip to part B otherwise
get an ubuntu live usb, boot it in uefi mode

then type sudo parted -l , get the list of partitions
mount the main linux partition with sudo mount /dev/sdxY /mnt
run the following command
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B /mnt$i; done

then sudo chroot /mnt
then type mount -a

part B)
then backup the windows efi files
sudo cp /boot/efi/EFI/Boot/bootx64.efi /boot/efi/EFI/Boot/bootx64.efi.backup
sudo cp /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi.backup

copy the ubuntu efi files over the windows ones
use shimx64.efi incase you're using pre-16.04 ubuntu with secureboot enabled
( mokutil --sb-state should say if it's enabled ) 
sudo cp /boot/efi/EFI/ubuntu/grubx64.efi /boot/efi/EFI/Boot/bootx64.efi
sudo cp /boot/efi/EFI/ubuntu/grubx64.efi /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi

then modify grub to look for the new windows efi file
type nano /usr/lib/os-probes/mounted/efi/20microsoft
edit the line that says bootmgfw.efi to bootmgfw.efi.backup
bootmgfw=$(item_in_dir bootmgfw.efi "$efi/$microsoft/$boot")

to

bootmgfw=$(item_in_dir bootmgfw.efi.backup "$efi/$microsoft/$boot")

press ctrl+x to save and exit

then type update-grub
Download as text