Moving/Copying EFI partition to end of disk

So running os-prober does find the 2 OS partitions, but it is not finding the EFI partitions. So when I try to grub-install, the error “cannot find EFI direcotry” is shown.

I will need to dig further into why EFI, mounted or not, is not being found.

Sheila

2 Likes

os-prober will not detect EFI partition, because it does not contain a bootable Linux. It is not supposed to find it.

You need to tell it

  • mount the EFI partition on /boot/efi
    (it may do this in fstab … if not do it manually)
  • grub-install --efi-directory=/boot/efi
1 Like

Sorry, just got back in town. I took a look at the 2 MX EFIs (the label I attached in gparted) one is from the ext SSD with MX only that I had running till today. The other is the one that should have copied to the internal drive along with the MX partition. There is nothing in the MX EFI folders of either one.

The only EFI that shows the two folders /boot and /Garuda is the EFi SYSTEM2 (which is the EFI from Garuda).

So mounting EFI to /boot/efi does nothing right now and rightly so. I am going to have to go back to GP and check the flags and CZ if I need to restore that single EFI partition where Garuda appears in the MX Grub Menu.

Strange though that running the live MX session and using Boot Rescue to scan for GRUB menus, it found this very MX menu with Garuda as an option and I chose MX to get me into the session I am in now.

Will update once I see if I can figure out why there is nothing in EFI.

Sheila

2 Likes

Okay. Now that I checked, I was not in my nvme0n1p1/p2 MX Linux session. I was and am still in the ext SSD session.

Gparted showed the boot,esp flags on the Garuda EFI, but not on the MX EFI. So I changed that. It also showed 1.4 MiB used on both EFIs, where as when I mounted one and looked via Thunar, it showed 4.0 KiB used. So I guess using the file manager is not a reliable way to confirm data on the disk.

But now I guess I will have to chroot to do the changes as when I used MX live session> Boot Rescue>Grub Menus it found:

(hd0,2) which is Ventoy (live USB)
(hd2,1) which is rootMX23 on the internal drive
(hd3,2) which is rootMX23 on the ext SSD

When I selected hd2,1, Grub Menu appeared correctly, but attempting to boot to MX it said to load the kernel first. Then it automatically timed out and booted to the ext SSD install.

Let me use chroot and see now that the flags are fixed that I can mount the correct EFI.

Sheila

2 Likes

It may help if you disconnected a few disks.

1 Like

:laughing:I know, right? switching from /dev/sda1 to HD3,2 is confusing to say the least.

I will get this done!

Sheila

2 Likes

Now I need help in writing the fstab.

Mounted my NVME p2 (which has MX root) and did all the mounts/binds and used cat /etc/fstab

Nothing in the file. Is that supposed to happen? I figured copying the old install would have that old fstab already written and I could make UUID changes, etc. But maybe my running update-grub emptied it??

So here is my proposed fstab:

<file system> <mount point> <type> <options> <dump> <pass>
UUID=2779c5bc-45ad-4909-bd7c-de1dcd54dafd       /       ext4    errors=remount-ro       0      >
UUID=EAB1-0437  /boot/efi       vfat    umask=0077      0       1

Questions:
Do I need to add the ext drives in fstab or will they be found once I boot and entries added automatically to fstab?

I have the ext HDD Linux partition where CZ images are saved and will need that for read/write.

I also have that ext SSD which I have been afraid to remove yet until I get the internal SSD booting.

What about swap? My LM has that in fstab but I don’t think I made one for either MX or Garuda, as it is not showing up in lsblk.

Once I save fstab, it is my understanding that I now have to “mount” efi to /boot/efi before I update-grub? or grub-install?

And after all the above is done, I should reboot and find Linux in my BIOS entries, right?

Sheila

1 Like

That looks fine.

They will not add automatically to fstab
I would only put them in fstab if they are always present.
Try without them first… you can add them later

I always make a swap partition.
You can start without it or add it later or use a swapfile instead.
MX and Garuda can share a swap partition… you dont need two.

Right. Grub-install first, then update-grub.

Right. Fingers crossed.

1 Like

This is tricky for me being root from live session into my MX OS. I have mounted both
p1 EFI
p2 root
I have done binds on /dev /sys /proc (wasn’t sure if /run was needed)
I have been at both prompts and tried: mount /dev/nvme0n1p1 /boot/efi
It mounts.
Then grub-install --efi-directory=/boot/efi
Returns error "failed to get canonical path of /boot/efi.

So what am I doing wrong?

Thanks,
Sheila

1 Like

I must be asleep…LOL. Would you believe in all of the steps I took in live session terminal…I FORGOT to chroot!!! I have done them so many times…and yet…

Now it worked. Rebooted, but no new entry in BIOS.

Booted back in live session>Boot Rescue/Grub-EFI Bootloader:
boot @[fat] HD0,2 (Ventoy)
rootMX23 @[ext_] HD2,1 /boot/grub/x86_64-efi/grub.efi (ext SSD MX)
mx @[fat] HD3,1/EFI/mx/grubx64.efi (internal SSD MX EFI)
rootMX23 @[ext_] HD3,2 /boot/grub/x86_64-efi/grub.efi (internal SSD MX)
the rest are Garuda entries on internal SSD.

I selected the 3rd and using Disk Manager, saw EFI on internal SSD was mounted, but not MX root.

Selected 4th and using Disk Manager, saw the same. I thought the checkmarks show mounted partitions. No matter which I choose, the MX internal root is not shown mounted. Is that normal? How do I know if I am in my internal MX now?

Rebooted again to try and boot Garuda…did not work. Maybe I chose the wrong Grub menu w/Garuda (the ext SSD has that grub menu but no Garuda on it).

Reboot again. Next Grub menu–the same.

Wonder if I need to do the symlinks again & copy the Garuda folders from its EFI to MX EFI? Will check them.

Now I remove ext SSD as it is getting tiring having to figure out WHICH one is which. Reboot.

Use Garuda Grub Menu, but it does not boot, of course, as I have not been in it to fix fstab, etc.

Now MX Linux on internal drive boots from its own GRUB menu.

But I still need to figure out how to get this drive showing up in BIOS.

Sheila

1 Like

So after removing Ventoy and ext SSD and rebooting, of course, I cannot boot into MX.
error: no such partition.
Entering rescue mode…
grub rescue>

Is there anything I can do from here to fix BIOS?

For now I can boot from the live USB MX Grub Menu>Boot Rescue, but that is getting old.

Any help now, much appreciated. We are almost there!

Sheila

1 Like

That message means the EFI partition is not mounted.
If the partition is sda1

mount /dev/sda1 /boot/efi

Check it is mounted with df
then

grub-install --efi-directory=/boot/efi

You can mount it anyehere, but you may as well mount it in the conventional place.

Keep on trying, you are so close.

1 Like

So you are saying it was not mounted when I got that message. But later I said that the whole issue must have been

I kept performing the commands that are to be done after chroot.

Once I went back and did all of the steps again (just in case) then “chroot” it installed and completed without errors, it said. I didn’t think it would have completed if it was not mounted.

Thanks,
Sheila

1 Like

Congratulations.
We now have 2 people successfully running dual boot systems with btrfs.

Forgetting where you are is one of the worst traps.
I have twice recently edited files on the wrong root filesystem and made a real mess.

2 Likes

Yes, but I still have nothing showing up in BIOS. I have been reading on an MX forum where someone used some Ubuntu tool and Gparted to copy the older drive to a new one and need to re-create EFI/boot partition, but not sure any of this helps me.

https://forum.mxlinux.org/viewtopic.php?t=82086&hilit=grub2&start=10

But I went ahead and did some of the commands given there in case any of it helps with my issue:

myviolinsings@mx--acer:~
$ dpkg -l | grep grub
ii  grub-common                                   2.06-13+deb12u1                        amd64        GRand Unified Bootloader (common files)
ii  grub-efi-amd64-bin                            2.06-13+deb12u1                        amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 modules)
ii  grub-efi-ia32-bin                             2.06-13+deb12u1                        amd64        GRand Unified Bootloader, version 2 (EFI-IA32 modules)
ii  grub-files-mx                                 23.05.05                               all          modified grub files for mx and antiX linux
ii  grub-pc                                       2.06-13+deb12u1                        amd64        GRand Unified Bootloader, version 2 (PC/BIOS version)
ii  grub-pc-bin                                   2.06-13+deb12u1                        amd64        GRand Unified Bootloader, version 2 (PC/BIOS modules)
ii  grub-themes-mx                                19.08.03                               all          misc grub themes for mx linux
ii  grub2-common                                  2.06-13+deb12u1                        amd64        GRand Unified Bootloader (common files for version 2)
myviolinsings@mx--acer:~
$ ls -aln /etc/grub.d
total 104
drwxr-xr-x   2 0 0  4096 Jul  5 18:04 .
drwxr-xr-x 170 0 0 12288 Nov  4 06:48 ..
-rwxr-xr-x   1 0 0 10046 May  9  2023 00_header
-rwxr-xr-x   1 0 0  6258 May  9  2023 05_debian_theme
-rwxr-xr-x   1 0 0 13658 May  9  2023 10_linux
-rwxr-xr-x   1 0 0 12894 May  9  2023 20_linux_xen
-rwxr-xr-x   1 0 0  1444 May  9  2023 20_memtest86+
-rwxr-xr-x   1 0 0 12335 May  9  2023 30_os-prober
-rwxr-xr-x   1 0 0  1594 May  9  2023 30_uefi-firmware
-rwxr-xr-x   1 0 0   214 May  9  2023 40_custom
-rwxr-xr-x   1 0 0   216 May  9  2023 41_custom
-rw-r--r--   1 0 0   483 May  9  2023 README

myviolinsings@mx--acer:~
$ lsblk --fs -o +PARTUUID
NAME FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS PARTUUID
sda                                                                                     
├─sda1
│    exfat  1.0   Ventoy
│                       8A96-7223                                                       fc52a621-01
└─sda2
     vfat   FAT16 VTOYEFI
                        3F32-27F5                                                       fc52a621-02
sdb                                                                                     
├─sdb1
│    ntfs         easystore
│                       4C4E29694E294CD0                                                9ff48cd8-684b-44a2-b378-170afbb650c5
└─sdb2
     ext4   1.0   Linux Acer ES
                        1084e7b1-a909-4e58-9600-d3087c81956d    1.5T    48% /run/timeshift/2463/backup
                                                                                        b9d229ba-46af-4221-a340-64f8dc8951ad
nvme0n1
                                                                                        
├─nvme0n1p1
│    vfat   FAT32 MX EFI
│                       EAB1-0437                                                       f637a525-4b4d-4d41-8629-442ab14a1385
├─nvme0n1p2
│    ext4   1.0   rootMX23
│                       2779c5bc-45ad-4909-bd7c-de1dcd54dafd  343.9G    41% /           97920760-0e8d-46ff-b320-e43a17972466
├─nvme0n1p3
│    vfat   FAT32 EFI-SYSTEM2
│                       E857-3ED4                             510.4M     0% /media/EFI_SYSTEM2
│                                                                                       7a2ef150-919b-4cd5-8928-4d9f0c7d1f00
└─nvme0n1p5
     btrfs              406d8c92-eb3f-4642-8532-fe14c97261cd    146G    47% /media/myviolinsings/406d8c92-eb3f-4642-8532-fe14c97261cd
                                                                                        a7ac825b-dfc3-4d58-bae9-a7fbb8ee2a07

myviolinsings@mx--acer:~
$ efibootmgr -v
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 2001,0000,2002,2003
Boot0000* HDD: Samsung SSD 970 EVO Plus 1TB	PciRoot(0x0)/Pci(0xe,0x0)/NVMe(0x1,00-25-38-55-31-91-CD-CB)/HD(3,GPT,7a2ef150-919b-4cd5-8928-4d9f0c7d1f00,0x74606800,0x100000)RC
Boot0001* USB HDD: USB	UsbWwid(781,55a9,0,0401ff142492a5b7cec6ee2c54aad572d6674ed1578b5235a734700dbd21e7abcf10000000000000000000008a196c8cff1c0d18a9558107632ed85)/HD(2,MBR,0xfc52a621,0x1d1e0000,0x10000)RC
Boot2001* EFI USB Device	RC
Boot2002* EFI DVD/CDROM	RC
Boot2003* EFI Network	RC

myviolinsings@mx--acer:~
$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

#Entry for /dev/sda1 :
UUID=2779c5bc-45ad-4909-bd7c-de1dcd54dafd	/	ext4	discard,noatime	1	1
#Entry for /dev/nvme0n1p3 :
UUID=E857-3ED4	/media/EFI_SYSTEM2	vfat	defaults,uid=1000,gid=100,dmask=0002,fmask=0113,utf8,x-gvfs-show	0	2
#Entry for /dev/nvme0n1p5 :
UUID=406d8c92-eb3f-4642-8532-fe14c97261cd	/media/myviolinsings/406d8c92-eb3f-4642-8532-fe14c97261cd	btrfs	defaults,nosuid,nodev,relatime,ssd,discard=async,space_cache=v2,subvolid=5,subvol=/	0	2
/swap/swap	swap	swap	defaults	0	0

I am in my MX session from my internal drive, but the only way I can get there is via live MX session in Boot Rescue by scanning for grub menus and choosing the right one and then it boots to it.

Thanks,
Sheila

1 Like

Do that with LFS and you will overwrite everything in root, not good!!!

1 Like

There is also on github an “MX Boot Repair” here. But not sure if it will help.

A lot of older MX forum posts show the MX Live Session Boot Rescue having menus that dealt with rebuilding grub, etc., but mine does not have that.

Sheila

1 Like

I was in a live session. So if I understand correctly, nothing I did prior to “chroot” other than mounting partitions, changed a thing as I could not overwrite the live session files.

Sheila

1 Like

@Sheila_Flanagan
So the best time to move the efi partition is when it is first created!!!

1 Like

After doing grub-install --efi-directory=/boot/efi in MX
did you do update-grub?

1 Like