Skip to content

Instantly share code, notes, and snippets.

@metaquanta
Last active November 20, 2020 23:31
Show Gist options
  • Save metaquanta/095317b43ffac1a912c099b1492f3226 to your computer and use it in GitHub Desktop.
Save metaquanta/095317b43ffac1a912c099b1492f3226 to your computer and use it in GitHub Desktop.
Install Tails to local disk

In this example I'm installing Tails to the internal storage of an ASUS Chromebook C302 with mrchromebox's EFI firmware. The steps should be the same for any Tails-supported EFI computer. My internal disk is mmcblk0 and its first partition is mmcblk0p1 and my Tails USB drive is sda and its first partition is sda1. Yours may differ, so substitue appropriately.

The Tails installer doesn't seem to want to install to internal storage even though mine's recognized as an SD card.

  1. Boot Tails as normal but set a root password in "Additional Settings".

  2. Launch "Root Terminal".

  3. Create partitions on internal storage with the same geometry as the Tails partitions.

    • parted /dev/sda (note the sector size).
      • u s sets units to sectors.
      • p prints the table.
    • parted /dev/mmcblk0 (note the sector size).
      • u s
      • mkpart Tails fat32 2048s 16777216s
  4. Copy the Tails data:

    • dd bs=1M if=/dev/sda1 of=/dev/mmcblk0p1

Grub is configured to look for a bootable partition on removables only. To fix that:

  1. Mount the installation target:

    • mount -t vfat /dev/mmcblk0p1 /mnt
  2. Change the kernel command line:

    • sed -i 's/live-media=removable/live-media=\/dev\/mmcblk0p1/' /mnt/EFI/debian/grub.cfg

All that's left is to tell EFI to use grub:

  1. Install efibootmgr

    • apt install efibootmgr
    • Install "only once" when prompted.
  2. Create boot entry:

    • efibootmgr -c -d /dev/mmcblk0 -p 1 -L Tails -l '\EFI\BOOT\GRUBX64.EFI'

Reboot!

So far, upgrades go smoothly but revert the kernel command line. I put the following in an executable file on persistent storage:

#!/bin/bash
mount -o remount,rw /dev/mmcblk0p1 /lib/live/mount/medium
sed -i 's/live-media=removable/live-media=\/dev\/mmcblk0p1/' /lib/live/mount/medium/EFI/debian/grub.cfg

If you find yourself in an EFI shell: fs0: followed by EFI\BOOT\GRUBX64.EFI should launch grub.

If you find yourself in Tails needing to make changes to the read only file system: mount -o remount,rw /dev/mmcblk0p1 /lib/live/mount/medium should make it writable.

If you find yourself in the initramfs, reboot and press e in grub to fix the kernel command line. I don't know how to fix a live-boot from initramfs.

All suggestions welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment