USB Armory

From Void Linux Wiki
Jump to: navigation, search


Grab the latest image for the USB armory:

$ wget
$ unxz void-usbarmory-latest.img.xz

copy the image to an empty sd card:

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

replace sdX by the corresponding device

Insert the sd card into you 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:

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

replace enp0s20u2u3 by the device corresponding to the USB armory and wlp3s0 by the network device used to access the internet.

Then login:

$ ssh -lroot

the password is voidlinux


Grab latest rootfs for the USB armory:

$ wget
Make sure to check that sha256 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

The -O ^has_journal option disables journaling on ext4 partition. It'll 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
Do not forget to unpack the rootfs as root and with the -p flag to set appropiate 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 the USB armory boots correctly, the root password is voidlinux.