Why do I lose my EFI partition when I remove a drive?

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

Why do I lose my EFI partition when I remove a drive?

Postby DiBosco » Dec 11th, '21, 14:36

I've had a lot of very time consuming problems in the last nine months or so that started with me not being able to boot, that was eventually tracked down to nvidia problems. Before that, I thought it was a hard drive issue. One of things I'd tried was putting an old spinning platter drive in and mounting the original M1 drive's home directory copying all the data to the spinning platter drive. The idea was that I'd put a new M2 drive in and copy everyhting back from the spinning platter driv to the new M2 drive. Problem is once I removed the original M2 drive, I lost the EFI partition on the spining platter drive. So in the end i used a live CD, copied all the data from the home partition of the M2 drive to an external USB drive, then installed on the new M2 drive and got going again.

Then this Monday I powered up my desktop and I couldn't boot. This time it looked like the M2 drive had been corrupted, fsck seemed to be showing there was an issue so i reformatted the disk and got going, but it went screwy again so I thought there must be a problem with the M2 drive. So, I bought a SATA drive instead, installed mageia on that then removed the M2 drive once I'd copied the appropriate and important data from the home directory to the new SATA installation.

However, once I took the M2 drive out, the same thing happened as with my previous M2 drive: it just claimed I'd lost the EFI. If I look with the Mageia installer it is telling me my EFI directory is there, but grub refuses to accept it, won't rescue it using the rescue utility.

efibootmgr showed a whole host of entries including one for kubuntu that I'd tried in desperation at some point. So i deleted all the extraneous ones, leaving only my entry, but still grub is not having it.

I've cut my losses copied everythign to a spinning platter drive and using that for home with a SATA SSD as /boot, / etc.

So my question is, does anyone know what is going on with this palava? Am I doing installs wrong? I never used to have problems putting drives in and out previously, so is this an EFI thing. Can/should I install without EFI? The machine will only ever run Linux.

I suspect there's something I fundamentally don't understand about EFI.
DiBosco
 
Posts: 323
Joined: Aug 31st, '11, 10:22

Re: Why do I lose my EFI partition when I remove a drive?

Postby doktor5000 » Dec 11th, '21, 15:42

As you don't provide any ouput of lsblk or similar to show the partitioning and bootloader configuration and such and the actual contents of your /boot/EFI folder, how should we guess what's wrong?
UEFI is not that difficult. Instead of installing the bootloader into the MBR of the disk or partition, you put it inside a FAT filesystem which is usually mounted as /boot/EFI which contains the UEFI-compatible binary for the bootloader.
This gets scanned/loaded by UEFI, which then in turn loads your actual bootloader configuration and entries.

So either your /boot/EFI filesystem or mount was messed up, or the contents, or your bootloader configuration. As you don't provide any examples, it's impossible to say which it is.

----

Totally apart from that, if you want to move from one disk to the other, and already had time-consuming issues over several months, why not simply do a fresh installation from scratch to one of the M2 drives?
By copying from one drive to the other, depending on how you're doing it in particular (again, no details on that) you might be copying over your issues. Or if you only copied filesystem contents,
but did not adjust the installation on the new disk to the UUID of the new filesystems, then that would be pretty obvious why it can't find the EFI partition if you remove the old disk where it's located on.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17659
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Why do I lose my EFI partition when I remove a drive?

Postby DiBosco » Dec 11th, '21, 19:22

Apologies, I didn't know what would be relevant information.

This is lsblk, the partitions are set up identiaclly to the borked install.

Code: Select all
├─nvme0n1p1 259:1    0   299M  0 part /boot/EFI
├─nvme0n1p2 259:2    0  1000M  0 part /boot
├─nvme0n1p3 259:3    0  46.9G  0 part /
├─nvme0n1p4 259:4    0   3.9G  0 part [SWAP]
├─nvme0n1p5 259:5    0   7.8G  0 part /var
├─nvme0n1p6 259:6    0  27.3G  0 part /opt
└─nvme0n1p7 259:7    0   807G  0 part /home


However, I think weird thing is that the when I go into the Mageia installer on a borked install there is clearly an EFI partition there listed in the hard disk partitioner, but grub says there isn't. Also if I just try an upgrade in the installer it tells me there must be a /boot/EFI partition.

Why is it that that simply taking a disk out that used to have an install on it, but is independent of the current install borks the system. If the installer sees that partition there, what is happening when I unplug a drive that causes grub to say "Nah, there's no EFI partition any more?"

I do understand the it is mounted /boot/EFI on a FAT partition. That's not the potentially important thing I am missing about it all.
DiBosco
 
Posts: 323
Joined: Aug 31st, '11, 10:22

Re: Why do I lose my EFI partition when I remove a drive?

Postby doktor5000 » Dec 12th, '21, 00:12

Well your lsblk output neither shows the partition UUIDs and neither grub configuration nor the UEFI entries for comparison.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17659
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Why do I lose my EFI partition when I remove a drive?

Postby papoteur » Dec 13th, '21, 12:57

Hello,
The result of
Code: Select all
blkid

can be useful
papoteur
 
Posts: 93
Joined: Oct 27th, '11, 22:28

Re: Why do I lose my EFI partition when I remove a drive?

Postby DiBosco » Dec 17th, '21, 20:21

Sorry for the delay, I didn't get notification of replies.
Code: Select all
blkid
/dev/nvme0n1p1: UUID="253C-C27E" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="935796f1-9885-4907-b128-378894e9d5dc"
/dev/nvme0n1p2: UUID="55a476bb-1c99-4050-be90-4986a3888328" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="ca1ef954-6840-4dfc-bf17-aca51b956040"
/dev/nvme0n1p3: UUID="d1380eb4-646a-465d-b41d-bbc194bc1f7c" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="c7fb43be-e129-4866-8e70-3c81653fff96"
/dev/nvme0n1p4: UUID="37736776-78d2-43fb-a922-2bdfdf9df560" TYPE="swap" PARTUUID="35ecb091-5852-4545-9038-b879170177a4"
/dev/nvme0n1p5: UUID="73a64875-6d21-4074-a63e-b4b435b93e17" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="5960a94d-dbe8-466c-8692-da4fdd98079d"
/dev/nvme0n1p6: UUID="fc43e937-7774-455e-94b2-25028e03b7cc" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="c61effba-9169-4af6-874c-5c4505537dc5"
/dev/nvme0n1p7: UUID="738618bf-a688-4b25-acfe-b0dc456af391" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="02b14438-76e9-45d1-ab14-d20a9cc69ca0"
/dev/sda1: UUID="ed65a32c-6a73-4708-a1b2-751c29f9966a" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="00685d6b-01"


I suspect that's not at all useful though because currently after much copying the system is up and running again.

I guess what I need is to be able to do that on the M2 drive I took out that stopped booting and do the same. *However*, the point remains that it was clear every time this happened the VFAT partition was still on there.

doktor5000 wrote:Well your lsblk output neither shows the partition UUIDs and neither grub configuration nor the UEFI entries for comparison.


Now, this might be more interesting I guess if this happens again in that I guess you're saying I should run blkid and efibootmgr and check that they match. However, and I still think it's a big however, why was the Mageia installer telling me there's no VFAT EFI partition when there was? The installer itself clearly showed there in the partition part of the installer that the VFAT partition was there.

Once I get a new motherboard (that's a whole other can of worms) with multiple M2 slots on I'll read the relevant info and post the efibootmgr's output as well.
DiBosco
 
Posts: 323
Joined: Aug 31st, '11, 10:22

Re: Why do I lose my EFI partition when I remove a drive?

Postby papoteur » Dec 18th, '21, 09:03

And what is the result of
gdisk -l /dev/nvme0n1

In my case, I have:
Code: Select all
Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          534527   260.0 MiB   EF00  EFI system partition
papoteur
 
Posts: 93
Joined: Oct 27th, '11, 22:28


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest

cron