Thursday, 12 May 2016

Booting Dr.Web LiveDisk ISO with persistence from grub2


A DrWeb_Persistent.imgPTN23 file can be found here. It was made as follows:
1. Make a 800MB FAT32 partition on a USB drive
2. Download and run the DrWeb USB creator utility drweb-livedisk-900-usb.exe
3. Run it to extract the files to the USB drive
4. Boot the USB drive on a real system - this prepares it
5. Refresh the updates - reboot and check updates are persistent
6. Drag-and-drop the USB drive letter onto the MPI_FAT32 Desktop icon to make a .imgPTN23 file (syslinux 603, auto-convert). I modified the \syslinux\txt.cfg and the \boot\grub\grub.cfg files to add nomodeset vga=ask ignore_uuid. 

Note: Updates are not persistent even on their own flash drive!  

Booting from ISO

The Dr.Web ISO boots fine in MBR mode from E2B and can be booted from the ISO with persistence by adding a .mnu file.

However, during testing of the new GRUB2 menu system for E2B, I tried the Dr.Web LiveDisk ISO (drweb-livedisk-900-cd.iso - free), but it did not boot using the grub2 menu that I 'borrowed' from the 'Multiboot USB Flash drive' project here (I got a 'squashfs not found' type error).

After many attempts to get it booting from an ISO using the cheat code 'iso-scan/filename=', I finally looked at the 'casper' linux shell script file located inside the initrd file in the scripts folder (using 7Zip), and found this code...



parse_cmdline() {
    for x in $(cat /proc/cmdline); do
        case $x in
            showmounts|show-cow)
                export SHOWMOUNTS='Yes' ;;
            persistent)
                export PERSISTENT="Yes" ;;
            nopersistent)
                export PERSISTENT="" ;;
            persistent-path=*)
                export PERSISTENT_PATH="${x#persistent-path=}" ;;
            union=*)
                export UNIONFS="${x#union=}";;
            ip=*)
                STATICIP=${x#ip=}
                if [ "${STATICIP}" = "" ]; then
                    STATICIP="frommedia"
                fi
                export STATICIP ;;
            uuid=*)
                UUID=${x#uuid=} ;;
            ignore_uuid)
                UUID="" ;;
            live-media-path=*)
                LIVE_MEDIA_PATH="${x#live-media-path=}"
                export LIVE_MEDIA_PATH
                echo "export LIVE_MEDIA_PATH=\"$LIVE_MEDIA_PATH\"" >> /etc/casper.conf ;;
            toram)
                export TORAM="Yes" ;;
            todisk=*)
                export TODISK="${x#todisk=}" ;;
        esac
    done
    if [ "${UNIONFS}" = "" ]; then
        export UNIONFS="DEFAULT"
    fi
}


From this I could find no 'fromiso' or 'isoscan/filename' cheat code with which to tell the kernel what ISO file to find the squashfs files in! There was no mention of 'iso-scan' in any other script either! So it looks like booting from an ISO file is not going to be possible using cheat codes.

Next, I tried a 'flat-file' boot by extracting the contents of the ISO file to my USB drive (2nd partition for the grub2 menu ssytem).

After some experimentation, I found that the key to getting it to work was to use the 'ignore_uuid' cheat code. This told the kernel not to try looking for the 'cdrom'.

For the final .grub2 menu file, I ended up with this menu (note that some long lines may wrap over to the next line):

# only tested on FAT32 so far
#drweb-livedisk-900-cd.iso  extract iso to \ISO_Extract\drweb  (probably only casper folder needed)
#EFI64 MBR64 EFI32 MBR32
if [ -e "$root2$isoextpath/drweb/casper/vmlinuz" ]; then
menuentry "DrWeb live CD (extracted)" --unrestricted --class drweb{
set root=$root2
set fldname=drweb
# must use ignore_uuid  !!!
linux  $isoextpath/$fldname/casper/vmlinuz  boot=casper live-media-path=$isoextpath/$fldname/casper ignore_uuid --
initrd $isoextpath/$fldname/casper/initrd.lz
boot
}
fi

Folder structure
===========
\ISO_Extract\drweb\casper-rw
\ISO_Extract\drweb\casper (folder)
\ISO_Extract\drweb\install (folder)

You can have persistence by creating a 200MB ext2 file using RMPrepUSB - Create ext2 file - casper-rw - casper-rw - 200 on a spare USB drive, and then copy the file the \ISO_Extract\drweb folder.

I will provide a ready-made 200MB file in the grub2 download which you can unzip and use.
Dr.Web with persistent desktop and updates.
This works under both MBR and UEFI and on both 32-bit and 64-bit systems even though there are no UEFI boot files in the ISO!

I have not tested NTFS yet, but I see some people have reported that it does not boot on NTFS partitions.

P.S. I just retested this and now it stops and prompts me with:
'Please provide a name for this disk' 
Same disk, same file, same menu!

I don't know what I changed! Usually this message means it is looking for a .disk folder in the root, but even if extract it from the ISO and put it there (and in several other places!), I still get the message and it doesn't boot! grrrrr...
It can be made to continue by typing  ALT+F1 - enter some random text e.g. "xxx" - then press [ENTER] key and it should continue to boot (press ALT+F7 to return to message console if required).

No comments:

Post a comment