Updated My BIOS, Messed Up My Dual Boot, And How I Fixed It

Brian Terczynski
5 min readSep 16, 2022

--

Photo by Artiom Vallat on Unsplash

Note: The information in this article is very specific to my particular setup, and what I describe here may not work for everyone. Even so, I’m sharing this just in case others may run into similar situations, and might find at least some of this information useful.

Years ago, I installed Linux (Ubuntu) on my Lenovo Yoga 720 laptop as a dual-boot with Windows 10. To get it to work, I had to adjust a few settings because Windows insisted on always taking priority when booting up (thus refusing to let grub run). That was so long ago that I forgot what the steps were, but as things have been working fine for years I no longer worried about it.

Recently I decided to install an update to my BIOS. I had blind confidence that the upgrade would work without a hitch.

Well, there was a hitch.

When I rebooted my system, grub came up. But it didn’t show me the typical menu allowing me to select my operating system. Instead it dropped me into the command line. And I had no clue how to use that. After typing help to get the list of commands, I decided to just reboot my computer to see if this was just an aberration.

Well, after I did that I never saw grub again.

Now, when my laptop would boot up it would always take me into Windows. It never booted from the UNIX partition on which grub was installed (even though I thought it was higher priority).

It dawned on me that my BIOS settings may have changed after the BIOS upgrade. I had to look up online what the magic key was to open the BIOS upon reboot. On my system it was F12. I tried that but Windows would boot up so fast I could never get the BIOS menus to come up.

Fortunately I could get into the BIOS from Windows 10. This article describes how, from Windows 10, you can reboot into your UEFI settings (which is actually what my system has, although my system also uses the term BIOS).

In the Boot options, I noted that Ubuntu was listed first. Even so, Windows would always boot up. UEFI was selected as the Boot Mode. So I tried changing it to “Legacy Support”, with a Boot Priority of “Legacy First”.

After a couple tries, and having to fix the boot order again, I got grub to come back up. But it was still giving me the command prompt.

Fortunately, I found this helpful article that listed the steps to get Ubuntu to boot up and restore the grub menu. The only problem was I didn’t know what my boot device (/dev device) was named. So I ran the linux command in grub without the root= parameter to get me into initramfs. Somewhere online (I forgot where, but this article has some information) I found out that I could determine the names of my drives by running the blkid command. When I ran it, I got output similar to the following:

/dev/nvme0n1p5: LABEL="WINRE_DRV" BLOCK_SIZE="512" UUID="<...>" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="<...>"
/dev/nvme0n1p3: LABEL="Windows" BLOCK_SIZE="512" UUID="<...>" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="<...>"
/dev/nvme0n1p1: LABEL_FATBOOT="SYSTEM_DRV" LABEL="SYSTEM_DRV" UUID="<...>" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="<...>"
/dev/nvme0n1p6: UUID="<...>" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="<...>"
/dev/nvme0n1p4: LABEL="LENOVO" BLOCK_SIZE="512" UUID="<...>" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="<...>"

The partition of TYPE="ext4" was the one I wanted (since the others were either Windows-specific or system partitions). The device name of my partition was therefore /dev/nvme0n1p1 (what threw me off was the “nvme”; I was expecting my drive to be named something like /dev/sdN, but because my drive was solid state and apparently NVMe, it was named accordingly).

Armed with this, I rebooted back into the grub command line. I then ran these commands (specific to my system):

grub> set root=(hd0,gpt6)
grub> linux /boot/vmlinuz-5.15.0-47-generic root=/dev/nvme0n1p1
grub> initrd /boot/initrd.img-5.15.0-47-generic
grub> boot

Ubuntu started up successfully!

Then, following the advice in that same article above, I ran sudo update-grub to get the grub menu to show up. I rebooted my system.

No menu. grub still came up at the command line.

I really didn’t know what to do at this point. I went back to Windows to see if maybe Fast Startup was interfering (I seem to remember turning it off before for this very reason).

It was still off.

I went back into the grub command line. And I noticed something. There were these efi equivalents for the linux and initrd commands: linuxefi and initrdefi. I decided to use those commands instead to see if they would yield any better results. I tried them, and got back into Ubuntu. I ran sudo install-grub (just to be sure) then sudo update-grub. I then rebooted my system.

The good ole grub menu appeared once again!!!

I felt funny about keeping my BIOS in Legacy boot mode, and wasn’t sure that was needed anymore. I went back and switched it to UEFI.

My last test: ensure I could still get into Windows without it hijacking grub. It worked. After booting up Windows and then rebooting my computer, grub still came back up as the preferred boot option. No hijacking.

I was back to normal!

So here’s a summary of what worked for me after upgrading my BIOS, to restore my dual boot (for my particular setup):

  • Go into the BIOS settings (either while pressing the magic key during boot up or via Windows).
  • Change the Boot Mode from “UEFI” to “Legacy”, and the Boot Priority to “Legacy First”, save and restart.
  • In the grub command line, run the following (if the boot device is known):
grub> set root=(hd0,gpt6)
grub> linuxefi /boot/vmlinuz-5.15.0-47-generic root=/dev/nvme0n1p1
grub> initrdefi /boot/initrd.img-5.15.0-47-generic
grub> boot
  • If the name of the boot device is unknown, then run this in the grub command line:
grub> set root=(hd0,gpt6)
grub> linuxefi /boot/vmlinuz-5.15.0-47-generic
grub> initrdefi /boot/initrd.img-5.15.0-47-generic
grub> boot

Then when initramfs comes up, run blkid to list your block devices (which should include disk drives/partitions). From there, determine the UNIX partition for booting. Then go back into grub and type the above commands, but supply root=/dev/your_unix_partition to the linux command.

  • Ubuntu boots up. Then run sudo update-grub ( sudo install-grub may or may not need to be run first).
  • Reboot. The Grub menu should once again appear.
  • Go back into the BIOS settings and switch the boot method back to UEFI.

--

--

Brian Terczynski

Documenting my learnings on my journey as a software engineer.