Auto Dual Boot on HP Zbook 15 G2 and unrecognized NVMe M.2 SSD

I told my friend about Zorin OS 16 and he wants to try it. But, his system is setup with an unorthodox way to force it to use an unsupported NVMe drive. He uses an EFI Script to instruct the system to boot up by pointing it at the Boot Manager. (Windows or Linux.)

Anyone have any suggestions on how to edit the script to present an operating system choice at startup?

Link to his actual post.

Thanks for anyone willing to assist him!

1 Like

Is it possible that he could install Zorin OS to an external SSD drive, and then just instruct the BIOS to boot off of the USB drive every time? If his computer is modern, USB 3.1 - 3.2 ports are connected via PCIE Gen 3 or Gen 4 standards, making it every bit as fast as an installed internal drive, connected to the same PCIE lanes.

@StarTreker

I'm not sure how all the new UEFI and EFI stuff work. It's after my time at being a computer hobbyist. I stopped when BIOS was still the main thing in ~2003.

He'll be replying in this forum soon after making an account.

Thanks for your input!

Hey, I hear ya, the last computer training I got was in the 2000's as well. Everything I have learned since is self taught, either through trial and error experience, or by looking at posts on the net.

1 Like

Yes, I could add a third hard drive to my system in that manner via USB, however that wouldn't provide me with a boot-up menu to select booting off of the two existing systems.

1 Like

I wonder if rEFInd might help you:

1 Like

I find the script fascinating. I'm curious of the contents in the nvme.txt file it refers. Copying the nvme driver to the Zorin efi boot directory with the amd64.efi and a pointer may be all you need. I'd want to know what's in the nvme.txt to see how it uses that to define os placement though. I'm sure it's possible, and may even be able to use the grub menu... but it depends on a few factors.

3 Likes

I take no credit for the script as I didn't write it, I agree with you - I obviously appreciate the hard work done by the original writers in the clever method of loading the driver to allow the system to see the M2 hard drive, without it I wouldn't be able to use M2 NVMe SSD's in my laptop as bootable device - neither would all of the other people that have been using this method since 2016.

There is nothing in the nvme.txt file, it's an empty file that the creator of the script added in his final revision of the script – from my understanding of the script, it acts as a pointer to locate the 350 MB EFI partition on the 'discovered' M2 Drive during the script’s execution after the NVMe driver has been loaded into memory and a device refresh/discovery is done to locate and load devices previously unavailable to the system. I originally did not copy the nvme.txt file to the appropriate partition when I set up my laptop and of course the script stopped telling me it couldn’t locate the NVMe Drive as it’s scripted.

From my own testing I can direct the script at " EFI\Microsoft\Boot\bootmgfw.efi " original script or " EFI\Ubuntu\grubx64.efi " modified script and it loads Windows or Linux Mint, in testing I haven’t been able to get either to show a boot menu. I wonder if I could call a batch file to present an option 1 or 2.

2 Likes

Welcome to the forum Darien217! Can I please take a moment to tell you how smart I think you are? :slightly_smiling_face:

Regarding the NVME driver, this reminds me of the Windows XP and earlier days. Back in those days, the ATAPI driver for optical drives, didn't come pre-loaded on the installation disk standard.

You literally had to have the ATAPI driver at the ready on a disk, or you weren't going to install Windows. And if the machine you are installing too was the only one that could access the internet, and you didn't have the driver, you were screwed lol.

Yep, I call them times, the PITA days. Its so much easier now when installation medium, comes with the drivers to make installation more simple. We take a lot for granted now days with computers. Kids today have no idea how easy they got it.

When you have to hunt down a bunch of drivers for all your components before a OS installation, it makes you appreciate what we have today.

2 Likes

Thank you, the boot up process is a bit complex to say the least, I remember it took me a bit to figure it out myself well enough that I could understand it to be able to explain it to someone else. :sweat_smile:

It's probably the most unique method I've seen personally of booting up a computer, I'd say most computers follow the standard / normal set up of having the BIOS or UEFI pick up the Bootmanger which in turns loads up the Bootloader for the operating system start-up process. etc.

I don't believe I ever had that issue with Windows XP and ATAPI drivers, I must have missed that one somehow and I've been using Windows since the 95/98SE days. @YukKevChuHau You ever have this issue with ATAPI's across your machines?

It is funny that you mention Windows XP; my laptop's boot-up process always reminds me of the Windows XP/Server 2003 Operating System Install process of "Press F6 if you wish to install a Third-Party SCSII or Raid Controller device", in which you needed to have the third-party SCSII or Raid Controller driver on a floppy disk or pre-added into the disc image in order to install Windows XP/Server 2003 on systems with third-party storage devices. (Been there, done that one too across a few systems.) You can consider my laptop's boot-up process similar to the F6 / SCSII-Raid Controller process, every time I boot it up and restart it, it locates a driver for the NVME SSD and then boots itself up off that, as it's scripted, no need to Press F6. The original writer of the script initially was booting up manually as I recall prior to making the automated script, he actually needed to manually type in all the commands to boot up his laptop. :grinning:

Eventually he got it scripted / automated.

For those that haven't followed the above link, and to make it easier to discuss changes, here is the script:

@echo -off set StartupDelay 3 set -v efishellmode 1.1.2;
mode 120 36 cls echo "+----------------------+" 
echo "| Running from Disk 0 |" 
echo "+----------------------+" 
echo "Find file system with NVMe Driver" 

if exist fs0:\EFI\Shell\NvmExpressDxe.efi then fs0: 
echo Found NVMe driver module on fs0: 
goto FOUNDNVMEDRIVERMODULE 
endif 

if exist fs1:\EFI\Shell\NvmExpressDxe.efi then fs1: 
echo Found NVMe driver module on fs1: 
goto FOUNDNVMEDRIVERMODULE 
endif 

if exist fs2:\EFI\Shell\NvmExpressDxe.efi then fs2: 
echo Found NVMe driver module on fs2: 
goto FOUNDNVMEDRIVERMODULE 
endif 

echo "Unable to find NVMe driver module". 

echo "Please mount the drive with the NVMe driver module". 
echo "" pause goto END :FOUNDNVMEDRIVERMODULE 
echo ============================================================= 
echo "" 
echo "loading the NVMe driver module" load \EFI\Shell\NvmExpressDxe.efi map -u echo "Find NVMe Drive Boot Loader" 

if exist fs0:\efi\Boot\nvme.txt then fs0: 
goto FOUNDNVMEBOOTLOADER 
endif 

if exist fs1:\efi\Boot\nvme.txt then fs1: 
goto FOUNDNVMEBOOTLOADER 
endif 

if exist fs2:\efi\Boot\nvme.txt then fs2: 
goto FOUNDNVMEBOOTLOADER 
endif 

if exist fs3:\efi\Boot\nvme.txt 
then fs3: 
goto FOUNDNVMEBOOTLOADER 
endif 

if exist fs4:\efi\Boot\nvme.txt 
then fs4: 
endif 

echo "Unable to find NVMe Drive boot loader". 
echo "Please mount the drive". 
echo "" pause goto END 

:FOUNDNVMEBOOTLOADER 
echo ============================================================= 
echo "" 
echo "loading the Windows boot loader on NVMe SSD" \EFI\Microsoft\Boot\bootmgfw.efi 
:END

Forgive me if the formatting is wrong.

I'm wondering if you replace the path to the txt file with

EFI\Ubuntu\grubx64.efi

If it will give you grub. Or copying the script to the Shell directory of the efi grub creates. This would reinforce what you want to launch.

Swapping the two lines below will boot the corresponding operating system as I mentioned in the original post. I haven't found either one to give me a Operating System menu which is what I'm after. It'll boot Linux Mint, it won't give me boot up menu either when I've tried it.

\EFI\Microsoft\Boot\bootmgfw.efi
\EFI\Ubuntu\grubx64.efi

I've been reading up on grub a little more, specifically custom entries (necessary for your nvme script). If you were to add this script and the necessary driver to grub by placing this script in the /etc/grub.d/ directory and naming it (07 through 09_custom) it will be called before the os search is performed, giving it a chance to run prior to os search. Pointing \EFI\Microsoft\Boot\bootmgfw.efi to the grubx64.efi (basically back on itself) if you need a pointer at all. Custom entry rules:

Custom User Entries (/etc/grub.d/40_custom). -
Entries to grub.cfg can be manually inserted by creating a file in the /etc/grub.d folder.

  • The name of the file determines the order in the menu. 30_os-prober entries will be placed before 40_custom entries, which will be placed before 50_my-sample entries.

  • Any created file must be made executable. This can be done as root by running
    "sudo chmod +x /etc/grub.d/filename".

  • The files in the /etc/grub.d folder will be read and the contents included in grub.cfg when the "update-grub2" command is executed as root. -

I'm still checking to modify this more... it's an interesting problem. We will find a solution though it may take a little time. I hope you see the direction I'm attempting.

2 Likes

Just curious, but have you tried modifying grub (/etc/default/grub) so that the following entry:

GRUB_CMDLINE_LINUX=””

Looks like:

GRUB_CMDLINE_LINUX=nvme_core.default_ps_max_latency_us=0

Then:

sudo update-grub

And see if it boots to grub (without your script)? These newer kernels include the nvme drivers and this entry would tell grub to find and use them prior to the os search.

If you do this in the live usb, connect another usb (persistence hasn't worked yet due to a problem in the Ubuntu base image) and copy the following two files over:

/etc/default/grub
/etc/grub.d/grub.cfg

Perform the install. Then close the installer when it asks to reboot by the x in the upper right. Mount the drive you installed to (on /mnt) and copy those files to the respective directories. Mount the following three also:

sudo mount --bind /dev /mnt/dev 
sudo mount --bind /sys /mnt/sys 
sudo mount --bind /proc /mnt/proc

Then mount the boot partition:

sudo mount /dev/nvmeXnXpX /mnt/boot

Then you can chroot into the /mnt to perform the update:

sudo chroot /mnt

Make sure you're in the right drive:

cd /boot

And make sure there are a few .mod files and the grub.cfg file. If not do not continue, go back and try your mounts again. Otherwise:

sudo update-grub

Exit and reboot.

That may solve your issue without needing the nvme boot script.

I'm sorry, but that would mean you'd have to copy off your custom efi and erase it to try... but it wouldn't be much to put it back using a live image if it doesn't work.

4 Likes

This makes a lot of sense to me.

2 Likes

Yup. I remember those days, especially in MS-DOS days. Needed a 5.25" or 3.25" floppy to boot up to load an ATAPI driver for the CD-ROM, and sometimes for SCSI too. Otherwise, the system won't be able to access CD-ROM or SCSI interface before anything. There were quite a few things requiring this back then like Iomega Zip drives. It was back before pretty GUI Win95 days where they started driver initialization automation behind the scenes with the splash screen.

I miss MS-DOS, Windows 3.0 & 3.11 so much now. Windows 2.0 * 2.1x was, meh. I loaded Win1.0 in the past just for fun to see how it looked like. Everything was so much easier back then. LOL.

2 Likes

I sometimes wish I forced myself to continue to learn programming for real. But, then I think again. Nah! :rofl:

Only actual computer lessons I had was with QBASIC in High School for a semester. No lessons before or after.

@337harvey You're a genius! :hamburger:

1 Like

You're too kind.... I'm glad we could help you. Please enjoy the OS and come back often for tips, tutorials and if you can, help others in their Linux journey.

1 Like

I remember those fun days, especially before the internet. But, having 9600 baud dial-up isp service often didn't really help. I remember even when I had 56k modem, before broadband, downloading what was it a few megabytes toook ages. When the connection was disconnected midway or someone need to use the telephone, it was argghhh. LOL.

I remember a computer teacher was downloading something for two days on a 14k dial-up modem back in the early 1990s, then lost the connection midway. He wanted to kill someone. LOL.

I sound like gramps now. Reminiscing about the good ole' days. LOL