Friday, 25 November 2016

Pentoo ISO with persistence on E2B

The pentoo FAQ says you can use changes=/dev/sdXY kernel cheat code to specify the persistence volume. This is incorrect!
It seems that we must use aufs=/dev/sdXY for pentoo.
As pentoo is based on gentoo, we can use a similar .mnu file for persistence with pentoo.


The .mnu file is shown below:


# Make an ext3 file using RMPrepUSB in the root of the drive using RMPrepUSB
# File Name=pentoo-rw  Volume Name=aufs-rw size=anything over 256MB
# Place this .mnu file and the 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.
# On first boot (only), Gentoo will prompt you for the size of the persistence file
# http://rmprepusb.blogspot.co.uk/2016/07/add-gentoo-persistence-to-e2b.html

iftitle [if exist $HOME$/pentoo-amd64-default-2015.0_RC5.iso] pentoo 64-bit + persistent\n Pentoo with persistence
set PER=/pentoo-rw
set ISO=$HOME$/pentoo-amd64-default-2015.0_RC5.iso

set me=
if not exist me geometry (hd1) > nul || if not exist me set me=/dev/sda3
if not exist me geometry (hd2) > nul || if not exist me set me=/dev/sdb3
if not exist me geometry (hd3) > nul || if not exist me set me=/dev/sdc3
if not exist me geometry (hd4) > nul || if not exist me set me=/dev/sdd3
if not exist me geometry (hd5) > nul || if not exist me set me=/dev/sde3
if not exist me geometry (hd6) > nul || if not exist me set me=/dev/sdf3
if not exist me geometry (hd7) > nul || if not exist me set me=/dev/sdg3
if not exist me geometry (hd8) > nul || if not exist me set me=/dev/sdh3
if not exist me geometry (hd9) > nul || if not exist me set me=/dev/sdi3
echo
echo -e I guess that the USB drive will be $[0104]%me%
set /p me=Press [ENTER] if correct - else type in correct device ending in 3 (e.g. /dev/sdX3) : 
echo
echo Assuming persistence file %PER% is on %me%
#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 WILL NOT WORK! && pause
debug 1
if not exist %PER% echo WARNING: %PER% persistence file not found! && pause
errorcheck off
set P=0
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0x0 %PER% && set P=1
errorcheck on
/%grub%/QRUN.g4b force.isodefault %ISO%
root (0xff)
if "%P%"=="1" set aufs=aufs=%me% || set aufs=aufs

kernel /isolinux/pentoo root=/dev/ram0 init=/linuxrc nox nodhcp %aufs% max_loop=256 dokeymap looptype=squashfs loop=/image.squashfs cdroot video=uvesafb:mtrr:3,ywrap,1024x768-16 usbcore.autosuspend=1 console=tty0 net.ifnames=0 
#verify
initrd /isolinux/pentoo.igz
boot

Note that because the drive names will vary once we boot to linux, the menu has to 'guess' at what the USB drive name will be and asks you to confirm it.

Also, you may need to check the isolinux.cfg file inside the ISO on later versions, in order to get the correct kernel parameters if they have changed.