UEFI Dual boot in HP computer

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Post Reply
User avatar
kukamuumuka
Level 16
Level 16
Posts: 6676
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

UEFI Dual boot in HP computer

Post by kukamuumuka »

It seems that many HPs are not so good, if using dual boot in the UEFI mode, because grub menu does not appear. One solution is to mount EFI-partition and copy and rename the copied Microsoft folder like Microsoft.orig

After that Copy grubx64.efi file from EFI/ubuntu folder to the EFI/Microsoft folder and rename grubx64.efi as bootmgfw.efi

After that edit /boot/grub/grub.cfg file for setting the right path for booting Windows also like
chainloader /EFI/Microsoft.orig/Boot/bootmgfw.efi
path.jpg
That makes both of systems capable to boot, but the better solution is to add windows entry to the /etc/grub.d/40_custom file, like

Code: Select all

sudo nano /etc/grub.d/40_custom
Menuentry for UEFI Windows where Windows boot files are on GPT partition 2 to the /EFI/Microsoft.orig/Boot folder

Code: Select all

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry 'Windows 10' {
	insmod part_gpt
	insmod fat
	set root='hd0,gpt2'

	chainloader /EFI/Microsoft.orig/Boot/bootmgfw.efi
}
... save and quit
Ctrl o
Ctrl x
After editing the file run sudo update-grub

http://puolanka.info/goto/etcgrub-d40_custom-file/
http://puolanka.info/goto/to-fix-window ... ootloader/

PS. Secure Boot is also good to disable from BIOS-settings.

Edit 15.5.2017 Microsoft's new updates breaks booloader every now and the, so it is good to make a UEFI-usb-boot-stick -> To make an UEFI-bootable USB -> http://puolanka.info/goto/to-make-an-uefi-bootable-usb/

About installing SG2uefi_en.img to an USB, you can make it many ways. The easiest way is to use cp command.

Code: Select all

sudo blkid ## tells drives and partitions
sudo umount /dev/sdXY  ## where X=drive and Y=partition
sudo cp SG2uefi_en.img /dev/sdX  ## where X=disk
Of course the same can do using dd also.

Code: Select all

sudo dd if=SG2uefi_en.img /dev/sdX  ## where X=disk
Edit 30.10.2018: An easy and safe way copy to an USB, is to use Etcher
https://en.wikipedia.org/wiki/Etcher_(software)
https://etcher.io/

RobHK
Level 3
Level 3
Posts: 121
Joined: Thu Apr 24, 2008 6:19 am

Re: UEFI Dual boot in HP computer

Post by RobHK »

Deleted
Last edited by RobHK on Sat Apr 13, 2019 7:00 pm, edited 1 time in total.

JeremyB
Level 20
Level 20
Posts: 11638
Joined: Fri Feb 21, 2014 8:17 am

Re: UEFI Dual boot in HP computer

Post by JeremyB »

On my HP I had to go into BIOS settings/system config then find the os boot manager and move ubuntu to the top of the list for it to use grub

RobHK
Level 3
Level 3
Posts: 121
Joined: Thu Apr 24, 2008 6:19 am

Re: UEFI Dual boot in HP computer

Post by RobHK »

JeremyB wrote:
Sat Apr 13, 2019 4:57 pm
On my HP I had to go into BIOS settings/system config then find the os boot manager and move ubuntu to the top of the list for it to use grub
I couldn't find Ubuntu in the BIOS.

My solution has problems so I've deleted it.

cjcoombs
Level 1
Level 1
Posts: 1
Joined: Sun Jul 14, 2019 2:28 am

Re: UEFI Dual boot in HP computer

Post by cjcoombs »

OS Boot Manager inside the bios settings was the answer to my problem on my HP laptop also. By simply changing the order putting Ubuntu over Windows by clicking F6 then F10 to save and exit, I was then given the option to choose which OS I wanted to load. Thanks for that info.

pbear
Level 14
Level 14
Posts: 5206
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: UEFI Dual boot in HP computer

Post by pbear »

Another workaround for this problem is to boot with rEFInd on USB flash drive. rEFInd is a boot manager developed by Rod Smith (a fork of an earlier project called rEFIt). Installed to the system EFI partition, presumably would have the same problem as Mint, i.e., HP would refuse to let it have boot priority. Booting from USB gets around this problem, because HP permits that (assuming it's set in the firmware). Once booted, rEFInd will detect Mint, Windows and any other installed systems, and can boot each of them.

It's relatively easy to create a rEFInd flash drive. Instructions at the website; see also this post of mine in a prior thread. See website for instructions on configuration, although the default settings work fine for a USB drive. See also advanced configuration. FYI, rEFInd only uses about 5 MB of space, so no need for as large an EFI partition as I recommended in that link (based on other tutorials). OTOH, flash drives are so large now it hardly matters. Let's say 100 MB and call it a day. Use the rest of the flash drive for backups (Timeshift or otherwise), storage, etc.

Caveat. As far as I can tell, there's no simple way to make rEFInd on a flash drive secure boot compatible (cf. this page for making a regular installation compliant), so this won't be suitable if you're keen to keep secure boot. Also, this workaround requires a doohickie to boot, which some will find annoying or even a deal killer. If it helps, the flash drive can be removed once the system has booted. And not needed for Windows boot.

Anyhoo, I recently decided to add dual boot to my HP laptop, as a test box for advice on the Forum. (My main Mint system is on its own laptop.) Tried every workaround out there. None worked, leaving me with two options: rEFInd-on-flash-drive and the Windows-spoofing method described in the OP. Seems to me rEFInd is better, as it's immune to Windows update. Depends whether you're wiling to give up secure boot, I suppose.

ETA: Per StackExchange, turns out there's another workaround and it works on my stubborn HP. The trick is to leave Windows in first position on the boot list, but disable it. Details at link. Like the spoofing workaround, presumably exposed to being overwritten by Windows update, but easier to do and easier to restore.

Post Reply

Return to “Tutorials”