ROSA Linux Bugzilla – Bug 4996
[UPDATE REQUEST] efibootmgr-0.11.0-1
Last modified: 2015-02-06 18:21:40 MSK
efibootmgr was updated from upstream and patched.
Advisory: Updated to the latest upstream release. Also added support for extended/logical partitions on MBR.
How to test:
I. Create new boot entries
1. Attach a new hard disk where you don't have any valuable data.
2. Boot in EFI mode.
3. Check if your second disk is partitioned in GPT or MBR by running `parted -l' and checking the "Partition Table:" output line (for GPT it tells "gpt", and for MBR it tells "msdos").
3a. If disk is in GPT, repartition it using MBR (all data will be lost): run diskdrake, select the target disk, switch to the Expert mode, click "Clear all", and select MBR when partition table type is asked.
4. Using diskdrake, gparted or any other partitioning tool, create several primary and logical partitions, all of them of EFI type, size 32 Mb or larger. Format them.
5. Copy the contents of your /boot/efi into each of these partitions. The minimal required list of files is: grubx64.efi, grub.cfg, BOOTx64.efi (the last one is required for Secure Boot).
for i in 1 2 5 6...; do efibootmgr -c -L test-$i -l /EFI/rosa/grubx64.efi -d /dev/sdX -p $i; done
where /dev/sdX is your test hard disk, and "1 2 5 6..." is the full listing of the created partition numbers. This script will create several EFI boot entries named test-1, test-2, etc. for each partition you are testing.
P.S. If Secure Boot is turned on, you need to either turn it off, or use BOOTx64.efi file instead of grubx64.efi.
II. Check the new entries contents
7. Run `efibootmgr -v' to display full listing of all entries.
8. The entries should look like this:
>Boot0004* test-1 HD(1,800,8000,000347f5)File(\EFI\rosa\grubx64.efi)
>Boot0005* test-2 HD(2,8800,8000,000347f5)File(\EFI\rosa\grubx64.efi)
>Boot0006* test-5 HD(5,11000,18000,000347f5)File(\EFI\rosa\grubx64.efi)
The HD(...) part contains the following values in HEX format:
a) partition number;
b) partition starting sector;
c) partition length;
d) hard disk identifier.
The disk identifier can be checked by running `fdisk -l /dev/sdX' in the output line "Disk identifier:"; partition starting sector and size can be checked by running `parted /dev/sdb unit s print' and then translating values into HEX using any calculator.
># parted /dev/sdb unit s print
>Number Start End Size Type File system Flags
> 5 69632s 167935s 98304s logical ext2
># fdisk -l /dev/sdb
>Disk identifier: 0x169fd780
69632 is 11000 in HEX; 98304 is 18000. Therefore the corresponding boot entry for /dev/sdb5 should look like:
>BootXXXX* test-5 HD(5,11000,18000,169fd780)File(\EFI\rosa\grubx64.efi)
III. Check the new entries to work
This test may not succeed, because it depends on the UEFI implementation, whether it supports booting from MBR. If it does not, there is nothing efibootmgr can do. Still, worth trying.
9. Reboot, press the hotkey for selecting boot entry.
10. Select "test-1" and try to boot it. You should see the usual Grub2 boot menu and be able to boot your system. When you copied the /boot/efi contents, there was a small grub.cfg file which contains redirection to your main Grub2 menu.
11. Repeat step 10 for each new test entry.
IV. Cleaning up
12. After all test are completed, you can remove the test boot entries by running
for i in 0005 0006 0007...; do efibootmgr -B -b $i; done
where "0005 0006 0007..." is the list of boot entry identifiers you wish to delete (the ones that are listed in `efibootmgr -v' as "Boot0005", "Boot0006", etc.)
************************ Advisory **********************
Updated to the latest upstream release. Also added support for extended/logical partitions on MBR.