Friday, October 24, 2014

Install Debian over a serial console

Debian can be installed using the serial console.

First, if you're doing this via serial over LAN (SOL), you'll need to have enabled and configured it in the BIOS.

Next, boot the installer. When the installer boots, it loads into a GUI which will appear as a white screen to the serial console. Press ESC here to get to a boot: prompt, and then enter the following:

install console=ttyS0,115200n8

Adjust tty and baud values to match the values you configured in the BIOS. Now press enter, and you should see the text based installer start over the serial console.

Tuesday, January 21, 2014

Creating a bootable Windows 7 installation USB stick from an iso in Linux (or, compiling ancient unetbootin for fun and profit)

I had to create a bootable Windows 7 installation USB stick from an iso image on a Debian Wheezy machine. This wasn't as simple as it should have been, because:


  1. Windows installation media has to be NTFS
  2. Current versions of unetbootin don't recognize NTFS USB media
The solution was to download source code for an older version of unetbootin (494), compile to allow for 64 bit execution, and then create the bootable installer.

The version of unetbootin in Wheezy's repos (and the current version of unetbootin) doesn't recognize NTFS drives and removed the option to show all drives. Older versions of unetbootin have this option, so we need to grab an older version (494).

Head to the download page for the old 494 version:

http://sourceforge.net/projects/unetbootin/files/UNetbootin/494/

If you're running a 32 bit machine you should consider a new computer, but you can just download the 32 bit unetbootin-linux-494 build from that page and skip the below compiling steps.

If you're running 64 bit, you need to compile the source locally as unetbootin doesn't offer precompiled 64 bit Linux builds (at least none that I found). Download the source tarball (unetbootin-source-494.tar.gz), unpack, install compilation requirements, and install:

wget http://sourceforge.net/projects/unetbootin/files/UNetbootin/494/unetbootin-source-494.tar.gz/download
mkdir unetbootin-source
cd unetbootin-source
tar zxvf unetbootin-source-494.tar.gz
sudo aptitude install qmake libqt4-dev
./INSTALL

Now you should have a unetbootin executable compiled for your architecture. If you want, you can install it, something like:

sudo mv unetbootin /opt/unetbootin-494
sudo ln -s /opt/unetbootin-494 /usr/local/bin/unetbootin

Now run unetbootin as root:

sudo unetbootin

Select your Windows 7 installer iso, check "Show All Drives", select your NTFS formatted USB stick partition (be careful!), and hit OK. When unetbootin finishes, you should have a bootable Windows 7 installation USB stick.

For more information on creating an NTFS partition on the USB drive and using unetbootin, see this blog post.

If you'd like to see NTFS supported added to unetbootin, please vote for the issue here:

https://bugs.launchpad.net/unetbootin/+bug/1125219

Random albums with Music On Console (moc)

Music On Console (moc) is a great, simple console based music player for Linux/Unix. It follows the Unix philosophy of doing one thing well (playing audio files), and is a refreshingly clean alternative to other feature bloated media players.

One feature I missed in moc is the ability to play a random album with a single command. Assuming your music directory has an artist/album hierarchy, random albums can be played with the following Bash command (replace /media/store/music with the root path of your music directory):

find /media/store/music/* -mindepth 1 -maxdepth 1 | shuf -n1 | xargs -I{} mocp -cap "{}"  

Launch using your favorite keyboard media key for extra goodness.