ArchBang on an External USB Drive

2014-03-03--1393792640_1920x1080_scrot

ARCHBANG. Not to be confused with the South Park Boy Band FingerBang.

Name+_3b14a3f06171d90a4c53486cbae394f9

I decided that one tool missing in my magic bag of tricks was a Linux distribution installed on a USB stick that was bootable. I like the idea of having a full distribution configured the way I want for use on the road. It’s like carrying a small computer around in your pocket. Also you can use it to fix an existing computer or retrieve data from it if it won’t boot (provided the hard drive is still functional).

So obviously to run linux off an external drive the distribution needs to be lightweight and fast. Not some huge bloated OS. And it needs to be configurable so I can add the pieces of software I need and only the stuff I need.

I looked at some options before settling on ArchBang. There are plenty of Linux distros that fit the bill like Damn Small Linux, and Puppy Linux. Lubuntu is another decent choice. I settled on ArchBang because I use Arch on another computer however Arch is a bear to install. ArchBang, not so much. But be forewarned, almost nothing works out of the chute after an ArchBang install. You need some command line skills to pull this off.

First download ArchBang from here. If you aren’t sure which file to install get the i686 version. You’ll want that if you’re going to install on a lot of unknown computers. If you just use it at home or you know the computers that you might use support the x86-64 bit architecture grab the other file.

I did this from a Mac but you can do it from any platform.......burn the iso image that is. It will either need to go on a DVD or another flash drive. I burned it to a DVD using Disk Utility in Mac. Drag the iso image to the sidebar and click burn. (My burn button is grayed out because I don’t have my DVD plugged in. Just showing it for demonstration purposes.)

Screen Shot 2014-03-03 at 8.54.47 AM

After your DVD is burned put it in your target computer and boot. During my boot process I have to press F12 and tell the computer to boot from CD. I have a Dell Laptop. Your process may be different depending on your computer maker.

Anyway boot the installation media and install your USB drive.

You will boot into an ArchBang live desktop. You can test ArchBang all you want here but the things you install and configure will not survive the reboot. What we want to now do is use the live image we’ve booted into to install ArchBang to the USB hard drive.

2014-03-02--1393751136_1920x1080_scrot copy

Open a terminal and type

lsblk

take note of your USB drive. Mine ends up being /dev/sdb

MAKE SURE YOU DON’T FOUL THIS UP. CHOOSE THE WRONG /dev/sdX AND YOU’LL WIPE THE HARD DRIVE OF THE COMPUTER YOU ARE USING. YOU HAVE BEEN WARNED!

Now this is easy.

Right click on your desktop and a floating menu will pop up. Navigate to, yep, you guessed it, “INSTALL”.

2014-03-03--1393817628_1920x1080_scrot

A terminal type graphical installer will pop up with 5 commands you can highlight and hit enter to proceed.

2014-03-03--1393817702_603x400_scrot

1. Set Date and Time
2. Partition Hard Drive
3. Install
4. Configure
5. Install Bootloader

Most of this is pretty self explanatory.

I had some issues at the partition hard drive step, actually it went fine however the boot loader (GRUB) would fail to install.

Found a workaround somewhere. Boot into your arch live install, open a terminal and type

sudo passwd root

set a password for root.

Now in the terminal type

su

add root password you just set then type.


gparted



This opens Gnome Partition program. MAKE SURE YOU MAKE CHANGES TO THE RIGHT DRIVE. Again mine was /dev/sdb. Make sure you know which one is yours. BIG NOTE HERE.......IF YOU LOOK CLOSE AT THE NEXT FEW PHOTOS MINE SAYS /dev/sdc. THAT IS BECAUSE I TOOK THESE SCREENSHOTS AFTER THE FACT TO MAKE THIS TUTORIAL. WHEN I DID THE INSTALL IT WAS /dev/sdb.

SEE HOW EASY IT WOULD BE TO SCREW SOMETHING UP!


Delete whatever partitions you have then you need to write a new partition table. Select “Device” then “Create Partition Table” then I selected MSDOS as the table type. Apply these changes then back in the install routine go to step 2 which is where we’ll make our partitions. The image below shows you where to invoke “Create Partition Table” and does not depict a hard drive with no partition. Again, I took these screenshots after I did the install.

2014-03-03--1393819961_1920x1080_scrot

The installer uses a program called cfdisk to make partitions. Here are what my two partitions look like after the fact.

2014-03-03--1393817763_582x374_scrot

2014-03-03--1393817799_578x370_scrot

I opted to have one big partition and one smaller swap partition. My USB drive is 320 gigabytes. I made a 300 gig sdb1 and a 20 gig linux swap file (/dev/sdb2). Yes, that is too big for a swap, I know. I have plenty of space here though. Actually just make them both primary partitions, and set the bootable flag on the first partition (dev/sdb1).

Now it will ask you where to install the swap file. AGAIN MAKE SURE YOU SELECT THE RIGHT DRIVE.

I chose /dev/sdb2 Then it asks where to install /root at. /dev/sdb1 AGAIN I CAN’T STRESS ENOUGH IF YOU PICK THE WRONG DRIVE YOU’LL OVERWRITE YOUR COMPUTER AND NOT YOUR USB DRIVE.

One this is done now go to step 3 which is “Install”.

It will take care of the whole install for you.

In Step 4 you’ll select your root password and set your user among other things but that’s really the only things I configured.

Now at Step 5 select GRUB as your boot loader and install it to /dev/sdb

If all goes well it will come back and tell you it installed correctly. If that is the case you can type

reboot

in your terminal and again make sure you boot into your BIOS and tell the computer to boot from USB. You should have a working installation of ArchBang Linux.

Make sure you are connected to an ethernet connection and we’ll get pacman working so you can upgrade and install things. That’s right. The package manager pacman, maybe the most important part of Arch doesn’t work right out of the chute. You gotta make it work.

In a terminal type

ping 8.8.8.8

This makes sure you have internet connectivity.

Now type

pacman-key --init

This takes a bit then when it finishes type

pacman-key --populate archlinux

now check it by issuing an update command

pacman -Syu

If this didn’t work you may need to go to

nano /etc/pacman.d/mirrorlist

and uncomment a mirror. I live in Japan so I went to Japan and uncommented one of the two Japan mirrors.

Then

pacman -Syy

Should update your mirror list and it should for sure be working now.

You should be ready to rock and roll and add packages. I added SAMBA, gvfs, gvfs-smb, chromium, pcmanfm file manager, thunderbird email, etc. Got my wifi working as well.

Anyway, that’s on you........configure it like you like.

LOGITECHMEDIASERVER


I’m a logitechmediaserver junkie. I love streaming Pandora, Spotify and TuneIn Radio and having all my computers act as Squeezeboxes. If you don’t know what a Squeezebox is you should Google. Fantastic product that ultimately went away yet lives on through the Open Source Community somewhat. Enough of that.

You’ll find details of my installation on another Arch computer here. And you’ll find details of the player Squeezelite installation here.

In a nutshell here is the LMS directions.


NOTE: All pacman commands must be done as root or su. All other commands should be done as your user unless otherwise required.

First I had to install wget to get the source code.

pacman -S wget

Then

wget https://aur.archlinux.org/packages/lo/logitechmediaserver/logitechmediaserver.tar.gz

tar -xf logitechmediaserver.tar.gz

cd logitechmediaserver

Then it got tricky the next command was supposed to be

makepkg --asroot

Didn’t work. Failed and said this:

john@arch logitechmediaserver]$ makepkg
==> ERROR: Cannot find the strip binary required for object file stripping.
[john@arch logitechmediaserver]$



So I had to go to the Arch Wiki page on makepkg and it said to first install base-devel

pacman -S base-devel

then I ran

makepkg --asroot

again and it told me there were three dependencies needed

==> Making package: logitechmediaserver 7.7.3-2 (Tue Feb 25 16:39:39 JST 2014)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Missing dependencies:
-> nasm
-> yasm
-> subversion
==> ERROR: Could not resolve all dependencies.

So then I did:

pacman -S nasm yasm subversion

then

makepkg --asroot

It took a LONG time to compile. About an hour. Once compiled then you need to install

pacman -U logitechmediaserver-7.7.3-2-x86_64.pkg.tar.xz

Now you’ll want to start it and enable it at boot (as root)

systemctl start logitechmediaserver

and / or

systemctl enable logitechmediaserver.service


Essentially it all worked the same however when I went to play a stream it would start, emit no music and then the player would stop.

After fiddling with things and reading a hundred posts and web pages I determined I needed some dependencies. I did the following and I’m not sure which one worked and some of them were already installed so mind you my procedures here aren’t perfect but I’m listening to music now. Type the following 5 commands:

pacman -S alsa-lib

pacman -S flac

pacman -S libmad

pacman -S mpg123

pacman -S faad2

And then it works. This is what LMS looks like in the Chromium Browser. And in reverence to the Kids from South Park I named the Squeezelite Player “FingerBang”.

Image 1-18-15 at 8.09 PM

Squeezelite

Again Squeezelite instructions are here about halfway down the page.