You are not logged in.
Hi, I reinstalled Windows 10 yesterday, but GRUB is missing, the computer boot to Windows directly.
What I have tried:
1. Turn of Windows fast startup.
2. Chroot to ArchLinux, reinstall grub and rebuild grub config.
3. Check BIOS boot order.
4. EasyBCD, but it doesn't support EFI mode.
But not working. Btw, Linux and Windows are not in the same disk. The boot partitions are also on different hard disks.
Last edited by RazonYang (2021-04-28 09:35:44)
Offline
So, you think it should be working but it doesn't. Since you can chroot from a live Arch Linux installation (presumably booted in UEFI mode?) I would go about this the following way:
Check with efibootmgr the boot order. Post the results here (so people can double check things are set up correctly)
Post your partition layout here (output of lsblk and blkid or something similar)
Post the contents of EFI partition here
Post the contents of Arch boot partition here (since you have a separate one)
These are the things I would check in case of boot problems.
Also, double-check you have booted in UEFI mode when installing grub. I presume you already know this since you can recognize EasyBCD has not booted in UEFI mode, but just to double check: efibootmgr should error out, efivar -l should produce an error and there should be no /sys/firmware/efi/efivars in case you have booted in Legacy/BIOS mode. If that is the case, trying to fix UEFI installed Grub will be futile.
Offline
So, you think it should be working but it doesn't. Since you can chroot from a live Arch Linux installation (presumably booted in UEFI mode?) I would go about this the following way:
Check with efibootmgr the boot order. Post the results here (so people can double check things are set up correctly)
Post your partition layout here (output of lsblk and blkid or something similar)
Post the contents of EFI partition here
Post the contents of Arch boot partition here (since you have a separate one)
These are the things I would check in case of boot problems.
Also, double-check you have booted in UEFI mode when installing grub. I presume you already know this since you can recognize EasyBCD has not booted in UEFI mode, but just to double check: efibootmgr should error out, efivar -l should produce an error and there should be no /sys/firmware/efi/efivars in case you have booted in Legacy/BIOS mode. If that is the case, trying to fix UEFI installed Grub will be futile.
1.efibootmgr:
BootCurrent: 001E
Timeout: 2 seconds
BootOrder: 0010,0011,0012,0013,0014,001B,001A,001E,0018,0019,001C,001D,001F,0020,0021
Boot0010 Setup
Boot0011 Boot Menu
Boot0012 Diagnostic Splash Screen
Boot0013 Lenovo Diagnostics
Boot0014 Regulatory Information
Boot0015 Startup Interrupt Menu
Boot0016 Rescue and Recovery
Boot0017 MEBx Hot Key
Boot0018* USB CD
Boot0019* USB FDD
Boot001A* NVMe0
Boot001B* NVMe1
Boot001C* ATA HDD0
Boot001D* ATA HDD1
Boot001E* USB HDD
Boot001F* PCI LAN
Boot0020 Other CD
Boot0021 Other HDD
Boot0022* IDER BOOT CDROM
Boot0023* IDER BOOT Floppy
Boot0024* ATA HDD
Boot0025* ATAPI CD
Boot0026* PCI LAN
2.lsblk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 602.6M 1 loop /run/archiso/sfs/airootfs
sda 8:0 1 14.4G 0 disk
└─sda1 8:1 1 14.4G 0 part /run/archiso/bootmnt
nvme1n1 259:0 0 476.9G 0 disk
├─nvme1n1p1 259:1 0 16M 0 part
├─nvme1n1p2 259:2 0 200G 0 part
└─nvme1n1p3 259:3 0 276.9G 0 part /mnt
nvme0n1 259:4 0 465.8G 0 disk
├─nvme0n1p1 259:5 0 512M 0 part
└─nvme0n1p2 259:6 0 465.3G 0 part
├─vg0-root 254:0 0 128G 0 lvm
├─vg0-swap 254:1 0 32G 0 lvm
└─vg0-home 254:2 0 305.3G 0 lvm
nvme1n1 - Windows 10, nvme1n1p2 - C, nvme1n1p3 - D
nvme0n1 - Linux
nvme0n1p1 is the linux boot partition.
3. Windows doesn't create the boot partition when reinstalling it.
4. Linux Boot Partition:
EFI/
BOOT/
GRUB/
Microsoft/
System Volume Information/
grub/
fonts
grub.cfg
grubenv
locale
themes
x86_64-efi
initramfs-linux.img
initramfs-linux-fallback.img
vmlinuz-linux
5. I'm sure that it booted in efi mode.
I noticed the efibootmgr boot order is incorrect, I tried to fix it:
sudo efibootmgr -o 001A,001B
But it doesn't overwrite the boot order after restarting, I chroot into linux and found that the boot order is the same as before.
Last edited by RazonYang (2021-04-29 08:42:43)
Offline
Ok, a bit of glossary, as it seems there is a lot of confusion going on here. Windows "doesn't create boot partitions" is how it has always worked (AFAIK!). It never created them in BIOS/Legacy times (it booted from the primary partition tagged as "bootable" or "active") and especially with UEFI it should not. Some Windowses created rescue paritions, especially on Laptops (I've actually seen situations where a laptop manufacturers "rescue media" always creates additional rescue partitions, despite one already existing, spamming the disk with them if re-installed from the manufacturers rescue disk...). Windows NT-based Windowses might have created a loader partition before UEFI times (personally, I've never used anything past XP).
On UEFI systems, there is always an EFI system partition (=ESP) on UEFI enabled computers. See here: https://wiki.archlinux.org/index.php/EF … _partition
In addition, if the EFI partition (=ESP) is too small to hold linux kernel images (or other OS files required for booting before the said OS can access it's root partition), one could create an Extended Boot Loader Partition (see https://wiki.archlinux.org/index.php/EF … nt_points). On UEFI system, there (generally!) should not be OS-specific boot partitions, in addition to the OS-specific root partition (things should reside on the EFI and Extended Boot Loader partition). In practice, any OS might deviate from with this despite there being no need to do so (looking at Ubuntu...)
Second, on an UEFI system you do not boot by referring to disks or partitions - that's the BIOS/Legacy way! So setting the default to NVMe0 or NVMe1 is definitely wrong (however, if those devices contain a BIOS boot sector, UEFI BIOS might revert to Legacy booting, or if those entries are just weirdly/misleadingly named UEFI boot entries, they will just boot in a regular UEFI way).
Finally, from the looks of it you don't have Grub installed at all, or at least there seems to be no EFI entry for it. In case you follow the Arch Wiki instructions, the entry should be called "GRUB", however the entry name is really arbitrary. Some Linux distributions install grub as an entry labeled "Linux". There are files in [ESP]/EFI/GRUB, so Grub has been installed at some point. Did Windows installation really erase the EFI entry? (*)
To be able to install GRUB on an UEFI-enabled computer, you need to mount the ESP to the right place. From the looks of it, you have not even identified which one is the EFI partition. It seems like it is the one you call "Linux boot partition" - however, there is no such thing, so that is a misnomer! As you can see, your Linux boot partition also contains Windows stuff!
But it looks like you can probably chroot, and assuming your EFI is the nvme0n1p1 partition, mount it in /boot. Then re-install grub (follow the Wiki link above), however, to be sure, post the contents of your /etc/fstab.
Some questions:
What are the contents of the nvme1n1p1 partition?
What laptop is this? (some have buggy / non-standard / incomplete UEFI implementations)
From where did you install Windows? (*)
(*) I'm asking the 3. questions, since AFAIK current Windowses should not erase UEFI entries of other OSes, unless you use the laptop manufacturers installation medium, which can do whatever the manufacturer decided sensible - which might not be what the user wants. Using the rescue medium only makes sense if you really intend to use the Laptop only in the way the Laptop manufacturer wants you to use it. If standalone Windows installation medium still deletes other OS entries from UEFI, then, well, IMHO there should be anti-trust lawsuits flying at Micro$oft...
EDIT: TYPOs
Last edited by Wild Penguin (2021-04-30 09:35:53)
Offline
Ok, a bit of glossary, as it seems there is a lot of confusion going on here. Windows "doesn't create boot partitions" is how it has always worked (AFAIK!). It never created them in BIOS/Legacy times (it booted from the primary partition tagged as "bootable" or "active") and especially with UEFI it should not. Some Windowses created rescue paritions, especially on Laptops (I've actually seen situations where a laptop manufacturers "rescue media" always creates additional rescue partitions, despite one already existing, spamming the disk with them if re-installed from the manufacturers rescue disk...). Windows NT-based Windowses might have created a loader partition before UEFI times (personally, I've never used anything past XP).
On UEFI systems, there is always an EFI system partition (=ESP) on UEFI enabled computers. See here: https://wiki.archlinux.org/index.php/EF … _partition
In addition, if the EFI partition (=ESP) is too small to hold linux kernel images (or other OS files required for booting before the said OS can access it's root partition), one could create an Extended Boot Loader Partition (see https://wiki.archlinux.org/index.php/EF … nt_points). On UEFI system, there (generally!) should not be OS-specific boot partitions, in addition to the OS-specific root partition (things should reside on the EFI and Extended Boot Loader partition). In practice, any OS might deviate from with this despite there being no need to do so (looking at Ubuntu...)
Second, on an UEFI system you do not boot by referring to disks or partitions - that's the BIOS/Legacy way! So setting the default to NVMe0 or NVMe1 is definitely wrong (however, if those devices contain a BIOS boot sector, UEFI BIOS might revert to Legacy booting, or if those entries are just weirdly/misleadingly named UEFI boot entries, they will just boot in a regular UEFI way).
Finally, from the looks of it you don't have Grub installed at all, or at least there seems to be no EFI entry for it. In case you follow the Arch Wiki instructions, the entry should be called "GRUB", however the entry name is really arbitrary. Some Linux distributions install grub as an entry labeled "Linux". There are files in [ESP]/EFI/GRUB, so Grub has been installed at some point. Did Windows installation really erase the EFI entry? (*)
To be able to install GRUB on an UEFI-enabled computer, you need to mount the ESP to the right place. From the looks of it, you have not even identified which one is the EFI partition. It seems like it is the one you call "Linux boot partition" - however, there is no such thing, so that is a misnomer! As you can see, your Linux boot partition also contains Windows stuff!
But it looks like you can probably chroot, and assuming your EFI is the nvme0n1p1 partition, mount it in /boot. Then re-install grub (follow the Wiki link above), however, to be sure, post the contents of your /etc/fstab.
Some questions:
What are the contents of the nvme1n1p1 partition?
What laptop is this? (some have buggy / non-standard / incomplete UEFI implementations)
From where did you install Windows? (*)
(*) I'm asking the 3. questions, since AFAIK current Windowses should not erase UEFI entries of other OSes, unless you use the laptop manufacturers installation medium, which can do whatever the manufacturer decided sensible - which might not be what the user wants. Using the rescue medium only makes sense if you really intend to use the Laptop only in the way the Laptop manufacturer wants you to use it. If standalone Windows installation medium still deletes other OS entries from UEFI, then, well, IMHO there should be anti-trust lawsuits flying at Micro$oft...
EDIT: TYPOs
Thank you. I finally chose to reinstall the system. In the meantime, I found an interesting thing that Windows Installer will create EFI partition after deleting the Linux boot partition.
Btw, I am sure that the Windows is boot in EFI mode(msinfo32.exe). So I think Windows Installer has detected that there is already a boot partition, so there is no need to continue to create it.
In other words, Windows and Linux are using the same boot partition(nvme0n1p1). That's why grub and windows exist in the same boot partition(grub-install --bootloader-id=GRUB ...).
It's very similar to the problem I had before(Windows and Linux use the same boot partition, the computer will only start the Windows system.). I solved it by:
// Backup
# mv /boot/EFI/Microsoft/Boot/bootmgfw.efi /boot/EFI/Microsoft/Boot/bootmgfw.efi.ori
// Replace
# cp /boot/EFI/GRUB/grubx64.efi /boot/EFI/Microsoft/Boot/bootmgfw.efi
// Update grub config
# sed -i 's/bootmgfw.efi$/bootmgfw.efi.ori/g' /boot/grub/grub.cfg
But this solution is a bit fragile and will fail after every update of windows, so I decided to use difference boot partition.
Thank you for your reply
Last edited by RazonYang (2021-04-30 12:24:56)
Offline