Thursday, 1 December 2016

Add a Manjaro Live install image to E2B

The manjaro live cd ISO does not seem to support a live persistence volume (AFAIK).

However, we can add a full manjaro image (MBR boot only) to E2B so that we can boot to a fully installed OS which will be updatable and persistent just like a normal installation.

Here are the steps to add a full linux OS to an Easy2Boot USB drive.
We will create an empty partition file (manjaro) and then use Virtual Box + DavidB's VMUB to install to that partition file. We will then boot from a .imgPTN file and via grub4dos, boot to the linux partition.

Use the latest MPI Tool Pack (v.0.054 2015-08-21 or later). This includes CSM menu support for grub2/syslinux installations on the 3rd partition.

I used manjaro-xfce-16.10.2-stable-x86_64.iso for the procedure below.

Brief Instructions (not for beginners!)

Important Note: Before you begin, save the MBR sector of your E2B USB drive in case anything goes wrong. Use RMPrepUSB - Drive>File - name=E2BMBR.BIN, start=0, size=32SEC, filestart=0. Save the file to your Windows hard drive for safe keeping. If you find that you cannot return back to the E2B menu, restore the original MBR using RMPrepUSB - File>Drive.
Warning: You should be familiar with VBox+VMUB and linux installs and MakePartImage before you attempt this!

If you have an old version of the MPI Tool Kit, please update it now or it may not work!

I used a Windows10 64-bit host system for this procedure, with a SSD USB 3.0  USB  drive as my E2B USB drive.

manjaro-xfce-16.10.2-stable-x86_64.iso should be on your Windows hard disk somewhere (not on the E2B drive)

1. Create an empty folder on the Windows Desktop ( I named the folder EMPTY because I was watching Spok on Star Trek at the time and it seemed logical!) and then drag-and-drop the empty folder onto the MPI_FAT32 Desktop shortcut. Do this twice to make two files of two different sizes:

manjaro.imgPTN  (38MB - accept default size)
manjaro                 (set size as required for full manjaro installation - e.g. 15000 for 15GB)

Now copy the two files to your E2B USB drive. You now should have:
\_ISO\LINUX\manjaro.imgPTN   (38MB)
\_ISO\LINUX\manjaro                 (15GB) - or any size you like!

Boot to E2B and select the manjaro.imgPTN file from the Linux E2B sub-menu. 

WARNING: Do NOT use \_ISO\SWITCH_E2B.exe to switch in the new partitions at this point, because you may get filesystem boot errors later. You can use the E2B menu or SWITCH_E2B after you have installed manjaro, but not now, when the partition is about to be formatted.

You will need to make the drive contiguous first.

2. Create a new linux diskless VM in VBox.
No virtual hard disk should be present in the VM.

3. In VBox Manager - Settings, add a virtual CD as Primary Slave IDE using the ISO file as the content of the virtual CD to the new VM that you created. Ensure that the CD-ROM is first in the boot order.

The first slot for Primary Master IDE should be empty - it will
be automatically populated by VMUB when you run it.

4. Run VMUB (see VBox+VMUB) (using the VMUB utility and run it as Administrator) and allow the VM to boot from the ISO which should be on your Windows drive somewhere (not the USB drive). Do not boot directly using the VBox Manager, you must use VMUB to run VBox.

Set up an entry for the new VM in VMUB and click Start.

5. You should see the LiveCD boot menu because VBox should boot from the ISO...

  • Select Start Manjaro Linux

6. Now we need to do a custom install of manjaro onto \dev\sda3 (the empty partition on our E2B USB drive). Proceed to install manjaro as follows...
  • Run the Install Manajro Linux (Calamares)  Desktop icon
  • Select Country, TimeZone, Keyboard
  • Select Manual Partition  (I had an 8GB for my manjaro file in this example)
  • double-click on the sda3 partition in the table (it should be many GB in size)...

Make sure the boot loader installs to / and NOT /dev/sda !!!
Note: You must NOT change any of the partition positions or create new partitions or change \dev\sda1!  If you do, you will totally destroy the contents of your E2B drive!

You should only format \dev\sda3 and no other partition or portion of the USB drive.

Now enter your credentials as desired and finally confirm...

Ensure you have everything set as /dev/sda3 and that the boot loader will be installed to /.

The installation will then proceed (it seems to take quite a while at the 19-21% point but it will eventually finish!).

7. Shutdown manjaro.

You should now be able to use the grub4dos CSM menu.
  • Boot to Partition 2

If it seems to boot to grub-rescue and not the CSM menu, then you did not install the boot loader to / - to fix this, run RMPrepUSB - File>Drive and use the E2BMBR.BIN file you made earlier to write to LBA 0 on the drive.
(what? you didn't bother to make that file? Well you can try re-installing grub4dos to the MBR using RMPrepUSB, but you will also have to copy LBA0 to LBA30 as well to make Switch_E2B like the drive!).
If you wish, you can remove the menu entries #1 and #2 by editing the \menu.lst file, edit the menu to say 'Boot to Manjaro' and edit the menu heading, etc. You can change the file extension to .imgPTNAUTO to avoid the partition switch prompt and set the default and timeout value in the \menu.lst file so that it boots straight into manjaro from the E2B menu.

You can install many different linux distros using this technique, as long as they only need a single partition to install to (i.e. no separate boot or swap partition is needed).

You can simply copy the two files to any other E2B USB drive if you wish.

Please tick the Reactions box if you found this useful.