104 - Boot pclinux from ISO with persistence

web statistics
The following instructions show you how to add the pclinux ISO to a grub4dos multiboot USB drive and boot pclinux directly from the ISO with persistence!

pclinuxos does not fully support running from an NTFS USB drive, however some of the entries below allow you to add pclinuxos to a grub4dos multiboot NTFS USB drive.
If you have a FAT32 USB grub4dos boot drive, then use the menu in Alternative 2.

Introduction

KDE4 FullMonty is a large 3.8GB LiveCD ISO. The ISO file can be directly booted from a bootable USB drive by using grub4dos.

For persistence, pclinux requires an ext2/3 partition, pclinux will then automatically create a changes folder on that ext2/3 partition. The partition to use can be specified in 3 different ways:

changes_dev=LABEL=LiveOS
changes_dev=UUID=xxx-yyyy-xxxxx
changes_dev=/dev/sdb1

This tutorial will show you how to create an ext2 filesystem as an empty file on a FAT32 or NTFS USB drive, and then map that file to an empty partition table entry on your USB drive. pclinux will then see that partition as a valid ext2/3 partition and use it for persistent changes.

A similar technique can also be done with the ISO file as well.

There are several ways to arrange the files on your USB drive:

 Two Part Method FAT32 or NTFS from ISO Persistent 2 spare ptns required
 Alternative 1 FAT32 or NTFS from ISO Not Persistent 1 spare ptn required
  Alternative 2 FAT32 from ISO Persistent 1 spare ptn required
  Alternative 3 FAT32 Flat File Not Persistent No spare ptn required

Two Partition Method    - works with FAT32 and NTFS USB drives  - uses ISO file                  - Persistent       - requires two spare partition table entries on the USB drive
Alternative 1           - works with FAT32 and NTFS USB drives  - uses ISO file                  - Not Persistent   - requires one spare partition table entry on the USB drive
Alternative 2           - works with FAT32 only                 - uses ISO file                  - Persistent       - requires one spare partition table entry on the USB drive
Alternative 3           - works with FAT32 only                 - flat file (extracted from ISO) - Not Persistent   - no spare partition table entry required

Pre-requisites

Before you begin, you will need:
  • RMPrepUSB (always use the latest version)
  • An 8GB or larger USB drive formatted as FAT32 or NTFS.
  • grldr - the latest version of grub4dos (2012) is required (this is included in RMPrepUSB or you can download it from here - use 0.45c featured release only).
If your USB drive does not boot to grub4dos, then you should prepare the USB drive by reformatting it using RMPrepUSB (as FAT32 or NTFS - Boot as HDD) and then install grub4dos using the 'Install grub4dos' button.

Your grub4dos USB drive would normally already contain these files:
  • grldr
  • menu.lst
WARNING: The 'Two Spare Partition ISO method' requires that the partition table contains no more than 2 partitions already. If your USB drive has more than 2 Primary Partitions or more than 1 Primary and one Extended Partition then you cannot use this method and the menu will be prevented from running. If you are unsure of what partitions you have on the USB drive, use the Drive Info button in RMPrepUSB (select 0 for the start sector).
  • pclinuxos cannot find the .sqfs file if it is on an NTFS partition, it can find it if on an ext2/3 or FAT32 partition
  • pclinuxos will not be persistent unless an ext2/3 partition is present (or an ext2 file is mapped to a spare partition)

Two Spare Partition ISO Method (works on both NTFS and FAT32 USB drives)

This method requires two free primary entries in the partition table - it has the advantage that it can work on both FAT32 and NTFS grub4dos bootable drives.

1. Copy over the large ISO file to a folder on your USB drive. In my example, I have used the \_ISO\Linux folder on my USB drive.

/_ISO/Linux/pclinuxos-kde-fullmonty-2012.09.iso

If you place the file in a different folder you will need to change the menus below.

2. Ensure that the ISO file is contiguous - run RMPrepUSB and select the USB drive in the drive list box (if it is not already selected) - now press Ctrl+F2 to run WinContig. If RMPrepUSB reports that all files are contiguous then proceed to step 3.

If WinContig reports that the ISO cannot be made contiguous, then you will need to reformat the USB drive as follows:

2.1 Make a new folder on your PC's hard disk and copy ALL the files from you USB drive to the new folder
2.2 Using RMPrepUSB, reformat your USB drive (use either FAT32 or NTFS and the Boot as HDD option).
2.3 Make a \_ISO\Linux folder on your USB drive and copy the large ISO file from the hard disk to the \_ISO\Linux folder - do NOT copy any other files to the USB drive until the large ISO file copy has completed!
2.4. Run RMPrepUSB - Ctrl+F2  (WinContig) again to check the ISO is contiguous.
2.5 Now copy all the rest of the files back to the USB drive (if it asks to overwrite the ISO file - say 'Skip' as we do not want to mess up the ISO file)

3. Edit the \menu.lst file (press F4 in RMPrepUSB to load it into Notepad). Add the following contents (note that there are two parts, one must go at the top of the menu, the other is the menu entry itself and can be placed anywhere below the first text):

If your USB drive is FAT32, use the Alternative 2A or 2B menus below; they require only one spare partition on the USB drive.

# ---- PLACE THIS AT TOP OF MENU ---

#must enable parttype output
debug 1
# make empty table entry in 4th position in ptn table
parttype (hd0,3) | set check=
set check=%check:~-5,4% > nul
if "%check%"=="0x00" partnew (hd0,3) 0 0 0 > nul
if not "%check%"=="0x00" echo WARNING: PTN TABLE 4 IS ALREADY IN USE! && pause && configfile /menu.lst
# make empty table entry in 3rd position in ptn table
parttype (hd0,2) | set check=
set check=%check:~-5,4% > nul
if "%check%"=="0x00" partnew (hd0,2) 0 0 0 > nul
if not "%check%"=="0x00" echo WARNING: PTN TABLE 3 IS ALREADY IN USE! && pause && configfile /menu.lst

# ---- HERE IS THE MENU ENTRY -----

iftitle [if exist (bd)/_ISO/linux/pclinuxos-kde-fullmonty-2012.09.iso] Boot pclinuxos-kde-fullmonty-2012.09.iso WITH PERSISTENCE
# set partition 4 of USB be drive to contents of the ISO
partnew (hd0,3) 0x00 (bd)/_ISO/linux/pclinuxos-kde-fullmonty-2012.09.iso && echo Partition 4 now points to the ISO file
# set partition 3 of USB to be changes files which is formatted as ext2 filesystem
if exist (bd)/changes partnew (hd0,2) 0x00 (bd)/changes && echo Partition 3 now points to /changes file!
# map iso
map  /_ISO/linux/pclinuxos-kde-fullmonty-2012.09.iso (0xff)
map --hook 
root (0xff) > nul
if not exist (bd)/changes echo WARNING: /changes file does not exist - SO NO PERSISTENCE! && pause
# change splash=silent to splash=verbose to see all messages
kernel /isolinux/vmlinuz livecd=livecd root=/dev/rd/3 acpi=on vga=788 keyb=en vmalloc=256M nokmsboot splash=silent changes_dev=LABEL=changes fromusb > nul
#To run from RAM use the copy2ram cheatcode
initrd /isolinux/initrd.gz > nul
if exist (bd)/changes echo Persistence uses ext2/3 file /changes (which must have a volume label of changes)
pause --wait=3 Booting from ISO file...

4. This menu requires a recent version of grub4dos. I strongly recommend you click on the 'Install grub4dos' button in a recent version of RMPrepUSB and follow the prompts to overwrite the MBR boot code on your USB drive and copy over a recent version of grub4dos grldr.

5. For the persistent changes partition, we first need to create an ext2 file. Run RMPrepUSB and click on the Create Ext2 FS button - type changes for the filename and choose a suitable size (e.g. 256MB, 480MB, 900MB or 1GB have been tested - avoid 500MB there seems to be a problem with this size!). Wait until the file has been created successfully. This creates an ext2 file which has a filename and ext2 volume name of 'changes'.

6. Check files on the USB drive (and check the paths match in your menu.lst file!):

\grldr
\menu.lst
\changes
\_ISO\Linux\pclinuxos-kde-fullmonty-2012.09.iso

Alternative 1 - ISO One Spare Partition Alternative (non-persistent)

Works with NTFS and FAT32 USB drives:

You can boot the ISO without persistence using the following menu (only one spare partition entry is required on the USB drive instead of two):

#must enable parttype output
debug 1
# make empty table entry in 4th position in ptn table
parttype (hd0,3) | set check=
set check=%check:~-5,4% > nul
if "%check%"=="0x00" partnew (hd0,3) 0 0 0 > nul
if not "%check%"=="0x00" echo WARNING: PTN TABLE 4 IS ALREADY IN USE! && pause && configfile /menu.lst

iftitle [if exist (bd)/_ISO/linux/pclinuxos-kde-fullmonty-2012.09.iso] Boot pclinuxos-kde-fullmonty-2012.09.iso NO PERSISTENCE
partnew (hd0,3) 0x00 (bd)/_ISO/linux/pclinuxos-kde-fullmonty-2012.09.iso
map  (bd)/_ISO/linux/pclinuxos-kde-fullmonty-2012.09.iso (0xff)
map --hook 
root (0xff)
chainloader (0xff)

Alternative 2 - ISO (no spare partition entry required unless persistence required)

I could not get this to work on an NTFS USB drive, but FAT32 USB drives were OK! The bootfromiso should contain the path to the ISO file!

# -- 2A NO PERSISTENCE --

iftitle [if exist (bd)/_ISO/linux/pclinuxos-kde-fullmonty-2012.09.iso] Boot pclinuxos-kde-fullmonty-2012.09.iso
map (bd)/_ISO/linux/pclinuxos-kde-fullmonty-2012.09.iso (0xff)
map --hook
root (0xff) > nul
kernel /isolinux/vmlinuz fromusb bootfromiso=/_ISO/linux/pclinuxos-kde-fullmonty-2012.09.iso livecd=livecd root=/dev/rd/3 acpi=on vga=788 keyb=en vmalloc=256M  nokmsboot > nul
initrd  /isolinux/initrd.gz > nul


# - 2B WITH PERSISTENCE - PARTITION TABLE ENTRY 4 MUST BE EMPTY --

# FAT32 USB DRIVES ONLY - DOES NOT WORK ON NTFS USB DRIVES (livecd file not found)!

#must enable parttype output
debug 1
# make empty table entry in 4th position in ptn table
parttype (hd0,3) | set check=
set check=%check:~-5,4% > nul
if "%check%"=="0x00" partnew (hd0,3) 0 0 0 > nul
if not "%check%"=="0x00" echo WARNING: PTN TABLE 4 IS ALREADY IN USE! && pause && configfile /menu.lst

iftitle [if exist (bd)/_ISO/linux/pclinuxos-kde-fullmonty-2012.09.iso] Boot pclinuxos-kde-fullmonty-2012.09.iso WITH PERSISTENCE
map (bd)/_ISO/linux/pclinuxos-kde-fullmonty-2012.09.iso (0xff)
map --hook
root (0xff) > nul
# set partition 4 of USB to be changes files which is formatted as ext2 filesystem
if exist (bd)/changes partnew (hd0,3) 0x00 (bd)/changes && echo Partition 4 now points to /changes file!
if not exist (bd)/changes echo WARNING: /changes file does not exist - SO NO PERSISTENCE! && pause
# change splash=silent to splash=verbose to see all messages
#To run from RAM use the copy2ram cheatcode
kernel /isolinux/vmlinuz fromusb bootfromiso=/_ISO/linux/pclinuxos-kde-fullmonty-2012.09.iso livecd=livecd root=/dev/rd/3 acpi=on vga=788 keyb=en vmalloc=256M  nokmsboot  splash=verbose changes_dev=LABEL=changes > nul
initrd  /isolinux/initrd.gz > nul

Alternative 3 - Flat File Boot (No persistence - FAT32 only)

Extract the contents of the ISO file to the USB drive. Only the isolinux folder and the root file livecd.fs is required - copy all these to the \_ISO\Linux\pclinuxos folder.

title PCLinuxOS NO PERSISTENCE
kernel /_ISO/Linux/pclinuxos/isolinux/vmlinuz fromusb  livecd=
/_ISO/Linux/pclinuxos/livecd root=/dev/rd/3 acpi=on vga=788 keyb=en vmalloc=256M edd=off > nul
initrd /_ISO/Linux/pclinuxos/isolinux/initrd.gz > nul

Folder structure:
\_ISO\Linux\pclinuxos\livecd.sqfs
\_ISO\Linux\pclinuxos\isolinux\vmlinuz
\_ISO\Linux\pclinuxos\isolinux\initrd.gz

Testing

Most virtual machines or emulators (such as QEMU) are NOT suitable for testing when using the partnew command method as they may not have write permission to make new partition table entries to the USB drive. You will probably need to test using a real system by booting your PC from the USB drive.

Once you have run the USB drive on a real system, you may find that the USB drive will now work in an emulator because the 3rd and 4th partition table entries will have been written by the real system into the USB partition table.

Booting the FullMonty!

On first boot, you should see the 'live' FullMonty desktop...

 
           


When you next reboot, if persistence is working, you should see both a root and guest login, as shown below:

(if you cannot login, don't forget to check CapsLock and NumLock state!)

    

User login if persistence enabled                                   root login (4 desktops)                                                    guest login (6 desktops)

The passwords that you may need to know are:

user=root    pwd=root

user=guest pwd=guest 

Troubleshooting

If the changes file will not load, use the RMPrepUSB - Create ext2 FS button to create a file called changes of one of the following tested sizes 256MB, 400MB, 900MB or 1000MB (note that for some strange reason using 500MB always prevents pclinuxos from loading the file on my system - so try a different size!)

If the livecd.sqfs file cannot be found, check the livecd= cheat code has the correct path (do not specify the .sqfs extension - also the path is case-sensitive, _ISO is NOT the same as \_Iso or \iso!).

e.g.
        livecd=livecd                     - pclinuxos will expect the file livecd.sqfs in the root of the drive or ISO file
        livecd=/_ISO/Linux/livecd   - pclinuxos will expect the file livecd.sqfs at /_ISO/Linux/livecd - note that /_iso/linux/livecd will return an error as linux is case sensitive!