Multi-boot stick update: TAILS 1.6, SysresCD 4.6.0, GParted 0.23, Debian 8.2

Updates for my multi-boot/multi-purpose USB stick: All components have been updated to the latest versions and I have confirmed that all of them still boot properly – although changes in the grub.cfg file are necessary. So going through these explanations one will end up with a usable USB stick that can boot you into TAILS, System Rescue CD, GNU Parted Live CD, GRML, and also can boot into an installation of Debian 8.2 Jessie installation. All this while still being able to use the USB stick as normal media.

multi-usb-disk

Since there have been a lot of updates, and also changes in the setup and grub config file, I include the full procedure here, that is, merging and updating these previous posts: USB stick with Tails and SystemRescueCD, Tails 1.2.1, Debian jessie installer, System Rescue CD on USB, USB stick update: TAILS 1.4, GParted 0.22, SysResCD 4.5.2, Debian Jessie, and USB stick update: Debian is back, plus GRML.

Let us repeat some things from the original post concerning the wishlist and the main players:

I have a long wishlist of items a boot stick should fulfill

  • boots into Tails, SystemRescueCD, GParted, and GRML
  • boots on both EFI and legacy systems
  • uses the full size of the USB stick (user data!)
  • allows installation of Debian
  • if possible, preserve already present user data on the stick

Requirements

A USB stick, the iso images of TAILS 1.6, SystemRescueCD 4.6.0, GParted Lice CD 0.23.0, GRML 2014.11, and some tool to access iso images, for example ISOmaster (often available from your friendly Linux distribution).

I assume that you have already an USB stick prepared as described previously. If this is not the case, please go there and follow the section on preparing your usb stick.

Three types of boot options

We will employ three different approaches to boot special systems: the one is directly from an iso image (easiest, simple to update), the other via extraction of the necessary kernels and images (bit painful, needs some handwork), and the last one is a mixture necessary to get Debian booting (most painful, needs additional downloads and handwork).

At the moment we have the following status with respect to boot methods:

  • Booting directly from ISO image: System Rescue CD, GNOME Parted Live CD, GRML
  • Extraction of kernels/images: TAILS
  • Mixture: Debian Jessie install

Booting from ISO image

Grub has gained quite some time ago the ability to boot directly from an ISO image. In this case the iso image is mounted via loopback, and the kernel and initrd are specified relatively to the iso image root. This system makes it extremely easy to update the respective boot option: just drop the new iso image onto the USB stick, and update the isofile setting. One could even use some -latest method, but I prefer to keep the exact name.

For both SystemRescueCD, GNOME Partition Live CD, and GRML, just drop the iso files into /boot/iso/, in my case /boot/iso/systemrescuecd-x86-4.6.0.iso and /boot/iso/gparted-live-0.23.0-1-i586.iso.

After that, entries like the following have to be added to grub.cfg. For the full list see grub.cfg:

submenu "System Rescue CD 4.6.0 (via ISO) ---> " {
  set isofile="/boot/iso/systemrescuecd-x86-4.6.0.iso"
  menuentry "SystemRescueCd (64bit, default boot options)" {
        set gfxpayload=keep
        loopback loop (hd0,1)$isofile
        linux   (loop)/isolinux/rescue64 isoloop=$isofile
        initrd  (loop)/isolinux/initram.igz
  }
  ...
}

submenu "GNU/Gnome Parted Live CD 0.23.0 (via ISO) ---> " {
  set isofile="/boot/iso/gparted-live-0.23.0-1-i586.iso"
  menuentry "GParted Live (Default settings)"{
    loopback loop (hd0,1)$isofile
    linux (loop)/live/vmlinuz boot=live union=overlay username=user config components quiet noswap noeject  ip= net.ifnames=0 nosplash findiso=$isofile
    initrd (loop)/live/initrd.img
  }
  ...
}

submenu "GRML 2014.11 ---> " {
  menuentry "Grml Rescue System 64bit" {
        iso_path="/boot/iso/grml64-full_2014.11.iso"
        export iso_path
        loopback loop (hd0,1)$iso_path
        set root=(loop)
        kernelopts=" ssh=foobarbaz toram  "
        export kernelopts
        configfile /boot/grub/loopback.cfg
  } 
}

Note the added isoloop=$isofile and findiso=$isofile that helps the installer find the iso images.

Booting via extraction of kernels and images

This is a bit more tedious, but still not too bad.

Installation of TAILS files

Assuming you have access to the files on the TAILS CD via the directory ~/tails, execute the following commands:

mkdir -p /usbstick/boot/tails
cp -a ~/tails/live/* /usbstick/boot/tails/

The grub.cfg entries look now similar to the following:

submenu "TAILS Environment 1.6 ---> " {
  menuentry "Tails64 Live System" {
        linux   /boot/tails/vmlinuz2 boot=live live-media-path=/boot/tails config live-media=removable nopersistent noprompt timezone=Etc/UTC block.events_dfl_poll_msecs=1000 splash noautologin module=Tails
        initrd  /boot/tails/initrd2.img

  }
  ...
}

The important part here is the live-media-path=/boot/tails, otherwise TAILS will not find the correct files for booting. The rest of the information was extracted from the boot setup of TAILS itself.

Mixture of iso image and extraction – Debian jessie

As mentioned in the previous post, booting Debian/Jessie installation images via any method laid out above didn’t work, since the iso images is never found. It turned out that the current installer iso images do not contain the iso-scan package, which is responsible for searching and loading of iso images.

But with a small trick one can overcome this: One needs to replace the initrd that is on the ISO image with one that contains the iso-scan package. And we do not need to create these initrd by ourselves, but simply use the ones from hd-media type installer. I downloaded the following four gzipped initrds from one of the Debian mirrors: i386/initrd text mode, i386/initrd gui mode, amd64/initrd text mode, amd64/initrd gui mode, and put them into the USB stick’s boot/debian/install.386, boot/debian/install.386/gtk, boot/debian/install.amd, boot/debian/install.amd/gtk, respectively. Finally, I added entries similar to this one (rest see the grub.cfg file):

submenu "Debian 8.2 Jessie NetInstall ---> " {
    set isofile="/boot/iso/firmware-8.2.0-amd64-i386-netinst.iso"
    menuentry '64 bit Install' {
        set background_color=black
        loopback loop (hd0,1)$isofile
        linux    (loop)/install.amd/vmlinuz iso-scan/ask_second_pass=true iso-scan/filename=$isofile vga=788 -- quiet 
        initrd   /boot/debian/install.amd/initrd.gz
    }
    ...
}

Again an important point, don’t forget the two kernel command line options: iso-scan/ask_second_pass=true iso-scan/filename=$isofile, otherwise you probably will have to make the installer scan all disks and drives completely, which might take ages.

Current status of USB stick

Just to make sure, the usb stick should contain at the current stage the following files:

/boot/
    iso/
        firmware-8.2.0-amd64-i386-netinst.iso
        gparted-live-0.23.0-1-i586.iso
        grml64-full_2014.11.iso
        systemrescuecd-x86-4.6.0.iso
    tails/
        vmlinuz Tails.module initrd.img ....
    grub/
        fonts/
            lots of files
        locale/
            lots of files
        x86_64-efi/
            lots of files
        font.pf2
        grubenv
        grub.cfg            *this file we create in the next step!!*
/EFI
    BOOT/
        BOOTX64.EFI

The Grub config file grub.cfg

The final step is to provide a grub config file in /usbstick/boot/grub/grub.cfg. I created one by looking at the isoboot.cfg files both in the SystemRescueCD, TAILS iso images, GParted iso image, and the Debian/Jessie image, and converting them to grub syntax. Excerpts have been shown above in the various sections.

I spare you all the details, grab a copy here: grub.cfg

Conclusion

That’s it. Now you can anonymously provide data about your evil government, rescue your friends computer, fix a forgotten Windows password, and above all, install a proper free operating system.

If you have any comments, improvements or suggestions, please drop me a comment. I hope this helps a few people getting a decent USB boot stick running.

Enjoy.

7 Responses

  1. Hello, Norbert!

    There is hardware solution, that works very well for booting “capricious” ISO-images (and Debian as well):
    http://www.zalman.com/global/product/Product_Read.php?Idx=673

    This external HDD case have a small logic board (with small Linux firmware I believe) which find ISO file and emulate it as real CD-ROM hardware. You can select different ISO images with joystick.

    I’m using combination of both methods. I split HDD into two partitions. First partition is EXT4 formatted and have GRUB installed and used to boot “non capricious” ISO images via “loopback” GRUB option. Second partition is NTFS formatted and have _ISO folder from which device emulates CD-ROM hardware and I can boot “capricious” ISO images with no effort.

  2. TAILS, SystemRescueCD, GParted, Debian Jessie… Very sweet – my dream multiboot image ! Do you have a torrent with the final full iso produced by your procedure ? Or a script to build it ?

  3. Andreas Glaeser says:

    In fact I have a project also including the possibility of using an USB-key to boot the debian-system.
    You seem to be the bleeding-edge firmware-expert around here. I am especially interested in the part about a hybrid-image for legacy and UEFI, but I haven’t checked all the links yet.
    My image is there:

    https://archive.org/details/Cucumber_instant-wheezy-32-de-bpo

    Do you have any ready-made image of your stick, or are people supposed to make it themselves? If I get it correctly, everything included is free and open-source, so there wouldn’t at least be any licensing-troubles .

  4. olivier says:

    I’m sorry 🙁
    you’re only the seventh attempt to create a multiboot usb stick ; arf, 5 days now of work for no result, I understand why so many people dislike all linux.
    Here, in your case, following the instructions it gaives – in the terminal- the following:

    sudo grub-install –removable –target=i386-pc –root-directory=/media/usb0 /dev/sdd
    Installing for i386-pc platform.
    grub-install.real : attention : Tentative d’installation de GRUB sur un disque ayant plusieurs étiquettes de partition. Ce n’est pas encore possible..
    grub-install.real : attention : Installation impossible. GRUB peut seulement être installé sur cette configuration en utilisant les listes de blocs. Toutefois, les listes de blocs ne sont PAS fiables et leur emploi n’est pas conseillé..
    grub-install.real : erreur : les listes de blocs ne seront pas traitées.

    It’s allways like this : all methods for creating multiboot usb sticks ends up with errors. I’ve tried all tools that we can find on the web and forums, for a PC in Linux Mint and for a PC in Vista; I’ve tried either many tricks given here and there by nice people on various forums. All methods gave no result at all, but waste of time.

    Theres no where any real instruction guide explaining to the newbie what should be done and how, how it works at least.. I feel very sad.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>