Warning: THE VOID WIKI IS DEPRECATED. It is no longer being maintained, contains outdated and incorrect information, and will eventually be shut down. Please refer to the Void Handbook, https://docs.voidlinux.org/, for the official documentation. If you can't find the information you're seeking, please raise an issue at https://github.com/void-linux/void-docs/issues

Difference between revisions of "USB Armory"

From Void Linux Wiki
Jump to navigation Jump to search
m (Style guide, typos.)
Line 1: Line 1:
[[Category:Guides]]
 
[[Category:Installation]]
 
[[Category:Embedded]]
 
 
== Installation ==
 
== Installation ==
  
Grab the latest image for the USB armory:
+
Grab the latest image for the USB Armory:
  
<pre>$ wget http://repo.voidlinux.eu/live/void-usbarmory-latest.img.xz
+
$ wget <nowiki>http://repo.voidlinux.eu/live/void-usbarmory-latest.img.xz</nowiki>
$ unxz void-usbarmory-latest.img.xz</pre>
+
$ unxz void-usbarmory-latest.img.xz
copy the image to an empty sd card:
 
  
<pre># dd if=void-usbarmory-latest.img of=/dev/sdX</pre>
+
Copy the image to an empty SD card, replacing sdX by the corresponding device:
replace sdX by the corresponding device
 
  
Insert the sd card into you USB armory and plug it in your PC.
+
# dd if=void-usbarmory-latest.img of=/dev/sdX
  
When the USB armory has booted a new network device should be<br />
+
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 <code>enp0s20u2u3</code> by the device corresponding to the USB Armory and <code>wlp3s0</code> by the network device used to access the internet.
available on your PC. Configure it as follows:
 
  
<pre># ip addr add 10.0.0.1/255.255.255.0 broadcast 10.0.0.255 dev enp0s20u2u3
+
# 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
+
# iptables -t nat -A POSTROUTING -s 10.0.0.1/32 -o wlp3s0 -j MASQUERADE
# echo 1 &gt; /proc/sys/net/ipv4/ip_forward</pre>
+
# echo 1 &gt; /proc/sys/net/ipv4/ip_forward
replace <code>enp0s20u2u3</code> by the device corresponding to the USB armory and <code>wlp3s0</code> by the network device used to access the internet.
 
  
 
Then login:
 
Then login:
  
<pre>$ ssh 10.0.0.1 -lroot</pre>
+
$ ssh 10.0.0.1 -lroot
the password is <code>voidlinux</code>
+
 
 +
The password is <code>voidlinux</code>
  
 
== rootfs-install ==
 
== rootfs-install ==
  
Grab latest rootfs for the USB armory:
+
Grab the latest rootfs for the USB Armory:
 +
 
 +
$ wget <nowiki>http://repo.voidlinux.eu/live/void-usbarmory-rootfs-latest.tar.xz</nowiki>
 +
 
 +
{{Tip|Make sure to check that the sha256 value is correct. The sha256 hash is stored in the <code>sha256sums.txt</code> file.}}
  
<pre>$ wget http://repo.voidlinux.eu/live/void-usbarmory-rootfs-latest.tar.xz</pre>
 
<blockquote>Make sure to check that sha256 is correct. The sha256 hash is stored in the <code>sha256sums.txt</code> file.
 
</blockquote>
 
 
=== Preparing the SD card ===
 
=== Preparing the SD card ===
  
The SD card must have at least 2 partitions, one as '''FAT''' (with partition type <code>0c</code>!) for <code>/boot</code> and another one as <code>ext4/f2fs</code> for /; let's begin preparing the partitions and mounting them in a directory:
+
The SD card must have at least 2 partitions, one as '''FAT''' (with partition type <code>0c</code>!) for '''<code>/boot</code>''' and another one as <code>ext4/f2fs</code> for '''<code>/</code>'''; let's begin preparing the partitions and mounting them in a directory:
  
 
<pre>$ parted /dev/sda &lt;- change this to match your SD card
 
<pre>$ parted /dev/sda &lt;- change this to match your SD card
Line 49: Line 44:
 
(parted) mkpart primary ext4 256MB -1
 
(parted) mkpart primary ext4 256MB -1
 
(parted) quit</pre>
 
(parted) quit</pre>
 +
 
Now let's create the filesystems in the SD card:
 
Now let's create the filesystems in the SD card:
  
<pre> $ mkfs.vfat /dev/sda1 &lt;- change this to match your SD card and FAT32 partition
+
$ mkfs.vfat /dev/sda1 &larr; change this to match your SD card and FAT32 partition
  $ mkfs.ext4 -O ^has_journal /dev/sda2 &lt;- change this to match your SD card and ext4 partition</pre>
+
  $ mkfs.ext4 -O ^has_journal /dev/sda2 &larr; change this to match your SD card and ext4 partition
The <code>-O ^has_journal</code> option disables journaling on ext4 partition. It'll extend the life of your drive (usually Flash drives).
+
 
 +
{{Note|The <code>-O ^has_journal</code> option disables journaling on ext4 partition. It will extend the life of your drive (usually Flash drives).}}
  
 
=== Preparing target rootfs directory ===
 
=== Preparing target rootfs directory ===
  
<pre> $ mkdir ~/rootfs
+
$ mkdir ~/rootfs
 
  # mount /dev/sda2 ~/rootfs/
 
  # mount /dev/sda2 ~/rootfs/
 
  # mkdir ~/rootfs/boot
 
  # mkdir ~/rootfs/boot
  # mount /dev/sda1 ~/rootfs/boot</pre>
+
  # mount /dev/sda1 ~/rootfs/boot
 +
 
 
Unpack the rootfs into the target rootfs directory and sync to make sure files are written to storage:
 
Unpack the rootfs into the target rootfs directory and sync to make sure files are written to storage:
  
<pre> # tar xvfJp ~/void-usbarmory-rootfs-latest.tar.xz -C ~/rootfs
+
# tar xvfJp ~/void-usbarmory-rootfs-latest.tar.xz -C ~/rootfs
  # sync</pre>
+
  # sync
<blockquote>Do not forget to unpack the rootfs as root and with the <code>-p</code> flag to set appropiate permissions.
+
 
</blockquote>
+
{{Note|Do not forget to unpack the rootfs as root and with the <code>-p</code> flag to set appropriate permissions.}}
The <code>/boot</code> partition must also be added to <code>/etc/fstab</code>:
+
 
 +
The <code>/boot</code> partition must also be added to {{path|/etc/fstab}}:
 +
 
 +
# echo '/dev/mmcblk0p1 /boot vfat defaults 0 0' >> ~/rootfs/etc/fstab
  
<pre> # echo '/dev/mmcblk0p1 /boot vfat defaults 0 0' &gt;&gt; ~/rootfs/etc/fstab</pre>
 
 
Umount the SD card filesystems from target rootfs directory.
 
Umount the SD card filesystems from target rootfs directory.
  
Insert the SD card and test the USB armory boots correctly, the <code>root</code> password is <code>voidlinux</code>.
+
Insert the SD card and test that the USB Armory boots correctly, the <code>root</code> password is <code>voidlinux</code>.
 +
 
 +
[[Category:Guides]]
 +
[[Category:Installation]]
 +
[[Category:Embedded]]

Revision as of 13:45, 12 September 2017

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.