Friday 27 March 2015

UEFI-booting Ubuntu\Xubuntu\Voyager with persistence

As a follow-on from my previous blog post, I thought you might like to see how to boot Voyager from a .imgPTN partition image AND have a persistence file too.



1. Drag-and-drop the Ubuntu\Xubuntu\Voyager ISO onto the MPI_FAT32 Windows Desktop shortcut to make a .imgPTN file in the normal way - e.g. Voyager-14.04.04-amd64.imgPTN. For details see here.

2. Use the RMPrepUSB - Create ext2/3/4 FS button to create a file called voyager in the root of the E2B USB drive. The specified Volume name should be casper-rw and the size can be whatever you like - e.g. 500MB. Tip: Try ext3 for less risk of file corruption.

3. Place\move both files into an E2B menu folder (2nd level deep) and rename them. For instance, if you want it to be listed in the Linux Menu, then use:

\_ISO\LINUX\Voyager-14_04_04_amd64.imgPTN    (1GB converted from ISO file)
\_ISO\LINUX\Voyager-14_04_04-amd64                   (500MB ext2 file)

You should change the name of both files to remove any dots from the filename - the ext2 filename must not have any file extension and so must not contain any dots at all.
Note that the file names should not contain dots - otherwise both files will be listed in the E2B Linux Menu. That is why I changed the dots in Voyager-14.04.04-amd64 into underscores in the example above. The file names MUST be identical.
You can also use a .txt file to make a nicer menu entry if you wish.

4. Now MBR-boot to E2B (you can use QEMU or VBox or a real system) and choose the Voyager-14_04_04_amd64.imgPTN menu entry and switch partitions. You should now see the CSM Menu. Now Quit E2B (F10).

5. Now we need to edit the menus on the E2B USB drive (in it's CSM state) so that the keyword 'persistent' is added into both the UEFI menu and the MBR\CSM menu.

Edit the \boot\grub\grub.cfg file to add the word 'persistent' into the Live menu linux line (you can also change the menuentry title too, if you wish as it says Xubuntu instead of Voyager):

menuentry "Try Xubuntu without installing (Persistent)" {
set gfxpayload=keep
linux /casper/vmlinuz.efi persistent file=/cdrom/preseed/xubuntu.seed boot=casper quiet splash --
initrd /casper/initrd.lz

For normal MBR booting from the CSM menu with persistence, add the following 3 lines to the bottom of the \menu.lst file:

title Voyager\n Boot to Voyager with persistence
kernel /casper/vmlinuz.efi  boot=casper persistent noeject noprompt quiet splash --
initrd /casper/initrd.lz 

Note that the extra parameter file=/cdrom/preseed/xubuntu.seed does not seem to be required in this menu although it does work if you also add it in. If your version of Ubuntu is slightly different, use the same parameters as used in the grub.cfg file, but just add the 'persistent' keyword to the kernel line. Note that grub.cfg uses 'linux' but grub4dos's \menu.lst syntax uses 'kernel'.

That's it - Fini!
The extra menu has been added to the bottom of the CSM menu.

Now you should be able to boot from the CSM Menu (choose the last menu entry if you want persistence), or via Clover or directly via your system's UEFI firmware.

The modified UEFI boot menu

How it works

E2B will automatically detect any file in the same folder that has the same file name as any .imgPTN file that you run (e.g. .imgPTN, .imgPTN23, .imgPTNaLBA23, .imgPTNAUTO, etc.) but that has no file extension. It will add a new partition #3 entry for this file (in our case Voyager-14_04_04_amd64) at the same time that it replaces the E2B partitions with the .imgPTN file for partition #1 - see below...

Partition 1   SIZE=1003.266MiB   Type: 0C FAT32LBA (2047GB max)  *ACTIVE*
START POS   = CYL:1023 HD:254 SEC:63       END POS = CYL:1023 HD:254 SEC:63
START (LBA) = 583,229,111 (22C35EB7) SIZE (LBA) = 2,054,688 (001F5A20) [End=585,283,798]

Partition 2   SIZE=0MiB   Type: 00        
START POS   = CYL:0 HD:0 SEC:0       END POS = CYL:0 HD:0 SEC:0
START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)

Partition 3   SIZE=476.84MiB   Type: 00        
START POS   = CYL:1023 HD:174 SEC:44       END POS = CYL:1023 HD:120 SEC:48
START (LBA) = 152,467,855 (0916798F) SIZE (LBA) = 976,568 (000EE6B8) [End=153,444,422]

Partition 4   SIZE=0MiB   Type: 00        
START POS   = CYL:0 HD:0 SEC:0       END POS = CYL:0 HD:0 SEC:0
START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)

When Ubuntu boots, it will mount each partition. Even though the #3 partition has a Type of 0 and not 83 (for an ext2 partition), linux will still mount it nicely for us as a volume with the volume label of 'casper-rw' and the 'persistent' parameter, tells Ubuntu to use it for persistent storage.

When you restore the E2B menu, both partitions disappear and they will be replaced by the original E2B partition table.


No comments:

Post a Comment