Skip to content
soul9 edited this page Apr 25, 2015 · 6 revisions

squash-tool is an alternate installer for sabotage. It can create install or live system, bootable with either MBR or uEFI.

squashfs is a read-only filesystem for linux, this means that you will need to adapt your filesystem before installation.

squash-tool can additionally configure an rw partition using btrfs.

Modes

squash-tool install

Will install a squash-based sabotage system to a device or image file.

warning: this will clobber a whole device

usage is: squash-tool install path fat_size (n|rw_type [image_size] [keyring device])

If path is not a block device, it is assumed to be an image file. In this case the total image size has to be given along with the boot fat partition size. If path is a block device, whole-device install is assumed and the image_size argument is not needed (it is ignored, and instead interpreted as next argument mhich is keyring device)

rw_type is the read-write filesystem.

sizes can be given as for dd (they are passed directly to dd), with suffxes M G and T for Megabyte, Gigabyte and Terabyte respectively.

keyring device is a partition (logically should be on removable media) where the Luks disk encyption keys will be stored.

Note: if you are installing to an efi system, you will need to manually add the bootloader entry to the efi boot manager. The path to the efi application is \efi\boot\bootx64.efi. This is not needed on removable media where the default path is loaded automatically.

squash-tool tarball

This mode creates a tarball that can then be used to create images, install to devices or update existing installs.

squash-tool update

In this mode you can use an extracted tarball made with the tarball mode and update you existing sabotage+squash system. First argument is the directory the update was unpacked to, second argument is boot device or directory (i.e usually /dev/sda1 or /boot), the third argument is the keyring device if you have a luks-enabled install. You can update a running system or a system on an inactive partition, depending on whether the second argument is a mountpoint or a device.

squash-tool chroot

To use the tool from a tarball, you should extract it and then use "./squash-tool chroot .", from in here you can customize your install (using bind mounts) and then install to a device or image (or even create a new tarball). To have files persist after exiting the chroot, you should use the /tmp/boot directory which is the directory the tarball was extrated to.

squash-tool srctar

usage is: squash-tool srctar dst.tar.xz do_tar_build

This makes a tarball of /src, optionally including the build and tarballs directory (if do_tar_build is "yes").

squash-tool mkinitramfs

Mostly for internal purposos, this creates a minimal initramfs that bootstraps the boot process.

squash-tool update

usage is: squash-tool update src dst bootdev

src and dst should be directories like the one extracted from a tarball that was made using "squash-tool tarball".

bootdev should be the boot partition

This will move the kernel, initramfs, squashfs and src tarball in dst to be named old, and moves the ones from src to be the default boot. it will also update the bootloader configuration. After this, you will have two boot options: one to boot your old root+initramfs+kernel, and the default to boot the new one.

interactive mode

if install is called without arguments, it should start to ask questions interactively. This is highly experimental and will probably launch a nuke. Or something.

Example usage

I have a sabotage chroot in /opt/sabotage on a distant build host. I want to install sabotage on a machine that currently has no linux installed (chroot install not possible).

  1. enter_chroot

If i have a linux machine on hand:

  1. squash-tool tarball /tmp/sabotage.tar.xz
  2. copy /opt/sabotage/tmp/sabotage.tar.xz to your linux machine
  3. extract tarball into a directory
  4. insert usb drive (/dev/sdb in this example)
  5. ./squash-tool chroot directory_where_extracted
  6. squash-tool install /dev/sdb 2G n #be careful, this'll clobber /dev/sdb)

If i do not have a linux machine on hand:

  1. squash-tool install /tmp/sabotage.img 2G n
  2. copy /opt/sabotage/tmp/sabotage.img to a windows host
  3. you can use http://sourceforge.net/p/usbwriter/wiki/Documentation/ to copy the image to an usb disk

common

  1. insert usb disk to host and boot off it
  2. log in

if you want to customize before installation

lets say I want to edit /etc/fstab. you can not do it here because /boot contains install files, so they will just be copied, so you have to:

  1. squash-tool chroot /boot
  2. cp /etc/fstab /tmp
  3. mount --bind /tmp/fstab /etc/fstab
  4. edit /etc/fstab

finishing off

  1. squash-tool install /dev/sda 4G btrfs #this will clobber /dev/sda

encryption

if you want to use btrfs multi-device support and still encrypt all devices that are used, all you need to de is manually encrypt the device, add the keys as keyring_device/partUUID_LuksKey[slotnum], then add the device to your btrfs filesystem. The commands to encrypt the device can be abtained by looking at the squash-tool source.