Tuesday, 29 March 2016

Add PepperMint 6 + persistence to E2B

PepperMint 6 can be booted as a 'LiveCD' from ISO with persistence.
Britec has a YouTube video on how to install it as an OS.

However, we can run it from an ISO file with persistence from E2B too using a .mnu file.
It is based on Ubuntu and so uses a casper-rw persistence file.


# Make a ext2 file using RMPrepUSB in the root of the drive (i.e. File Name=pepper-rw  Volume Name=casper-rw)
# Place this .mnu file and the Ubuntu ISO in either \_ISO\MainMenu\MNU or \_ISO\Linux\MNU
# This menu will work even on an NTFS USB boot drive
# IMPORTANT: you MUST run WinContig (Ctrl+F2) before booting E2B.
# https://www.kernel.org/doc/Documentation/kernel-parameters.txt

iftitle [if exist $HOME$/Peppermint-6-20150904-i386.iso] Peppermint-6-20150904-i386 \n Boot using .mnu file with persistence

set ISO=$HOME$/Peppermint-6-20150904-i386.iso
set PER=/pepper-rw

if exist CD echo WARNING: Cannot use partnew command! && pause && configfile (bd)/menu.lst
if "%E2BDEV%"=="" set E2BDEV=hd0 && pause E2BDEV forced to hd0!
#enable parttype output
debug 1
# make empty table entry in 3rd position in ptn table
parttype (%E2BDEV%,2) | set check=
debug off
set check=%check:~-5,4%
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0 0 0
if not "%check%"=="0x00" echo WARNING: PTN TABLE 3 IS ALREADY IN USE - PERSISTENCE MAY NOT WORK! && pause
debug 1
echo
if not exist %PER% echo -e $[0x0c]WARNING: %PER% persistence file not found! && pause
errorcheck off
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0x0 %PER%
errorcheck on
#map ptn 4 to ISO
partnew (%E2BDEV%,3) 0x0 %ISO%
map %ISO% (0xff)
map --hook
root (0xff)
kernel /casper/vmlinuz  rw file=/preseed/peppermint.seed boot=casper quiet splash persistent --
initrd /casper/initrd.lz 

This menu will be in the Sample mnu Files\linux folder in 1.79 when released.

Use ext3 instead of ext2 for safer persistence

When using an ext2 file for persistence, I have found that it can easily get corrupted if you don't shut down linux nicely. A corrupt persistence file can cause linux to fail to boot!

If you intend to make serious use of the distro, it is much better to convert the ext2 file to ext3 first, as follows:

1. Instead of booting to linux using the .mnu file, boot directly from the .iso file using E2B

2. In the terminal window, type:

sudo fdisk -l                 (find the USB drive partition - e.g. /dev/sdb1)
mkdir ss                       (make a directory)
mount /dev/sdX1 ss     (mount the USB partition to ss)
mkfs -t ext3 -L casper-rw ss/pepper-rw   (format pepper-rw as ext3 with a volume label of casper-rw)
sudo umount ss

3. Now boot using the .mnu file and you should have persistence but using ext3.