Home » Linux » Building My Linux Box…The Implementation

Building My Linux Box…The Implementation

Ubuntu 13.04 Raring Ringtail
In an earlier post, I outlined my plan for building a Linux Box.  Here I will post how that plan was ultimately implemented. Life has taught me that all good planning is ultimately undone, and at some point, you must improvise.  That has also proven true for this quest to up grade my computation.  Specifically:

    • After ordering all the hardware, it came to me that it was dumb to attempt to reuse my old semi-reliable, slow CD drive.  So I purchase the HP 24X Multiformat DVD/CD Writer (dvd1260i) at Best Buy for $40.
    • I discovered that the my old PC had ATA hard drives (commonly called an IDE drive) and my new Mobo only supports SATA (SATA 3Gb/s & 6GB/s and it includes an external eSATA port).   This blows my plan to reuse my existing hard drives … stupid me, I should have checked.  I did a quick scan for ATA controller cards and found a few (not many) for $15 to $30.  I could buy the card and make this work but it doesn’t seem like a good investment.  The drives are 400G drives and has a maximum data transfer rate of about 133MB/s (i.e. ATA/66).  The maximum data transfer rates of SATA II and SATA III are 300 MB/s and 600 MB/s, respectively.  I can buy a Seagate – Barracuda 500GB SATA II Internal Hard Drive for $70.  Given my objective to increase the performance of my computing experience, buying a new SATA III hard drive should have been part of the original plan.
    • After reading up on RAID and the Intel Rapid Storage Technology (RST), I concluded that it would be best to do a Software Raid and not use RST.
    • While I assumed in my original plan that I would dual boot the box with Linux and MS Windows, the comment from armahillo convinced me of what I suspected I should do; and that was to make winemono, and PlayOnLinux work for me.  While I haven’t stressed them, so far so good.  I have not installed VirtualBox and I suspect I will not … unless I get desperate.
    • I was planning to reuse my old keyboard and mouse, but you know, I hated that keyboard and the mouse was already acting badly and about to die on me.  So I ended up replacing them with sometime worthy of my new system.

Configuring Ubuntu

You’ll find many recommendations on how to jazz up a newlly install Ubuntu system.  I found some of these suggestions useful:

Installing “dot” Files

Like may, over the years I have made a large time investment in tuning my .bashrc, .vimrc, and other such resource files.  I installed my beloved “dot” files from my Git repository.

Installing Google Chrome’s Native PDF Reader in Chromium

Chromium is a fully open-source version of Google’s Chrome, and for licensing reasons, it doesn’t come packaged with the integrated Flash or a native PDF reader.  Lucky, there is a work around and that is documented here: Use Google Chrome’s Native PDF reader in Chromium.

Installing My Squeeze Box

I have a SqueezeBox device in my workshop for playing music.  On my old PC, I had installed the SlimServer which would provide the music stream.  I want to now reestablish that capability on the Linux box. The post How to Use Squeezebox With Ubuntu and the Logitech SqueezeBox Wiki gives you all the information you should need.

The Ubuntu (Debian) software for the SqueezeCenter or now called the Logitech Media Server (formerly known as SlimServer) is maintained by Logitech, and therefore, will not be installed via get-apt.  To make it part of the package resource list (used to locate archives of the package distribution system in use on the system), you need to update the sources.list file.  To do this, do the following:

sudo vim /etc/apt/sources.list

Scroll to the bottom of the file and enter the following information and then save:

## This software is not part of Ubuntu, but is offered by Logitech for the Logitech Media Server (formerly known as SqueezeCenter or SlimServer).
deb http://debian.slimdevices.com stable main

Now do the following:

sudo apt-get remove --purge logitechmediaserver
sudo apt-get update
sudo apt-get install logitechmediaserver

Now open a browser and type “http://desktop:9000” as the URL, where “desktop” is the name of your Linux system.  This brings you to a Squeezebox interface to configure the system.

If you want to start/stop Logitech Media Server manually you can run:

sudo /etc/init.d/logitechmediaserver stop
and
sudo /etc/init.d/logitechmediaserver start

Setting-Up Harmony Remote

I have the Logitech Harmony 650 Universal Remote Control for my home theater system.  To program the device, it must be tethered to a web site via a Windows or Mac PC.  The Harmony web site does reference some Linux support done by others.  The posting “How to set up a Harmony remote using Linux” and “Logitech Harmony Universal Remote Linux Software Support” give you the basics of what you need to do.  Within these sites you lean about the utilities concordance and congruity. The first utility provides most of the functionality of the Windows software provided by Logitech and the second is a GUI application for programming Logitech Harmony remote using concordance.  To install these utilities, do the following:

sudo apt-get install concordance
sudo apt-get install congruity

You also have to configure the web browser to ask what to do with download links. It is best to use Firefox and you can configure downloads via: Edit->Preferences->General->Downloads->Always ask me where to save files.

Now plug the remote into the PC using the provided cable, and enter the command: sudo concordance -i -v.  You should get a bunch of data and the word “Success”, verifying that you can talk to the device.

Now go through the following process:

    1. Plug in the remote via the provided USB cable.
    2. Visit the Harmony Remote’s member site URL.  This appears to be a legacy support site and Logitech site listed in the documentation with the device will not work under Linux.
    3. Create an account or login into your existing account.
    4. Skip/ignore the “you need to update your software” steps, and eventually a download prompt appears.
    5. Choosing ‘open’ rather than ‘save’ impressively results in the Congruity graphical setup up launching.
    6. Step through the setup boxes as prompted.

Setting-Up Keyboard & Mouse

Logitech Wireless Illuminated Keyboard K800 To improve my driving experience, I purchased the
Logitech Wireless Illuminated Keyboard K800and the Logitech M510 Wireless MouseLogitech M510 Wireless Mouse.  These devices use the Logitech Unifying wireless technology, which allows a single wireless receiver to connect with multiple Unifying devices.  I plugged in the mouse’s receiver  and in short order the mouse was working.  I was a bit concerned about the ability of the receiver to support multiple device (i.e. the keyboard) simultaneously under Linux.  Doing a quick search I found a post discussing how to do the device pairing under Linux.  To install the ltunify pairing software, and do the pairing, do the following:

cd ~/src
git clone https://git.lekensteyn.nl/ltunify.git
cd ltunify
make install-home

To list the devices that are paired: sudo ltunify list
To pair a device: sudo ltunify pair, then turn your wireless device off and on to start pairing.
To unpair a device: sudo ltunify unpair mouse
To get help: sudo ltunity --help

Mouse Xbindkeys

The M510 mouse has extra buttons on its left side and the scroll wheel  has a side-to-side click, but out of the box,the don’t do anything under Linux.  It would be nice to make use of these extra buttons.  To address this problem, I found pointers in these posts: How to get all those extra mouse buttons to workHow do I remap certain keys,  Mouse shortcuts with xbindkeys, and Guide for setup Performance MX mouse on Linux (with KDE).

Basically, using Xbindkeys, I want to map the mouse buttons with desired actions. I want to setup the M510 mouse extra buttons as follows:

    • Left-side Buttonup mapped to Page Up and down mapped to Page Down
    • Scroll Wheelmove left mapped to Copy and move right mapped to Paste
    • Scroll Wheelpress mapped to Paste

xev prints the contents of X events by creating a window and then asks the X Server to send it events whenever anything happens to the window.  It’s sort of a keyboard and mouse events sniffer.  If we know what event name the X Server gives to our buttons, then we can remap them. Using this program, we find out the following:

    • Left-side Buttonup is known by the X Server as button 9
    • Left-side Buttondown is known by the X Server as button 8
    • Scroll Wheelmove left is known by the X Server as button 6
    • Scroll Wheelmove right is known by the X Server as button 7
    • Scroll Wheelpress is known by the X Server as button 2

Now we need a mechanism to re-map mouse (or keyboard) button inputs.  Xbindkeys is is a X Windows program that enables us to bind commands to certain keys or key combinations on the keyboard and it will also work for the mouse.  The file  ~/.xbindkeysrc is what xbindkeys uses as a configuration file to link a command to a key/button on your keyboard/mouse.  There is also xbindkeys_config is an easy to use gtk program for configuring xbindkeys. To install these tools, do the following:

sudo apt-get install xautomation xbindkeys xbindkeys-config

To create your initial xbindkeys configuration file, just run the following command:

xbindkeys --defaults > $HOME/.xbindkeysrc

The syntax of the contents of .xbindskesrc is simple and is illustrated below:

# short comment
    "command to start"
        associated key

The "command to start" is simply a shell command (that you can run from a terminal),  and "associated key" is the key or button.

Now, using an editor, update the .xbindkeysrc file to include the following:

# Do a Page Down when mouse left-side down button is pressed
"xte 'key Page_Down'"
    b:8
# Do a Page Up when mouse left-side up button is pressed
"xte 'key Page_Up'"
    b:9
# Move scroll wheel to the left to copy text
"xte 'keydown Control_L' 'keydown Shift_L' 'key c' 'keyup Control_L' 'keyup Shift_L'"
    b:6
# Move scroll wheel to the right to paste text
"xte 'keydown Control_L' 'keydown Shift_L' 'key v' 'keyup Control_L' 'keyup Shift_L'"
    b:7
# Press scroll wheel to paste text
"xte 'keydown Control_L' 'keydown Shift_L' 'key v' 'keyup Control_L' 'keyup Shift_L'"
    b:2

To activate any modification of the .xbindkeysrc configuration file, your have to restart xbindkeys.   This can be done via:

pkill xbindkeys
xbindkeys

Other useful resources are:

    • xte is a program that generates fake input using the XTest extension
    • xvkbd is a virtual (graphical) keyboard program for X Window System which provides facility to enter characters onto other X clients by clicking on a keyboard displayed on the screen.
    • xbindkeys_show is a program to show the grabbing keys used in xbindkeys
    • xmodmap is a utility for modifying keymaps and pointer button mappings in Xorg.

Moving from SplashID to KeePass

I have been using the MS Windows based SplashID to store passwords, credit cards, account numbers, etc. securely on my PC and cell phone.  I got it to work under Wine but I’m considering Linux alternatives.  I’m growing tired of purchasing SplashID licenses and the user interface looks like it was designed in the 1970’s.  I came across “Five Best Password Managers” which gave me the incentive to check out KeePass.  KeePass is a cross platform, open source password manager.  It is extendable via its plugin framework, where additional functionality can be added.  It looks like I can use Dropbox and KeePassDroid to get the data on my cell phone.  I found these sites useful to get the job done:

The first step was to get KeePass installed in Ubuntu.  I found it on the Ubuntu Software Center or you can use:

sudo apt-get install keepass2 keepass2-doc

I then exported the contents of my SplashID database to a CSV file and imported it into keepass2.  I set up the KeePass2 database within my Dropbox folder.  This way, it can be scych’ed with my cell phone. I then installed KeePassDroid on my cell phone, pointing it at the database with the cell phones Dropbox.  KeePassDroid is a port of the KeePass password safe for the Android platform.

There is some cleanup of the fields within the KeePass2 database, but the data is now accessable on both my PC and my cell phone.

Installing Wine

Wine allows you to run many Windows programs on Linux. Instead of simulating internal Windows logic like a virtual machine or emulator, Wine translates Windows API calls into Linux calls.  I used the following to install Wine:

sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine

Using Wine on Windows programs can be as simple  or complex, it all depends on the program.  Ubuntu provides some guidance on how to use Wine, also check out Wine Documentation and Wine HowTo.

As of this writing of the post, the only thing I loaded via Wine was SplashID, which worked without any challenges.

Installing PlayOnLinux

PlayOnLinux is based on Wine, and so profits from all its features, yet it keeps the user from having to deal with all its complexity.  I also install this package, in part because it comes pre-configured to load some popular tools.  I used it to install Internet Explore (sometimes its the only browser you can get to work on a site), and Kindle.

Installing RAID

RAID is an acronym for Redundant Array of Independent Disks and RAID as the first tier in your data protection strategy. It uses multiple hard disks storing the same data to protect against some degree of physical disk failure. The amount of protection it affords depends upon the type of RAID used.  I’m not going to go into all the types of RAID, nor their benefits, but you can find much of this information, and much more, in the following links:

In my case, I had an existing disk drive (non-RAID), loaded with data, and I wanted to add an additional drive to make it a RAID.  This presents some challenges since you’re attempting to preserve the data.  In this regard, I found the following links helpful:

I had already installed one SSD and one HHD disk drives in my system.  I then installed a third drive that matched the HHD drive.  My 128GB SSD has the device name of /dev/sda1 and mounted as /boot.  The currently installed 1TB SATA HDD has the device name of /dev/sdb1 and mounted as /home.  The newly install 1TB SATA HDD has the device name of /dev/sdc.

Description of the procedures I used to create the RAID is as follows:

    • Physically install the additional hard drive.
    • Install mdadm, which is the Linux utility used to manage software RAID devices.

sudo apt-get install mdadm

    • Partition the newly installed disk. Use the following inputs: n to establish a logic partition, p to make it a primary partition, 1  should be the partition number, use the same sectors as the currently installed drive, t to set the partition type, fd hex code type, p to print what the partition table will look like, w to write all of the changes to disk.

sudo fdisk /dev/sdc

    • Create a single-disk RAID-1 array (aka degraded array) with the existing hard drive. (Note the “missing” keyword is specified as one of the devices. We are going to fill this missing device later with the new drive.)

sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdc1

    • At this point, if you do a sudo fdisk -l | grep '^Disk', you see a new disk, that being /dev/md0.  This is the RAID but not yet fully created.
    • Make the file system (ext3 type like the currently installed hard drive) on the RAID device.

sudo mkfs -t ext3 -j -L RAID-ONE /dev/md0

    • Make a mount point for the RAID and mount the device.

sudo mkdir /mnt/raid1
sudo mount /dev/md0 /mnt/raid1

    • Copy over the files form the original hard drive to the new hard drive using rsync.

sudo rsync -avxHAXS --delete --progress /home/* /mnt/raid1

    • Just  in case of a disaster, copy the original hard drive to the SSD /dev/sda1 root file system as /home_backup.

sudo rsync -avxHAXS --delete --progress /home /home_backup

    • After the copy, to see the status of the RAID, use the command sudo mdadm --detail /dev/md0.  What you see is that the /dev/sdc1 drives is in “active sync ” state but no reference to the other drive.  When you do cat /proc/mdstat you see “md0 : active raid1 sdc1[1]” but again no reference to the other drive.
    • Edit your /etc/fstab file and edit all references of /dev/sdb1 to /dev/md0 and reboot the system.  With this, /dev/md0 will be used as /home on the next boot. This will free up the existing hard drive so it can be made ready for the RAID.
    • With fdisk, re-partition /dev/sdb1 with a partition of type fd. Use the following inputs: n to establish a logic partition, p to make it a primary partition, 1  should be the partition number, use the same sectors as the currently installed drive, t to set the partition type, fd hex code type, p to print what the partition table will look like, w to write all of the changes to disk.

sudo fdisk /dev/sdb1

    • Add /dev/sdb1 to your existing RAID array.

mdadm /dev/md0 --add /dev/sdb1

    • The RAID array will now start to rebuild so that the two drives have the same data. Use the following command to check the status of the rebuild.

sudo mdadm -D /dev/md0

    • For Ubuntu, it seems it is also necessary to update the /etc/mdadm/mdadm.conf file. If this is not done, the RAID device will not be mounted when you reboot the system. The solution is to run the following command on your system, once the RAID drive has been configured:

sudo cp /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf_backup
sudo mdadm --detail --scan >> /etc/mdadm/mdadm.conf


2 Comments

  1. […] Building My Linux Box…The Implementation August 1, 2013 […]

  2. Our Homepage says:

    Howdy, i believe that my partner and i found anyone frequented this website so i obtained listed here to return the will? . I am searching for points to boost my personal site! Perhaps their ok to specific of your respective basics!

Leave a comment