Wednesday, November 18, 2015

Arch Linux Chroot on Steam Link (Manual Setup)

Note: If you don't have access to a Linux desktop you can use this method instead.

I'm going to try and help you guys setup an Arch Linux chroot environment on your steam link. If you don't know what SSH or Linux is then this post isn't for you. First things first you'll need to have ssh access to your steam link. Below I'm going to detail setting this up with my pre-created tar file on a Linux desktop, if you don't want to use my premade one I'll detail how I made it at the end. If you're on Windows just wait it out, I'll do a post for it later.

First you'll need a separate pendrive or usb hdd to run the chroot environment on. You need to format this harddrive/pendrive to have an ext4 partition on it that the chroot will be on. You'll need to make this partition at least 1GB, the extracted tar file is roughly 700Mb but you'll want some spare room for pacman updates ect. After you've created your ext4 partition mount it on your desktop and un-tar the steamlink-chroot.tar.gz above onto the new ext4 partition. So the root of the ext4 partition will have one file and one folder: chrootdir and 

After you've correctly done the above you can un-mount the ext4 formatted drive and insert it into your steam link. Then SSH into the Link and do `busybox sh` this will switch you to the busybox shell instead of the ash shell which doesn't have tab completion. So now any directories or commands you need to type in you can hit tab to auto-complete them. Now `cd /mnt` to go into the mnt directory and create a folder to mount your drive onto (`mkdir chroot`). Then `cd chroot` to go into the drive and do `ls` to make sure your script is there. Now you can do `./dochroot` and it should drop you into your new Arch Linux chroot. `pacman -Syu` will update your install. When you're done with the chroot hit Ctrl+D until it says 'Syncing filesystem...' that way you wont lose any data in your chroot. Now you can close the SSH session.

Be sure to read the Arch Linux Wiki for any questions about Arch Linux.

So the reason why I had to tar up a bootstrap for you guys is because the Steam Link doesn't ship with bash so the arch-bootstrap script doesn't run on the vanilla system. In order to get it to run to setup the initial bootstrap I had to download bash and all its dependencies from the archlinuxarm site. If you want to setup the bootstrap yourself without my premade tar file then download: bash, glibc, ncurses, and readline from the archlinuxarm site above. Then set your LD_LIBRARY_PATH to /lib and the usr/lib from the packages downloaded above. Now you should be able to do ./usr/bin/bash -a arm to create your initial bootstrap. After that's done you'll want to use my file in the steamlink-chroot.tar or manually mount dev, proc, and sys into your chroot environment. A fun note for those who notice, /home/steam/usbip has the usbip userspace tools and the kernel modules in it. In the future I'll try and make a post about using usbip to use any USB device with your steam link. Like headsets and maybe even the xbox one controller if I can get usbip to cooperate on windows. Basically anything that already works on your host machine through BPM should work through usbip.