USB Armory

From Void Linux Wiki
Jump to: navigation, search

Installation

Grab the latest image for the USB Armory:

$ wget http://repo.voidlinux.eu/live/void-usbarmory-latest.img.xz
$ unxz void-usbarmory-latest.img.xz

Copy the image to an empty SD card, replacing sdX by the corresponding device:

# dd if=void-usbarmory-latest.img of=/dev/sdX

Insert the SD card into your USB armory and plug it in your PC. When the USB Armory has booted, a new network device should be available on your PC. Configure it as follows, replacing enp0s20u2u3 by the device corresponding to the USB Armory and wlp3s0 by the network device used to access the internet.

# ip addr add 10.0.0.1/255.255.255.0 broadcast 10.0.0.255 dev enp0s20u2u3
# iptables -t nat -A POSTROUTING -s 10.0.0.1/32 -o wlp3s0 -j MASQUERADE
# echo 1 > /proc/sys/net/ipv4/ip_forward

Then login:

$ ssh 10.0.0.1 -lroot

The password is voidlinux

rootfs-install

Grab the latest rootfs for the USB Armory:

$ wget http://repo.voidlinux.eu/live/void-usbarmory-rootfs-latest.tar.xz
Tip: Make sure to check that the sha256 value is correct. The sha256 hash is stored in the sha256sums.txt file.

Preparing the SD card

The SD card must have at least 2 partitions, one as FAT (with partition type 0c!) for /boot and another one as ext4/f2fs for /; let's begin preparing the partitions and mounting them in a directory:

$ parted /dev/sda <- change this to match your SD card

# Create the FAT partition of 256MB and make it bootable
(parted) mktable msdos
(parted) mkpart primary fat32 2048s 256MB
(parted) toggle 1 boot

# Create the rootfs partition until end of device
(parted) mkpart primary ext4 256MB -1
(parted) quit

Now let's create the filesystems in the SD card:

$ mkfs.vfat /dev/sda1  ← change this to match your SD card and FAT32 partition
$ mkfs.ext4 -O ^has_journal /dev/sda2  ← change this to match your SD card and ext4 partition
Note: The -O ^has_journal option disables journaling on ext4 partition. It will extend the life of your drive (usually Flash drives).

Preparing target rootfs directory

$ mkdir ~/rootfs
# mount /dev/sda2 ~/rootfs/
# mkdir ~/rootfs/boot
# mount /dev/sda1 ~/rootfs/boot

Unpack the rootfs into the target rootfs directory and sync to make sure files are written to storage:

# tar xvfJp ~/void-usbarmory-rootfs-latest.tar.xz -C ~/rootfs
# sync
Note: Do not forget to unpack the rootfs as root and with the -p flag to set appropriate permissions.

The /boot partition must also be added to /etc/fstab:

# echo '/dev/mmcblk0p1 /boot vfat defaults 0 0' >> ~/rootfs/etc/fstab

Umount the SD card filesystems from target rootfs directory.

Insert the SD card and test that the USB Armory boots correctly, the root password is voidlinux.