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
User avatar
kukamuumuka
Level 16
Level 16
Posts: 6699
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: 11701
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: 5441
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.
Fisonaka
Level 1
Level 1
Posts: 3
Joined: Wed Feb 19, 2020 9:47 am

Re: UEFI Dual boot in HP computer

Post by Fisonaka »

pbear wrote:
Tue May 12, 2020 11:31 pm
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.

Actually, such problem can be solved by government. When I was reading essay sample on page https://gradesfixer.com/free-essay-examples/government/ my college task become easier.

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.
Thank you so much. It's very helpful to me.
deepakdeshp
Level 18
Level 18
Posts: 8241
Joined: Sun Aug 09, 2015 10:00 am

Re: UEFI Dual boot in HP computer

Post by deepakdeshp »

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
That's exactly what I did and grub works for all installed os.
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help, and keeps the forum clean.
Regards,
Deepak

I am using Mint 20 Cinnamon 64 bit with AMD A8/7410 processor . Memory 8GB
pbear
Level 14
Level 14
Posts: 5441
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: UEFI Dual boot in HP computer

Post by pbear »

Certainly Jeremy's method is always worth trying. Worked in this thread, for example. Doesn't always work, though, and didn't for me.
dojero
Level 1
Level 1
Posts: 17
Joined: Fri Aug 07, 2009 6:46 pm

Re: UEFI Dual boot in HP computer

Post by dojero »

Fiskonaka's discussion of rEFIND is an effective solution, but that solution will work with any USB that can take over the boot process. I have an HP Elitebook x360 1030 g2. This is what I did to create a dual boot system:

I have an Arch Linux full hybrid install on a USB (by hybrid, I mean that it will boot both MBR and UEFI...MBR on the first partition, UEFI on the second partition, Arch Linux on the third partition). I booted the HP with an Arch ISO USB by directing the boot order to choose USB. I created to new partitions on the HP: a Linux partition for my ext4 Arch and an EFI partition. I then cloned (using dd) the Arch partition and the EFI partition of the fully installed USB to the new partitions on the HP.

The only change I made was to the grub.cfg file on the new Arch partition on the HP. In that file, I replaced the UUID of the root drive from the UUID of the USB (which was cloned) to the UUID of the Arch partition on the HP.

Now, when I boot the HP, I put the fully installed Arch USB. The HP BIOS automatically tries to boot from the USB, but it then chooses the EFI directory of the HP hard drive Arch. I don't know why this happens, but it does. So I insert the USB at the outset, but can remove it seconds later. The system boots into the Arch installed on the hard drive of the HP. When I want to boot Windows (I never want to boot Windows), I remove the USB before booting, and the HP BIOS boots from the Windows EFI.

Yes, I always have to have the USB handy to boot, but it's very small and not hard to have available.

One other problem: when I update my Arch install on the HP, I must also update the Arch install on the USB. If not, then in the first second or two, the system crashes, because it can't make the leap from the USB to the hard drive.

By the way, I have tried without success to use EFIbootmgr to disable, change order, etc. Nothing works, because HP apparently resets the boot order before it does anything else.

If I had it to do over again, I'd probably try systemd-boot. It may be that would do a better job of overriding the HP's refusal to let me boot directly from the hard drive with Linux.
pbear
Level 14
Level 14
Posts: 5441
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: UEFI Dual boot in HP computer

Post by pbear »

dojero wrote:
Tue Sep 08, 2020 2:55 pm
... rEFIND is an effective solution, but that solution will work with any USB that can take over the boot process.
Clever solution. You've made it more complicated than it needs to be, though. Assuming you have a full install USB drive, os-prober should add any internal systems to its Grub menu without special effort. At least it does with Mint and Ubuntu.
dojero
Level 1
Level 1
Posts: 17
Joined: Fri Aug 07, 2009 6:46 pm

Re: UEFI Dual boot in HP computer

Post by dojero »

Actually, os-prober does nothing for this particular situation. I've long used it very happily on other systems for dual boots directly from an installed Linux to select Windows. The problem here is that HP is making a BIOS that will not permit the use of a different EFI boot file than the Microsoft one. So no matter how you alter the BIOS or the EFI selection process, you can't boot from a Grub EFI Linux that is on the hard drive of the HP laptop.

That's why you must use the USB. What HP does permit is for the boot to first check for a USB and to let that trigger the boot, instead of going to the EFI boot file on the hard drive. That, in turn, allows for the system to get to the Grub EFI on the hard drive of the installed Linux.

Apparently, HP has some sort of deal with Microsoft that led them to this ridiculous situation. My workaround improves (for me) slightly on the rEFIND USB, because it lets me boot into my Arch that is installed on the hard drive. As I said, if I remove the USB and allow HP's BIOS to follow its nose, it will ONLY go to the Microsoft EFI. There is no way to get it to look first at the Grub/EFI on the installed Arch system.

Of course, if you want to leave the USB in all the time, you could certainly do what you're saying: OS-Probe to get the Windows boot listed on the Grub menu. Then, leave the USB in, boot the laptop, and you'll get the standard Grub menu list, and you can choose between Linux and Windows.
pbear
Level 14
Level 14
Posts: 5441
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: UEFI Dual boot in HP computer

Post by pbear »

dojero wrote:
Wed Sep 09, 2020 3:34 pm
So no matter how you alter the BIOS or the EFI selection process, you can't boot from a Grub EFI Linux that is on the hard drive of the HP laptop.
First, this is often true, but not always. Anyone dealing with the issue should try to solve the problem with firmware settings before resorting to one of the workarounds. Second, honest, I have a very good understanding of how full install USB drives work. As it happens, I was fiddling with a hybrid boot flash drive today, so was able to confirm my recollection. Grub on the flash drive is able to boot Mint installed to the internal hard drive of my HP, Windows also, no special gymnastics required. That said, this isn't a solution I'd recommend unless the user had a separate reason for wanting a full install USB drive. If not, one of the other workarounds will be easier.

Of which speaking, I've now had several Windows updates since my first post in the tutorial. So far, the StackExchange workaround has proven nicely stable (not bumped, as I feared/expected). And, as mentioned, easy enough to replicate if it does eventually get bumped. On the whole, I think it's probably the best workaround for the HP problem, better even than the rEFInd solution.
dojero
Level 1
Level 1
Posts: 17
Joined: Fri Aug 07, 2009 6:46 pm

Re: UEFI Dual boot in HP computer

Post by dojero »

I don't argue your experience, but I would hope that you can be open to the possibility that it's not universal. HP makes many, many computers. I specifically referred to the model I use: HP Elitebook x360 1030 g2.

What I can tell you is that there are many efforts described on the Internet for trying to get this particular model to boot into Windows, including all that you've described. NONE of them work. Not with this model. And that, too, is well documented on the Internet. Your method WILL NOT WORK with this particular model. I have another HP, a DIFFERENT MODEL, that dual boots Windows 10 and Arch Linux effortlessly and that required no special work to make that happen.

For people who also have HP Elitebooks, I thought that my approach, an expansion on the rEFIND approach outlined earlier by a different poster, would be helpful. I don't doubt for a second that your approach is a great one for models of HP that accommodate it. But the HP Elitebook does not accommodate it. So your approach for my particular laptop doesn't work. It can't work. Because of the HP BIOS that exists on that model.

Sadly, not all solutions work for all problems, even when the problems appear to be similar. I found my solution only after considerable effort and research and exploration of all the possible alternatives.

Your recollection of your experiences and the lack of special gymnastics required matches well with 99% of my experiences. I have a Dell laptop: dual boot effortlessly with Linux and Windows. I have an ASUS laptop: dual boot effortless with Linux and Windows. I have another HP laptop. Same. I have a Lenovo laptop: same experience.

BUT: IT DOESN"T WORK WITH THE HP ELITEBOOK X360 1030 G2 laptop. If anyone has a different experience with that model, I'd be interested to hear about it.
pbear
Level 14
Level 14
Posts: 5441
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: UEFI Dual boot in HP computer

Post by pbear »

Or you did something wrong. Anyhoo, it's a tutorial, not a debate. Anyone reviewing the tutorial is free to try your solution if they like.
dojero
Level 1
Level 1
Posts: 17
Joined: Fri Aug 07, 2009 6:46 pm

Re: UEFI Dual boot in HP computer

Post by dojero »

One final comment I will offer to readers other than pbear: take a look at the Arch Wiki on this problem:

https://wiki.archlinux.org/index.php/HP ... ook_840_G1

As it explains in the first line: "Even if UEFI, Arch Linux and (e.g.) GRUB are correctly configured and with the correct UEFI NVRAM variables set, the system will not boot from the HDD/SSD."

Sadly, pbear cannot accept this conclusion. But for others looking for a solution, Arch's Wiki has suggestions, which are echoed here. As well as the rest of the thread, including mine.

So workarounds exist. Not any that change the fact as stated in the Arch Wiki, but workarounds that can work.
pbear
Level 14
Level 14
Posts: 5441
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: UEFI Dual boot in HP computer

Post by pbear »

Useful link, which I don't think I've seen before, although the problem is well known. Two solutions are suggested: using the firmware, as I recommended above, or spoofing the boot loader, the solution given in the first post of the tutorial. Your solution isn't mentioned. I would suggest you open a thread in the support section if you want to understand how the simple USB boot solution works, but you're not using Mint, so that's not appropriate.
dojero
Level 1
Level 1
Posts: 17
Joined: Fri Aug 07, 2009 6:46 pm

Re: UEFI Dual boot in HP computer

Post by dojero »

Actually, for those who have only the SSD, only one solution in the Arch Wiki works (I have the SSD).

I posted my workaround here only because I was researching possible solutions and came upon this thread. You're right, I don't seek support from Mint.

I'm not sure about adding it to the Arch Wiki entry, which isn't about my particular Elitebook, but a very similar model/edition.

But for those still perusing this thread, I'd recommend the USB solutions over those mentioned in the Arch Wiki, because it's far less intrusive, and so carries far less risk.
pbear
Level 14
Level 14
Posts: 5441
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: UEFI Dual boot in HP computer

Post by pbear »

Sigh, no, SSD vs HDD has nothing to do with the HP boot problem. Yes, USB boot is a viable workaround (full install or rEFInd), but others are more suitable in most cases. In any event, I wouldn't recommend your way of doing it to anyone (though that's their choice, of course). Notice a difference between us. I'm the person who realized rEFInd would solve the problem and posted it to the tutorial. Then someone posted the StackExchange solution in another thread and I was able to recognize its superiority. Whereas you're stuck on your solution because, well, it's yours.
dojero
Level 1
Level 1
Posts: 17
Joined: Fri Aug 07, 2009 6:46 pm

Re: UEFI Dual boot in HP computer

Post by dojero »

The real difference between us is that I can read. Or perhaps it's that you're unwilling to read. For example, read the Arch Wik (https://wiki.archlinux.org/index.php/HP ... ook_840_G1)i:

"Warning: If you are trying to boot on a the mSATA port (m.2 SSD), this is the only working method."

People who read will know from that line that there is a difference between SSD and HDD. Sigh, indeed.
Post Reply

Return to “Tutorials”