You should first be aware that modern EFI-based computers boot in entirely different ways from older BIOS-based computers. I suspect you're laboring under incorrect BIOS-mode mental models, which is leading you astray. I recommend reading:
That's admittedly a long reading list. If you have time for just one, I'd go with the first, or possibly the second. The third and fourth are more practical tutorial on installation, but you've already got a working system, albeit one that's not working in quite the way you want.
Of particular importance for this discussion, under EFI, boot loaders are stored as ordinary files in the EFI System Partition (ESP). The boot loader to be launched by default is stored in NVRAM, which can be displayed by sudo efibootmgr -v
in Ubuntu, and modified with other options to efibootmgr
. (Type man efibootmgr
for details, in the usual terse manpage style.) Your /boot
partition holds Linux kernels, GRUB configuration and support files, and a few other boot-related tools; but the main GRUB binary, grubx64.efi
, is stored on the ESP, which is mounted at /boot/efi
in Ubuntu.
That out of the way, Windows requires the Windows boot loader, and Ubuntu requires a Linux boot loader. The latter is GRUB 2 by default, but can be any of several other EFI boot loaders for Linux. The task of a boot loader is to load an OS kernel into memory and start it running.
A boot manager, OTOH, displays a menu or otherwise provides a way for a user to select what OS to launch. GRUB and the Windows boot loader both provide boot manager functions as well as boot loader functions; but there are programs that provide boot loader functions only or boot manager functions only. In fact, all EFIs provide some sort of boot manager, although in some cases it's so primitive that it's useless.
I've heard that it's possible to configure the Windows boot manager to launch GRUB, even in EFI mode; but I don't know the details of how to do this. You might ask about it on a Windows forum if you want to investigate this approach.
Another alternative, if you don't like the GRUB UI, is to look into another boot manager. For something that's non-intimidating once configured, my own rEFInd boot manager may be to your liking. It presents a graphical view (although it's still keyboard-driven), so it's likely to be less intimidating than the text-mode GRUB. You might want to tweak rEFInd's configuration once it's installed. See its configuration and Secure Boot documentation in particular.
EDIT: Turns out, the below was "false alarm" of sorts; somewhat later, I realized the disk hosting this NTFS "EFI" partition is formatted MBR, not GPT; and it does not have an EFI folder either, nor typical expected Windows EFI files as EFI/Microsoft/Boot/bootmgfw.efi
. I guess, the presence of the "esp" flag on this partition is what got me confused.
In the end, I ended up doing this:
- First installed Ubuntu on a spare partition from an EFI booted USB, and ignored fails in installing grub on NTFS
- I hoped that I could flash GRUB2 manually on NTFS partition, but grub2 2.04 has explicit check for FAT, so that is for the time being impossible:
if (!efidir_is_mac && grub_strcmp (fs->name, "fat") != 0)
grub_util_error (_("%s doesn't look like an EFI partition"), efidir);
- Then I tried recommendation in comments:
To change the off ntfs EFI partition, just copy the files off, change the partition type and reformat to FAT, then copy the files back
This still didn't help dual boot at this point, however, now that I had a FAT32 partition, I could re-install Ubuntu, from stick booted in EFI mode, while flashing GRUB2 on this partition.
- Now Ubuntu did start up, but
os-prober
simply did not detect Windows at all; boot-repair
did not correct anything, but it mentioned that it saw "legacy windows"
- Finally, from the Ubuntu installation, I re-installed grub2 on the partition, but with
--target=i386-pc
; and forced legacy-only boot from BIOS
- Rebooting into Ubuntu now,
boot-repair
removed all grub EFI-related packages - and finally, os-prober
could see Windows partition; but the entry it added (with chainload
) could not boot into Windows, claiming disk was not bootable (which it isn't, as the Windows install is on partition 2, which is not marked bootable)
- Finally, as per suggestion in How to boot into Windows 7 when grub is installed in the Windows partition? - I added manuall a Windows 10 entry which used
ntldr ($root)/bootmgr
- and finally I have dual boot!
Which is to say - this first NTFS partition, which was bootable (and marked esp) was most likely not a real EFI partition - maybe it somehow facilitated recovery or something; which is (I guess) proven by the fact, that I could only achieve dual boot to Windows, by forcing legacy boot.
Not an answer, but just wanted to respond to this:
I'd like to see the output of sudo parted -l and sudo blkid on this system with the allegedly-NTFS ESP. I've seen such claims a couple of times before, but without evidence. ...
Please provide the parted -l and blkid output first, though; that could provide vital information.
Yup, just ended up with a system like that, refurbished ThinkPad.
I booted up Slax on my USB thumbdrive on this laptop (in legacy mode), and it provides this information (note that I've done a bit of manual partitioning, in addition to what was present upon disk already; I've also removed info about other drives):
root@slax:~# parted -l
Model: ATA KINGSTON SUV400S (scsi)
Disk /dev/sda: 120GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 368MB 367MB primary ntfs boot, esp
2 368MB 54.1GB 53.7GB primary ntfs
4 54.1GB 118GB 64.4GB extended
5 54.1GB 75.5GB 21.5GB logical ext4
6 75.5GB 108GB 32.2GB logical ntfs
7 108GB 118GB 10.7GB logical linux-swap(v1)
3 118GB 120GB 1611MB primary ntfs diag
So, partition 1 is marked both as ntfs, and as boot & esp.
root@slax:~# blkid
/dev/zram0: TYPE="swap"
...
/dev/sda1: LABEL="System" UUID="64C89227C891F78E" TYPE="ntfs" PARTUUID="5e4a12da-01"
/dev/sda2: LABEL="Windows" UUID="EE3E98553E9818A3" TYPE="ntfs" PARTUUID="5e4a12da-02"
/dev/sda3: LABEL="Recovery" UUID="28DE98A6DE986E36" TYPE="ntfs" PARTUUID="5e4a12da-03"
/dev/sda5: UUID="80bbb011-a20f-489f-99dc-bbcc9422f7f4" TYPE="ext4" PARTUUID="5e4a12da-05"
/dev/sda6: LABEL="XXXXXX" UUID="3BBF7C062DC0E351" TYPE="ntfs" PARTUUID="5e4a12da-06"
/dev/sda7: UUID="abf91577-e9e8-4cd5-9e3f-48393f6c084c" TYPE="swap" PARTUUID="5e4a12da-07"
/dev/sdb1: UUID="D4D5-9DAC" TYPE="vfat" PARTUUID="000568d1-01"
I wanted to install Ubuntu dual-boot on this machine along with Windows, so I booted up the mini.iso from USB thumbdrive (in EFI mode), which runs the text installer; originally it showed this state of partitions:
I then tried to to set up partition 1 to be "Used as" EFI system partition, which resulted with this state being shown:
... however, the text installer would have none of it - and it failed with "The attempt to mount a file system with type vfat in SCSI2 (0,0,0), partition #1 (sdb) at /boot/efi failed.":
So, yeah - the text installer does seem to make the assumption that the EFI partition is always vfat, and as in this case it is NTFS, the process there fails ...
So I cannot really tell, what I can do, to have Ubuntu installed on this system in dual boot configuration with Windows - without changing the EFI partition ...
EDIT: Here are approximately the files present on this first NTFS partition, mounted on /mnt
here (I had cut off some obvious translation and font files to make it easier to read) - note that there is no EFI folder anywhere:
$ tree /mnt/
/mnt/
├── Boot
│ ├── BCD
│ ├── BCD.LOG
│ ├── BCD.LOG1
│ ├── BCD.LOG2
│ ├── bg-BG
│ │ └── bootmgr.exe.mui
│ ├── BOOTSTAT.DAT
│ ├── bootuwf.dll
│ ├── bootvhd.dll
│ ├── cs-CZ
│ │ ├── bootmgr.exe.mui
│ │ └── memtest.exe.mui
│ ├── da-DK
│ │ ├── bootmgr.exe.mui
│ │ └── memtest.exe.mui
...
│ ├── Fonts
│ │ ├── chs_boot.ttf
│ │ ├── cht_boot.ttf
...
│ │ ├── segoen_slboot.ttf
│ │ ├── segoe_slboot.ttf
│ │ └── wgl4_boot.ttf
│ ├── fr-CA
│ │ └── bootmgr.exe.mui
...
│ ├── memtest.exe
│ ├── nb-NO
│ │ ├── bootmgr.exe.mui
│ │ └── memtest.exe.mui
...
│ ├── Resources
│ │ ├── bootres.dll
│ │ ├── da-DK
│ │ │ └── bootres.dll.mui
...
│ ├── ro-RO
│ │ └── bootmgr.exe.mui
...
│ └── zh-TW
│ ├── bootmgr.exe.mui
│ └── memtest.exe.mui
├── bootmgr
├── BOOTNXT
├── gboot
│ └── grub
├── grub
├── manboot
│ ├── bcd
│ ├── bootfix.bin
│ ├── boot.sdi
│ ├── efisys.bin
│ ├── efisys_noprompt.bin
│ ├── etfsboot.com
│ └── fonts
│ ├── chs_boot.ttf
│ ├── cht_boot.ttf
│ ├── jpn_boot.ttf
│ ├── kor_boot.ttf
│ └── wgl4_boot.ttf
└── System Volume Information
└── tracking.log
Best Answer
You're lucky as you have UEFI. (I seriously never thought I'd ever say that lol). Ubuntu supports SecureBoot/UEFI.
Install Ubuntu as normal. It should detect the UEFI configuration.
Once it's done, boot into your BIOS configuration and change the boot order. Move Windows further up and move Ubuntu down. The UEFI system will automatically boot into Windows instead of using GRUB2.
For you to boot into Ubuntu, simply enter the BIOS settings again and use the
Boot Override
menu. It can also be calledSelect boot device...
or similar.This works because UEFI uses boot files instead of a MBR. There can be multiple bootloaders on a single drive.
A standard EFI boot partition has the following (simplified) file scheme:
The EFI bootloader is (by default) trying to do this:
You can change the order so it looks for Windows first. Once the boot succeeds, it will not continue trying to use bootable EFI files. If you set Windows first (and it works), Windows will boot without GRUB ever being seen. You can then manually override this by using the
Select Boot File...
option/key/decoder ring/sacrifice/UEFI setting.Consult the documentation that came with your computer for the proper settings, keycombination, and/or the right mixture of blood. I do not know these off-hand.