Windows 10 Formatted EFI partition when installing Linux

choz

New Member
Hello everybody!
As the title suggests, im in a bit of a rough one right now. I am not sure of this, but I am pretty sure I screwed my Windows bootloader on my machine.
I can't speak in boot lingo since I don't exactly know what to call everything, so I'll do my best at exlaining the situation. Hopefully some linux commands can help me do this.

These are the drives on my system:
Code:
sda      8:0    0 223.6G  0 disk
├─sda1   8:1    0   500M  0 part
└─sda2   8:2    0 223.1G  0 part
sdb      8:16   0   1.8T  0 disk
└─sdb1   8:17   0   1.8T  0 part /mnt/FAT
sdc      8:32   0 931.5G  0 disk
├─sdc1   8:33   0 589.6G  0 part
├─sdc2   8:34   0   512M  0 part /boot
├─sdc3   8:35   0  20.7G  0 part [SWAP]
├─sdc4   8:36   0    31G  0 part /
└─sdc5   8:37   0 289.1G  0 part /home
With more detail:
Code:
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5420c558

Device     Boot   Start       End   Sectors   Size Id Type
/dev/sda1  *       2048   1026047   1024000   500M  7 HPFS/NTFS/exFAT
/dev/sda2       1026048 468856831 467830784 223.1G  7 HPFS/NTFS/exFAT


Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 8293B66F-9FF3-4627-B2FA-DBFBB03006A0

Device          Start        End    Sectors   Size Type
/dev/sdc1   264192 1236723711 1236459520 589.6G Microsoft basic data
/dev/sdc2  1236723712 1237772287    1048576   512M EFI System
/dev/sdc3  1238677504 1282080767   43403264  20.7G Linux swap
/dev/sdc4  1282080768 1347184639   65103872    31G Linux filesystem
/dev/sdc5  1347184640 1953525134  606340495 289.1G Linux filesystem


Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9493dc87

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1  *     2048 3907026943 3907024896  1.8T  7 HPFS/NTFS/exFAT

As you can see, sdc is the drive that holds the EFI partition. I've recently switched between plenty of linux distributions, all dual booted from this drive, and everything worked out fine. With my latest install of linux, I messed up and now the EFI partition holds no information of Windows boot- at least that is what I think, since I formatted sdc2.
Nevertheless, my Windows install is on sda, and sdb is a drive for storage. sdc1 is also used for storage.

Regarding the purely-intended-for-Windows disk (sda), the partition sda1 has an asterisk on the boot column, but booting into it leads to a grub in rescue mode. This is probably due to previous dual boot setups on that drive.

Long story short, for now, I can ONLY boot into drive sdc, and that drive has the systemd-boot bootloader which I can use to get into Arch Linux.

Ideally, I hope to add an entry to systemd-boot bootloader to boot Windows, and I believe that can be done by having a Windows bootloader present somewhere and reinstalling the systemd-boot bootloader from Arch (the linux command 'bootctl --path=/boot install' (/boot being sdc2) has always given me an output referencing the acknowledgement of a windows partition. BUT! The most recent execution gave no such thing. So, since I know I can run that command again from Arch, I guess it could recognize a Windows bootloader if I manage to set one up.)

What can I do to fix this issue? It would be nice if I could at least boot into Windows again. Any advice as to recovering the ability to boot into windows or even resolve the issue as a whole are very much appreciated. I'm open to whatever kind of solution you can provide.

Thanks in advance!
 
Are the Microsoft files intact on the EFI partition. Should be an EFI directory and Microsoft and Boot directories in that.
 
Are the Microsoft files intact on the EFI partition. Should be an EFI directory and Microsoft and Boot directories in that.
├── amd-ucode.img
├── EFI
│ ├── BOOT
│ │ └── BOOTX64.EFI
│ └── systemd
│ └── systemd-bootx64.efi
├── initramfs-linux-fallback.img
├── initramfs-linux.img
├── intel-ucode.img
├── loader
│ ├── entries
│ │ └── arch.conf
│ └── loader.conf
└── vmlinuz-linux

Those are the directories currently present in sdc2, the /boot partition of sdc.
I would say that there are no windows files right there.

Running 'sudo bootctl --path=/boot install', the command I mentioned in the original post (for installing systemd-boot bootloader, which automatically recognizes windows bootloader and incorporates it as an option in the bootloader) produces this output:
Code:
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/systemd/systemd-bootx64.efi".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/BOOT/BOOTX64.EFI".
Created EFI boot entry "Linux Boot Manager".
No Windows to be found here.
 
If they are you should only need to add an EFI entry like so
efibootmgr --create --disk /dev/sda --part 2 --loader /EFI/Microsoft/Boot/bootmgfw.efi --label "Windows 10"

--Part 2 is the partition number that holds the windows boot manager partition index starts at 1
--disk the /dev/sd[L] of the disk with the Windows boot manager
 
you should be able to add them to efi with efibootmgr if they're on any of the disks.
 
I am not sure if I have a Windows partition on any of my disks.
I think I don't, is there any way to check this?
Booting into sda gives me a broken grub in rescue mode.

This is the tree view of sda1 mounted on linux:
Code:
/media/sda1/
├── $RECYCLE.BIN
│   └── S-1-5-21-645605552-1555623987-101819492-1001
│       └── desktop.ini
├── $WINRE_BACKUP_PARTITION.MARKER
├── Boot
│   ├── BCD
│   ├── BCD.LOG
│   ├── BCD.LOG1
│   ├── BCD.LOG2
│   ├── bg-BG
│   │   └── bootmgr.exe.mui
│   ├── bootspaces.dll
│   ├── BOOTSTAT.DAT
│   ├── bootvhd.dll
│   ├── cs-CZ
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── da-DK
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── de-DE
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── el-GR
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── en-GB
│   │   └── bootmgr.exe.mui
│   ├── en-US
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── es-ES
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── es-MX
│   │   └── bootmgr.exe.mui
│   ├── et-EE
│   │   └── bootmgr.exe.mui
│   ├── fi-FI
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── Fonts
│   │   ├── chs_boot.ttf
│   │   ├── cht_boot.ttf
│   │   ├── jpn_boot.ttf
│   │   ├── kor_boot.ttf
│   │   ├── malgun_boot.ttf
│   │   ├── malgunn_boot.ttf
│   │   ├── meiryo_boot.ttf
│   │   ├── meiryon_boot.ttf
│   │   ├── msjh_boot.ttf
│   │   ├── msjhn_boot.ttf
│   │   ├── msyh_boot.ttf
│   │   ├── msyhn_boot.ttf
│   │   ├── segmono_boot.ttf
│   │   ├── segoen_slboot.ttf
│   │   ├── segoe_slboot.ttf
│   │   └── wgl4_boot.ttf
│   ├── fr-CA
│   │   └── bootmgr.exe.mui
│   ├── fr-FR
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── hr-HR
│   │   └── bootmgr.exe.mui
│   ├── hu-HU
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── it-IT
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── ja-JP
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── ko-KR
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── lt-LT
│   │   └── bootmgr.exe.mui
│   ├── lv-LV
│   │   └── bootmgr.exe.mui
│   ├── memtest.exe
│   ├── nb-NO
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── nl-NL
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── pl-PL
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── pt-BR
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── pt-PT
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── qps-ploc
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── Resources
│   │   ├── bootres.dll
│   │   └── en-US
│   │       └── bootres.dll.mui
│   ├── ro-RO
│   │   └── bootmgr.exe.mui
│   ├── ru-RU
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── sk-SK
│   │   └── bootmgr.exe.mui
│   ├── sl-SI
│   │   └── bootmgr.exe.mui
│   ├── sr-Latn-RS
│   │   └── bootmgr.exe.mui
│   ├── sv-SE
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── tr-TR
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── uk-UA
│   │   └── bootmgr.exe.mui
│   ├── updaterevokesipolicy.p7b
│   ├── zh-CN
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   └── zh-TW
│       ├── bootmgr.exe.mui
│       └── memtest.exe.mui
├── bootmgr
├── BOOTNXT
├── BOOTSECT.BAK
├── MSOCache
│   └── {71230000-00E2-0000-1000-00000000}
│       └── Setup.dat
├── Recovery
│   ├── Logs
│   └── WindowsRE
│       ├── boot.sdi
│       ├── ReAgent.xml
│       └── Winre.wim
└── System Volume Information
    ├── IndexerVolumeGuid
    ├── tracking.log
    └── WPSettings.dat

I *guess* that this is where the 'broken' grub is at, since booting into this drive takes me to the mentioned grub in rescue mode. Also, no EFI directory, let alone a Windows directory here on sda1.
 
Last edited:
Back
Top