0

I'm currently dual booting Ubuntu 22.04 and Windows 10. Each is on its own separate drive. I would like to create a Hyper-V VM to boot to the Ubuntu drive in Windows 10.

I found this question on a different stack, but I ran into the issue where I could not take the disk offline, with the error "Disk attributes may not be changed on the current system disk or BIOS disk 0". I found this answer on yet another stack which gave the reason as being that there is a Microsoft boot partition, with the solution given to be "to remove the UEFI loader on the drive by deleting /boot/EFI/Microsoft and using efibootmgr, and update-grub" with further steps involving "copying shimx64 and grubx64 to /boot/EFI/boot, rename shimx64 to bootx64". However, unfortunately it is rather light on the details and does not have sufficient information for me know what to do.

As the solution appears to be something I need to do on the Ubuntu side, I am asking on this stack and not on one of the two linked stacks. I think what I need to do is to somehow remove the UEFI partition and then set up Ubuntu to boot without it from the drive it is on. Ideally I do not want to touch the drive that Windows is on both for fear of messing something up there and the fact that I do not like the GRUB menu. Currently I have to hit F12 during startup to get a BIOS menu in order to boot Ubuntu and I actually like that as I would like to normally boot to the same drive and only boot to the other in rare circumstances (and I don't want an unsightly menu that takes 30 seconds by default to go on with the default choice.)

But how can I remove the UEFI partition and still boot to the drive when I select the Ubuntu drive in the BIOS? I think all the steps about efibootmgr, update-grub, shimx64, etc. are involved, but I have no idea exactly what I need to do.

I also found this question which seems similar but appears to be different enough that I don't think the answer there would work here.

Update: I tried renaming all the windows directories on the EFI partition from Linux and discovered that I could no longer boot into Windows. I think looked closer and discovered that when Windows installed itself, despite my best efforts and believe that it was creating an EFI partition on the same drive that Windows was being installed on, it in fact used the existing EFI partition on the Ubuntu drive, which is not what I wanted. So I guess this question needs to be closed as invalid, and I need to create a new question on a different stack.

Michael
  • 1,135
  • 3
    I don't understand what you want. An EFI partition is required to boot. There is no "booting without an uefi partition". That's like asking to turn the computer on without electricity. Unless I misunderstand what you want to do – Matias N Goldberg Aug 09 '22 at 01:36
  • @MatiasNGoldberg Per my update, I mistakenly thought that Windows had created an EFI partition on the drive it was installing on. I wanted to delete the extra EFI partition on the drive Ubuntu is on without making Ubuntu unbootable. – Michael Aug 09 '22 at 01:37
  • 1
    It IS possible to have one disk with an EFI partition, and Linux in one disk and Windows in another. Grub and Windows boot images living in the disk containing the EFI partition. Is that what you want? – Matias N Goldberg Aug 09 '22 at 01:38
  • @MatiasNGoldberg I want the EFI partition on the Windows drive, and no EFI partition on the Linux drive, while being able to boot by selecting which drive to boot from from the system BIOS boot menu. – Michael Aug 09 '22 at 01:40
  • OK I think I understand. Writing an answer... – Matias N Goldberg Aug 09 '22 at 01:41
  • @MatiasNGoldberg Thanks! – Michael Aug 09 '22 at 01:42

1 Answers1

3

OK the solution you are looking for is possible but there's a million ways to mess up and leave you with un-bootable system.

Furthermore it would be a bad idea because if you later need to remove one disk (e.g. Windows disk goes bad, or needs to be moved to another computer) your Linux installation would end up unbootable.

However now I understand what you want:

  1. You want to use the BIOS to decide which OS to boot
  2. The GRUB menu looks unsightly (ugly) to you and you'd rather avoid it
  3. Most of the time you will be booting to the same OS, so you'd rather not have to chose every time nor have to wait

GRUB menu can be customized. In particular:

  1. It can be hidden
    • This is what happens by default on an Ubuntu-only installation. GRUB won't appear and will wait a couple of seconds while showing a black screen (to give you time to make the GRUB menu appear in case you need to boot into safe mode by hitting a special key)
    • However GRUB is shown by default when a Windows installation is detected, so that you can choose to boot into Windows if the user desires.
  2. The default timeout is awfully long but can be reduced (e.g. from 10 seconds down to 1 or 3 seconds, or instantaneous if you want)

Thus to get the behavior you want to achieve you need to:

  1. Open /etc/default/grub as root (e.g. sudo gedit /etc/default/grub)
  2. Add GRUB_TIMEOUT_STYLE=hidden
  3. Change GRUB_TIMEOUT=1 (1 means to wait 1 second, 0 means to boot immediately, 5 would mean to wait 5 seconds)
  4. When you're done save and then on terminal type sudo update-grub

You can see the documentation of all possible options for grub in case something calls your attention.

  • Thanks! I have configured grub in the past, the problem is, as it's not the default behavior I have to remember or look up how to do it every time. There got to be so many of these little "tweaks" I finally decided it was too much work and try to pick something with default behavior that I can tolerate. :) – Michael Aug 09 '22 at 04:44
  • In any case, it turns out I didn't need to get rid of the UEFI partition at all, just create a new one on the Windows drive. Not sure how to handle this with regards to the answer - it wasn't on the Ubuntu side, so I'm not sure answering the question here with how I solved the problem would be appropriate... – Michael Aug 09 '22 at 04:45