You are not logged in.

#1 2017-07-17 18:58:36

dramm
Member
Registered: 2017-07-17
Posts: 13

[SOLVED] Formatting EFI partition without reinstalling Arch

*CONTEXT START*

So I had Windows 10 installed in one SSD and I decided to install arch in another one. To do that I remove my Windows 10 SSD (disconnected cables) and cleared CMOS.

I was able to install Arch and a window manager and was in the process of customizing/installing programs etc. Everything was working fine, grub entry was showing in the UEFI.

I thought it would be better to worry about dual booting later,  however I needed to do some work in Windows 10, so I disconnected Arch SSD and cleared CMOS again (probably a mistake).

With Windows 10 SSD connected,  I started the computer, however Windows boot manager entry didn't show up in the UEFI. Anyway,  my SSD showed as a UEFI entry, so I choose it. I ran into some trouble booting Windows but eventually resolved then with Windows Recovery Environment. I was able to log in to windows, but I had to shutdown the PC to connect some other HDs I use for data. After that I wasn't able to get windows working again. I'm getting "BlInitializeLibrary failed 0xc00000bb" immediately after selecting Win10 UEFI entry. I'll probably have to fix things the Windows way (reinstall all the system). But to do that I need a working computer to download the installer.

So I figured I would go back to arch. (Cleared CMOS again)
When I started the computer again (with only Arch SDD connected) it didn't show the UEFI entry.

Why I cleared CMOS everytime? I misunderstood how EFI partition worked, I thought that at every start up the mobo would look for EFI partitions, so in my had it would all be OK as long as I kept connecting/disconnecting the drives.  Now what I've understood is that there is actually a NVRAM where those entries are stored (so there is no point to remove the drives AND clear CMOS)

*CONTEXT END*

What I need to do is "rebuild" my Arch's SSD  EFI partition so I can use the OS to download Windows installer (and fix that mess).

What I did was format the EFI partition again, mount /mnt and /mnt/boot and then reinstalling grub via arch-chroot. 

 mkfs.fat -F32 /dev/sda1
mount /dev/sda3 /mnt
mount /dec/sda1 /mnt/boot 
arch-chroot /mnt
pacman - S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub
grub-mkconfig -o /boot/grub/grub.cfg

When I reboot the grub entry was listed in the UEFI but Arch wasn't listed in grub. What am I missing?

Within grub I tried:

 
set root=hd1
chainloader +1 

But I get:
file '/boot/grub/x86_64-efi/chain.mod' not found

Also tried:

 set root=(hd1,1)
linux /boot/vmlinuz-linux root=/dev/sda5

But I get file '/boot/vmlinuz-linux' not found
Also, I'm not sure I'm in grub rescue

PS: I disabled Intel Rapid Start Technology (closest thing to fast boot that I found) and Boot Failure Guard (Closest thing to Secure Boot)

Reading the wiki and some other forums threads it seems that during the system install more goes to the /boot then just grub, however I start running commands until I understand how to "reset" only /boot and not the whole root directly to avoid losing my Arch installation (it took some hours to get Nvidia drivers and X to work properly)

Any thoughts on the subject are appreciated!
Thanks!

Hardware: Asrock extreme7 gen3 Z68 with i7 2600k

TL;DR
How to "rebuild" EFI partition without messing with already installed Arch?

Last edited by dramm (2017-07-17 20:29:17)

Offline

#2 2017-07-17 19:07:12

loqs
Member
Registered: 2014-03-06
Posts: 17,906

Re: [SOLVED] Formatting EFI partition without reinstalling Arch

Formatting /boot removed the kernel /boot/vmlinuz-linux also the initrds /boot/initramfs-linux.img and /boot/initramfs-linux-fallback.img.  Reinstall the linux package to restore them.
Edit:
Oh and welcome to the arch linux forums dramm.

Last edited by loqs (2017-07-17 19:07:54)

Offline

#3 2017-07-17 19:15:24

Blasphemist
Member
From: Colorado
Registered: 2013-01-17
Posts: 160

Re: [SOLVED] Formatting EFI partition without reinstalling Arch

I agree with logs. You did right except that you should have reinstalled the kernel and then the boot loader. When /boot is the mount point of the ESP, the kernel lives on the ESP in the /boot directory. In that case, if the ESP is wiped the kernel must be re-installed. You got a working boot loader but there was no kernel for it to find and offer as a boot option.


Simple and Open

Offline

#4 2017-07-17 19:15:26

dramm
Member
Registered: 2017-07-17
Posts: 13

Re: [SOLVED] Formatting EFI partition without reinstalling Arch

By reinstalling Linux package you mean running:

 pacstrap /mnt base base-devel 

If that's the case, won't I loose xorg/xinit configs, drivers, programs etc?

BTW: thanks! I've spent a lot of time time in the forums this past week, only created my account now though. big_smile

Offline

#5 2017-07-17 19:21:28

loqs
Member
Registered: 2014-03-06
Posts: 17,906

Re: [SOLVED] Formatting EFI partition without reinstalling Arch

No after you use arch-chroot just reinstall the linux package

pacman -S linux

Edit:
On a more general note running pacstrap twice should not remove any packages or overwrite any files that are marked as config files but it is intended to be used once on initial installation.

Last edited by loqs (2017-07-17 19:24:49)

Offline

#6 2017-07-17 19:58:13

dramm
Member
Registered: 2017-07-17
Posts: 13

Re: [SOLVED] Formatting EFI partition without reinstalling Arch

Arch is working again!!!

To add to the thread: I had to regenerate fstab file and edit it because the UUID for the EFI partition changed.

Thanks loqs and Blasphemist for helping! You guys fixed minutes what I had been trying to fix for 10h+
I'm in writing this using my Arch Install!!

Before marking as solved:

When I reinstall Windows 10( or do whatever I got to do to fix the "BlInitializeLibrary failed 0xc00000bb" problem), should I disconnect Arch's SSD again?
Also, should I reset CMOS? (to clear UEFI entries)?
I've read https://wiki.archlinux.org/index.php/Du … th_Windows but it only refers to installing Arch AFTER win10, not the contrary.

Thanks again!

Offline

#7 2017-07-17 20:26:50

loqs
Member
Registered: 2014-03-06
Posts: 17,906

Re: [SOLVED] Formatting EFI partition without reinstalling Arch

Generally having one ESP is simpler and the what firmware implementations have seen the most testing with.
You could disconnect the Arch SSD but assuming you have backups I see no reason to unless you want Windows to create a new ESP and install its loader on that ESP.
You can remove EFI entries with efibootmgr if you need to so you do not have to erase other firmware settings.
How you partition the system is really a matter of personal preference https://bbs.archlinux.org/viewtopic.php?id=130309

Offline

#8 2017-07-17 20:31:41

dramm
Member
Registered: 2017-07-17
Posts: 13

Re: [SOLVED] Formatting EFI partition without reinstalling Arch

I was just afraid that Windows tools would mess with the ESP (ignore the existence of an Arch install).
I didn't meant to bikeshed, sorry if it seemed so.

Thanks for the help again!

Marking as solved.

Offline

#9 2017-07-17 22:04:53

Blasphemist
Member
From: Colorado
Registered: 2013-01-17
Posts: 160

Re: [SOLVED] Formatting EFI partition without reinstalling Arch

I've seen it said that you can't have 2 EFI System Partition but I haven't tried to do that. Each boot entry in UEFI does point to a specific drive and specific partition separately but I think it might break the built in boot manager if you multiple ESP's. Many never use that menu though. Some implementations of UEFI may require the recommended ESP flag be set and may not allow one on each drive. That's speculation from my study though.

There isn't really any reason to need an ESP on each drive. Unlike with the old MBR, each OS installed doesn't need to overwrite any existing boot loader or manager. With MBR, each wrote to the same place on the disk. With UEFI, as long as the ESP doesn't get formatted there are few circumstances where anything is overwritten. It's sometimes helpful to really look around at the directories on the ESP to see that since it's just boot loaders and/or boot managers it the directories that they can be rebuilt pretty easy. As seen in this post the kernel package can be re-installed to put it back in place when needed.

I've never reset my UEFI NVRAM, CMOS, whatever you want to call it. Using efibootmgr I can delete and create any entries I need and change the boot order.


Simple and Open

Offline

Board footer

Powered by FluxBB