HowTo: Stop GRUB preventing auto-start of the OS after a previous boot failure

A picture of a GRUB... geddit?

The GRUB boot menu by default will generally show its menu for about ten seconds before automatically booting the OS, but if something goes wrong, or an over-zealous party interrupts the boot process because he thought it had hung, the OS will tell GRUB that.

Now that’s all well and good, but GRUB’s default action in such an instance is to abort the automatic timeout and stay at the GRUB boot menu waiting for a manual action, such as entering recovery mode.

On systems that are unattended or without keyboards, this proves to be very annoying and generally you’d like the OS to boot up anyway despite the reported failure.

So here’s how you can fix it.

  1. First up, boot into your system and open a terminal.
  2. Now type in:
    $ sudo nano /etc/default/grub
    …and hit Enter. The Nano text editor will appear.
  3. In the file shown, scroll right to the bottom and add the following lines:
    # Timeout for a previous failed startup. GRUB_RECORDFAIL_TIMEOUT=10
  4. Now press CTRL+X, then “Y” and then Enter to save your changes.
  5. Now update your GRUB configuration with the new option we added with:
    $ sudo update-grub
  6. Pat yourself on the back. You’re done.

So what did we just do? Simple, we added a new configuration item that tells GRUB that in the event of a reported previous failure, display the GRUB menu as before, but this time apply a ten second delay before booting the default menu item anyway.

The ten seconds will give you time to interrupt it and go to recovery if necessary, but there’s no reason why you wouldn’t set this to a much lower time if you wanted to, such as 2 seconds or less. 

HowTo: Install Flumotion Streaming Server on Ubuntu 14.04

Flumotion Logo

EDIT: Flumotion is no longer suitable for modern Ubuntu distros such as Ubuntu 18.04 or 20.04 onwards. Use MistServer instead.

Flumotion Streaming Server is a great open-source application that is available in the Ubuntu repositories that can easily allow you to broadcast a live stream from a video camera, or broadcast pre-recorded media. The end-user can view this media in any capable HTML5 web browser such as Google Chrome.

Unfortunately Flumotion (version 0.10.0-1 at the time of writing) relies on some deprecated Twisted Python network functions that prevent the software from working properly on any release of Ubuntu from 13.04 and upwards.

The obvious solution is to simply install Flumotion under Ubuntu 12.04 but then you will find that Flumotion in the 12.04 repository is buggy and out of date anyway, requiring you to update Flumotion from the official developer PPA to the stable release that is already in Ubuntu 14.04.

There is a way to get Flumotion working properly under Ubuntu 14.04 however, without too much fuss. Essentially all you need to do is downgrade the three affected Twisted Python packages down to 11.1.0, which is the version from Ubuntu 12.04.

Here’s how you do it.

WARNING: Ubuntu has a high reliance on Python. By downgrading to an older release, you run the risk of other parts of Ubuntu that rely on Python either breaking or behaving unusually.

So far I have only found the Flumotion Assistant UI to suffer some minor issues with rendering text fields, preventing you from adding values for things like framerate which will upset Flumotion because that data is missing, but you should be able to get around it by generating the XML configuration elsewhere (I will update this article in due course once I’ve done more testing).

I would recommend that you dedicate a PC to be used as your Flumotion server so you don’t have to install other applications or regularly have to perform updates.

Please also be aware that the next time you perform a package update, Python is likely to be upgraded to the current release automatically again, but you can follow these instructions from Step 3 to downgrade Python again afterwards.

  1. First up, install Flumotion as normal:

    $ sudo apt-get install flumotion
  2. Once it is installed, we now need to download three Python packages from Ubuntu 12.04 that we are going to downgrade to:

    $ wget -c http://au.archive.ubuntu.com/ubuntu/pool/main/t/twisted/python-twisted-bin_11.1.0-1ubuntu2_amd64.deb
    $ wget -c http://au.archive.ubuntu.com/ubuntu/pool/main/t/twisted/python-twisted-core_11.1.0-1ubuntu2_all.deb
    $ wget -c http://au.archive.ubuntu.com/ubuntu/pool/main/t/twisted-web/python-twisted-web_11.1.0-1_all.deb


    (Note: If you are using 32-bit Ubuntu, change “amd64″ to “i386″ for the “python-twisted-bin” download)
  3. Now we need to uninstall the newer version of Python components that is currently installed without uninstalling the applications that rely on it (basically we’re going to force the system to break its dependencies):

    $ sudo dpkg -r --force-all python-twisted-bin python-twisted-core python-twisted-web
  4. Now let’s install our replacement downloaded packages:

    $ sudo dpkg -i *.deb
  5. Finally, let’s restart Flumotion:

    $ sudo service flumotion restart

That’s basically it. You can now start the Flumotion Administration interface and this time the Manager and Workers will all start without an issue this time (login with the default username and password of “user” and “test” respectively).

As before, remember that installing future system updates to the system will automatically upgrade the three Python packages we just changed to their current releases which will break Flumotion, so just go back to step 3 to undo that and reinstall the older packages.

This issue will be resolved once Flumotion is updated to no longer use the deprecated network-related functions in Twisted Python.

Pat yourself on the back. Job done.

HowTo: Install the XScreensaver packages on Ubuntu

The XScreensaver packages are a series of fancy alternate screensavers that have a popular history. They are much more enjoyable than the boring default Ubuntu screensaver which is just… a black screen.

The Hypertaurus XScreensaver

Unfortunately the XScreensavers package hasn’t really been updated in awhile and doesn’t integrate very nicely into the current flavours of Ubuntu without some manual tweaking, so that’s exactly what I’m going to cover right here.

Issues to deal with

This document will cover the following:

  • Installing the XScreensaver packages Configuring Ubuntu to use XScreensaver instead of the default gnome-screensaver
  • Configuring Ubuntu to lock the screen with the XScreensaver
  • Fixing the bad fonts issue in XScreensaver Setting a custom RSS feed for text-based XScreensaver packages

These instructions have been tested on Ubuntu 12.04 (Precise Pangolin) and 14.04 (Trusty Tahr).

Making it happen

  1. Open a terminal.
  2. Uninstall the boring default Ubuntu screensaver with:

    $ sudo apt-get remove gnome-screensaver
  3. Install the XScreensaver packages with:

    $ sudo apt-get install xscreensaver*

    (note the asterisk on the end to install all xscreensaver packages)
  4. Open the Dash (Ubuntu logo at the top-left of screen) and type in the word “start”. An icon will appear referring to “Startup Applications”. Click on it.
  5. The window that appears shows which applications will be started when you login to your machine. Click on the “Add” button.
  6. In the new window that appears, type “XScreensaver” into the Name field, then type in “xscreensaver -nosplash” into the Command field, then type in “Start the XScreensaver” into the Comment field.
StartupApps
  1. Click on the “Add” button and then click on the Close button on the previous window.
  2. That takes care of starting the XScreensaver, so now let’s fix the lock screen keyboard shortcut. Click on the Dash again and type in “keyboard” and then click on the “Keyboard” icon.
  3. In the window that appears, click on the “Shortcuts” tab.
  4. At the bottom of the left pane, click on “Custom Shortcuts”.
  5. Click on the “+” button to add a new custom shortcut.
  6. Give the shortcut a name, eg: “Enable the lockscreen”.
  7. In the Command field, type in “xscreensaver-command -lock” and then click on the Apply button.
  8. You will now see your new shortcut listed, but it doesn’t have a keyboard combo for it yet, so click on the word “Disabled” with your mouse and it will change to “New accelerator…”.
  9. Now using your keyboard, press the key combo you’d like to use to lock your PC and start the XScreensaver. The default combo is CTRL+ALT+L but you can use any combo you like. If you do use CTRL+ALT+L you will be told that it’s already in use by the Gnome-Screensaver (which you uninstalled earlier, remember?), so just tell it to reassign it to your shortcut.
LockScreenKeyboardCombo
  1. Close the keyboard settings window.
  2. Now we need to sort out the fonts. The way XScreensaver looks for fonts is not like any other application. It needs to have a predefined list of available fonts, so we need to provide that list. We will get the “Ubuntu Font Family” (that comes with current releases of Ubuntu) enabled for use in XScreensaver, but you can apply this to any of the font folders on your machine.
  3. In your terminal, type in the following:

    $ cd /usr/share/fonts/truetype/ubuntu-font-family
    $ sudo mkfontscale
    $ sudo mkfontdir

  4. Repeat the above for all the fonts you wish to add to your system, eg: substitute the path /usr/share/fonts/truetype/msttcorefonts for the Microsoft fonts from the ubuntu-restricted-packages meta-package or the ttf-mscorefonts-installer package.
  5. Create a new file (or edit any existing file) as follows:

    $ sudo nano /usr/share/X11/xorg.conf.d/50-fonts.conf
  6. Type/paste in the following into your new file:

    Section "Files"
        FontPath "/usr/share/fonts/truetype/ubuntu-font-family"
    EndSection

  7. Add as many FontPath entries you need between the Section/EndSection block for all the fonts you want available that you ran step 18 on.
  8. Save your changes with CTRL+X, then “Y” and then Enter.
  9. Now type in the following to enable the fonts now (or simply reboot):

    $ xset +fp /usr/share/fonts/truetype/ubuntu-font-family
    $ xset fp rehash

  10. Repeat the xset +fp <path> command as many times as required to add all the fonts you setup in Step 18 before the xset fp rehash command, or simply reboot to do them all in one hit from your X11 config file in step 21.
  11. Now we’re ready to fix the fonts in XScreensaver. In this example we’re going to fix the fonts in the StarWars screensaver. What exactly is wrong with the fonts in the StarWars screensaver I hear you ask?

    Simply this:
Ugly fonts in the StarWars screensaver
Yuck
  1. Click on the Dash and then type in “screensaver”. An icon called “Screensaver” will appear below it. Click on it.
  2. In the Screensaver Preferences window that appears, scroll down the list of available screensavers to find “StarWars”. Click on it to highlight it.
The XScreensaver Preferences Tool
  1. A preview of the screensaver will appear in the pane on the right. You will notice that the font in the screensaver looks awful as in the above image.
  2. Click on the “Settings…” button. A new window will appear.
  3. In the Settings window, click on the “Advanced>>” button at the bottom. The window content will change.
Star Wars Preferences Advanced Settings
  1. You will see the command line that starts the screensaver. Modify the line so that it looks like:

    starwars -root -font "-misc-ubuntu-bold-r-normal--180-0-0-0-p-0-iso8859-1"
  2. Click OK and repeat this modification to any other screensaver that uses a proportional font in its text, for example the FlipText screensaver.
  3. Finally, let’s set a custom RSS feed for the screensavers that use text so that they show something useful. Click on the “Advanced” tab in the Screensaver Preferences window.
Setting the RSS Feed for the XScreensaver
  1. At the bottom-left in the “Text Manipulation” section, make sure “URL” is selected and change the URL text to your favourite RSS feed’s URL, for example ITNews’ RSS feed for “all content” is:

    http://www.itnews.com.au/RSS/rss.ashx
  2. Test the StarWars screensaver now by clicking on the “Display Modes” tab and then select “StarWars” from the left pane to make it appear in the preview window. The time the fonts should look much nicer as follows:
Much nicer
Much nicer!
  1. Now go through the list of screensavers, enabling and disabling those that you want to use. As you click each one, its preview will appear on the right.
  2. Set the Blank After, Cycle After and Lock Screen After values accordingly, eg: 10 minutes a piece.
  3. Close the Screensaver Preferences window and test locking your PC by pressing CTRL+ALT+L or whatever combo you set in step 15, and your screen should fade out and start displaying a random screensaver from your list of enabled screensavers. When you move the mouse or press a key, a login prompt should appear.
  4. Pat yourself on the back. You are done.

Choosing your own font to use instead of the Ubuntu Font Family fonts

  1. Choosing your own font is simple. For each set of fonts that you processed in Step 18, type in the following, using the Ubuntu Font Family as this example:

    $ cat /usr/share/fonts/truetype/ubuntu-font-family/fonts.dir
  2. This lists all the possible fonts available for that family. Copy to the clipboard the font description you wish to use.
  3. Paste the description as the font argument in the command line of the screensaver you wish to modify.Note that you will need to adjust the font size/quality value in your command line because they are rendered as scaled bitmaps, not outlines. For example, in Step 32 we specify the font size to be “180” so that the fonts appear smooth and clean when scaled. If you don’t specify this, then the font will be generated into a bitmap using the smallest size before being scaled up in the screensaver, resulting in pixelated fonts.

    SPECIAL NOTE: Some screensavers require proportional fonts to be used and others require fixed-width fonts. If you try to use the wrong type of font, the screensaver will likely crash.
  4. Choose the appropriate font type from the list of available fonts.
  5. Preview your screensaver and make adjustments as required. If you’d like to test the screensaver directly without running up the Preferences tool, launch the screensaver binary in a terminal with the font description as an argument.

    For example, for the StarWars screensaver, you can run it in a window as follows:

    /usr/lib/xscreensaver/starwars -font "-misc-ubuntu-bold-r-normal--180-0-0-0-p-0-iso8859-1"
  6. Pat yourself on the back again. You are done.

HowTo: Setup Darik’s Boot and Nuke (DBAN) to automatically erase storage devices via PXE boot

Darik’s Boot and Nuke (abbreviated as DBAN) is a popular tool used by many organisations and individuals to securely erase hard-drives prior to disposal, or perhaps just to fix Windows problems Smilie: ;) . It typically comprises a small 15MB ISO image that you can burn to CD or make a bootable USB stick from so you can boot up a PC on it and set about erasing all detected storage devices.

Erase HDD

When you’re doing a lot of machines, however, booting a CD is tedious, especially when you accidentally scratch the disc and need to burn a new one. Using a USB stick and either misplacing it, or forgetting to remove it before erasing starts means you lose the content of the boot stick too.

Wouldn’t it be nice to be able to simply boot DBAN from the network so it’s always available whenever you need it and have it automatically use your preferred options instead of being manually run each time?

Pre-requisites

  • A copy of DBAN. You can get it from the project site here. I will be using version 2.2.8 in this article.
  • A working Linux PXE server. If you’ve not built one before, you can use my previous guide here.
  • A sacrificial hard-drive or a virtual machine to test with. You will be completely destroying the data on the drive. When this exercise is over, there will be nothing recognisable on the drive so operating systems will typically recognise the drive as a brand new, never-before-used drive.
  • The PC housing the sacrifical drive needs to have the ability to boot from PXE. All modern computers built in the last 15 years should be able to do this.

Let’s get it going

  1. First up, we need to extract DBAN’s files from the ISO image since we’re not going to burn it to a disc. Open the downloaded ISO image in Archive Manager by right-clicking on it and choose “Open with Archive Manager”.
  2. Extract the following files: DBAN.BZI and ISOLINUX.CFG
  3. On your PXE server, assuming you have all your files under /srv/tftp as per my previous tutorial, make a new folder called “dban” under it:

    $ mkdir /srv/tftp/dban
  4. Now copy over the DBAN.BZI file you extracted in Step 1 to the /srv/tftp/dban directory. You don’t need to copy ISOLINUX.CFG because we’re simply using that for boot command reference.
  5. Now rename the file so that it’s all in lowercase:

    $ mv /srv/tftp/dban/DBAN.BZI /srv/tftp/dban/dban.bzi

    (We don’t actually need to do this, but since everything else in the Linux world is typically in lower-case, we may as well do the same here)
  6. Now make sure that the permissions are set for TFTP correctly:

    $ sudo chmod 777 -R /srv/tftp
  7. Now let’s setup a simple PXE menu boot option that is simply going to write zeros across all detected storage devices when you boot up on it (which is the fastest method of wiping while remaining secure). Open your PXE boot menu config file. If using my previous tutorial, then that will be:

    $ nano /srv/tftp/mybootmenu.cfg
  8. Scroll to the bottom (or insert where you’d like to have it) and add the following lines:

    LABEL Auto ^Nuke EVERYTHING With Zeros NOW! No Questions Asked!
    KERNEL dban/dban.bzi APPEND nuke="dwipe --autonuke --method zero" silent

  9. Press CTRL+X, then Y and then Enter to save your changes.
  10. Boot up your sacrificial system into PXE. When your menu appears, you should see a new entry called “Auto Nuke EVERYTHING With Zeros NOW! No Questions Asked!” and the “N” character will be highlighted to indicate the keyboard shortcut for it.
  11. Use the arrow keys or the keyboard shortcut to launch DBAN. It should boot quite quickly since it’s such a small application.
  12. You will see a lot of text appear while the system boots up, enumerating hardware and searching for storage devices. At this time, any attached direct-writable storage mediums such as hard-drives and USB sticks will become targets for DBAN. Network drives/shares and other PC’s on your network will not become targets.
DBAN_Booting
  1. Once the system has detected everything it can find, DBAN will begin. All detected storage devices will be listed on their own line and will show their erasure status. You will notice that all this starts automatically and with no further interaction from you.
  2. Once the system has completed erasing all devices, it will advise accordingly and halt the system. Your drives are now securely erased!
DBAN_Finished

Additional Options

So you might be wondering, what did we need the ISOLINUX.CFG file for if we weren’t going to use it? Will, this is just for your reference – it contains all the command line parameters for all of the other options that DBAN offers you for the truly paranoid data hoarder. Please note that these additional options are superfluous – hard-drives are magnetic devices that can only hold one set of ones and zeros. Overwriting the drive multiple times with sequential or random ones and zeros is not going to make the erasure any more or less secure. Once a drive is wiped with just one pass of ones or zeros or a random combo, it is impossible to recover any data from it, and you certainly cannot “unformat” it or “unwipe” it.

To save you some time, here’s a complete list of the extra options presented as a sub-menu for your PXE boot menu. Simply copy and paste it into your boot menu configuration, or pick and choose the options you want.

Note: To prevent accidental erasing of a system from PXE boot, the default menu option is set to run DBAN in manual mode where you are asked to choose which drives you wish to erase, which gives you a chance to back out.

# ================================================================
# BEGIN: SECURE HDD ERASE OPTIONS
# ================================================================

menu begin Secure HDD erase options
 menu title ^Secure HDD erase options
 label mainmenu
 menu label ^Back..
 menu exit

LABEL Auto ^Nuke EVERYTHING With Zeros NOW! No Questions Asked!
 KERNEL dban/dban.bzi
 APPEND nuke="dwipe --autonuke --method zero" silent

LABEL ^Manual Setup of Wipe Options
 MENU default
 KERNEL dban/dban.bzi
 APPEND nuke="dwipe"

LABEL ^Default 3-Pass Random Wipe (AUTO)
 KERNEL dban/dban.bzi
 APPEND nuke="dwipe --autonuke" silent

LABEL US Dept Defence ^Standard Wipe Method (AUTO)
 KERNEL dban/dban.bzi
 APPEND nuke="dwipe --autonuke --method dod522022m" silent

LABEL US Dept Defence ^3-Pass Wipe Method (AUTO)
 KERNEL dban/dban.bzi
 APPEND nuke="dwipe --autonuke --method dod3pass" silent

LABEL US Dept Defence Short Wipe Method (AUTO)
 KERNEL dban/dban.bzi
 APPEND nuke="dwipe --autonuke --method dodshort" silent

LABEL Peter ^Gutmann Wipe Method (AUTO)
 KERNEL dban/dban.bzi
 APPEND nuke="dwipe --autonuke --method gutmann" silent

LABEL ^RCMP TSSIT OPS-II Wipe Method (AUTO)
 KERNEL dban/dban.bzi
 APPEND nuke="dwipe --autonuke --method ops2" silent

LABEL ^Paranoid 8x Wipe with Full Verify (AUTO)
 KERNEL dban/dban.bzi
 APPEND nuke="dwipe --autonuke --method prng --rounds 8 --verify all" silent

LABEL PRNG Stream ^8x Wipe Method (AUTO)
 KERNEL dban/dban.bzi
 APPEND nuke="dwipe --autonuke --method prng --rounds 8" silent

LABEL ^Quick Wipe - Not 100% Secure (AUTO)
 KERNEL dban/dban.bzi
 APPEND nuke="dwipe --autonuke --method quick" silent

menu end

# ================================================================
# END: SECURE HDD ERASE OPTIONS
# ================================================================

Happy erasing! Smilie: :)

HowTo: Install the IBM Notes 9.0 client on Ubuntu 64-bit

IBM Notes (formerly Lotus Notes) is a corporate email and database collaboration tool. It’s still popular and widely used, and at the time of writing is now up to version 9.0.

IBM Notes 9 Logo

Unfortunately IBM have a bad habit of assuming no-one uses 64-bit operating systems (yes, even in 2014), so with the exception of the Apple OS X version which doesn’t have a 32-bit version at all, IBM continues to compile the Linux and Windows versions as 32-bit only applications.

Installing the 32-bit Linux version does not work on 64-bit Ubuntu/Debian systems “out of the box” because of some hard-coded 32-bit only pre-requisites. This article will describe how to modify the installer so that it will work on 64-bit systems.

Pre-requisites:

  • A copy of the full release of the IBM Notes 9.0 client package for Debian-based Linux distributions. This is a tar file. As this is commercial software, I obviously cannot provide you a link to this, but your company’s Notes Administrator will be able to source this for you.
  • A 64-bit Ubuntu system to install to. In this article, I will be using the desktop version of Ubuntu Linux 12.04.4 LTS.

PLEASE NOTE: This instruction does NOT work on Ubuntu 14.04 at this time due to missing 32-bit dependencies in the Trusty repository.

Process:

  1. Download the IBM Notes 9.0 package for Ubuntu/Debian Linux as normal. It’s a TAR file called NOTES_9.0_LINUX_DI_EN.tar (523MB). Only a 32-bit package is available.
  2. Extract the content of the tar archive into a working directory:

    $ mkdir notes9linux
    $ cd notes9linux
    $ tar -zxvf /path/to/NOTES_9.0_LINUX_DI_EN.tar
    $ ls -l


    You should have the following files:

    ibm-notes-9.0.i586.deb
    ibm-cae-9.0.i586.deb
    ibm-connections-4.5.0.i586.deb
    ibm-activities-9.0.i586.deb
    ibm-sametime-9.0.i586.deb
    ibm-opensocial-9.0.i586.deb
    licence.tar
    smartupgrade.sh

  3. Delete the “licence.tar” and “smartupgrade.sh” files as we don’t need them.
  4. Create a new folder in your working folder called “ibm-notes-9.0.i586″ (do not put “.deb” on the end).
  5. Rename the “ibm-notes-9.0.i586.deb” file to “ibm-notes-9.0.i586_ORIGINAL.deb”.
  6. Open the “ibm-notes-9.0.i586_ORIGINAL.deb” file in Archive Manager (or any other archive management tool) and extract the contents of it to the “ibm-notes-9.0.i586″ folder you created in Step 4. You should now have the following directories in there:

    DEBIAN
    opt
    usr

  7. Get into the “DEBIAN” folder.
  8. Open the “control” file in a text editor.
  9. Go down and modify the “Depends:” line to REMOVE the following part of that line: “gdb, coreutils, unzip, bash, procps, grep, sed,”. When you’re done, the line should now look like:

    Depends: libart-2.0-2, libasound2, libatk1.0-0, libbonobo2-0, libbonoboui2-0, libc6, libcupsys2, libfontconfig1, libfreetype6, libgcc1, libgconf2-4, libgtk2.0-0, libglib2.0-0, libgnome2-0, libgnomecanvas2-0, libgnome-desktop-2 | libgnome-desktop-2-7 | libgnome-desktop-2-11 | libgnome-desktop-2-17 | libgnome-desktop-3-2, libgnomeui-0, libgnomevfs2-0, libglib2.0-0, libice6, libjpeg62, liborbit2, libpam0g, libpango1.0-0, libpng12-0, libpopt0, libsm6, libstdc++6, libx11-6, libxcursor1, libxext6, libxft2, libxi6, libxkbfile1, libxml2, libxp6, libxrender1, libxss1, libxt6, libxtst6, libz1
  10. Save your changes and close the text editor.
  11. Open a terminal and change to the root of your working directory where you have the “ibm-notes-9.0.i586″ directory, but don’t actually go into it.
  12. Now let’s repackage a new deb file from our modified data using the following command:

    $ dpkg-deb -b ibm-notes-9.0.i586

    …and hit Enter. You will see the following message and the repackage process will take about 30-60 seconds:

    dpkg-deb: building package `ibm-notes:i386' in `ibm-notes-9.0.i586.deb'.
  13. Once the new package has completed building, you will have a new “ibm-notes-9.0.i586.deb” file, ready for installing onto a 64-bit system.

Installing everything on a 64-bit system

  1. First we need to install the 32-bit dependencies manually. In a terminal, type in the following and hit Enter:

    $ sudo apt-get update; sudo apt-get install ia32-libs libgnomeprint2.2-0:i386 libgnomeprintui2.2-0:i386 libbonobo2-0:i386 libbonoboui2-0:i386 libgconf2-4:i386 libgnome-desktop-2-17:i386 libgnomevfs2-bin:i386 libgnomeui-0:i386 libjpeg62:i386 libpam0g:i386 libxkbfile1:i386 ttf-xfree86-nonfree t1-xfree86-nonfree -y
  2. Now type in the following and hit Enter (yes, we have technically already installed this but for some reason it doesn’t configure itself until we install it again):

    $ sudo apt-get install libgnomeprintui2.2-0:i386 -y
  3. Now we can start installing the Notes debs in order:

    $ sudo dpkg -i ibm-notes-9.0.i586.deb
    $ sudo dpkg -i ibm-cae-9.0.i586.deb
    $ sudo dpkg -i ibm-connections-4.5.0.i586.deb
    $ sudo dpkg -i ibm-activities-9.0.i586.deb
    $ sudo dpkg -i ibm-sametime-9.0.i586.deb
    $ sudo dpkg -i ibm-opensocial-9.0.i586.deb

  4. If there were no error messages, IBM Notes 9.0 is now successfully installed and you can now launch it from the Unity Dash (in Ubuntu) and manually add the icon to your Unity launcher.
  5. Pat yourself on the back. You are done.

HowTo: Rename multiple TV episode files with one command

So, you’ve procured a number of files that represent a pre-recorded television series and they are typically named something like this:

MyTVShow.Original.S01E01-720p.HDTV.x264-ImAwesome.mkv
MyTVShow.Original.S01E02-720p.HDTV.x264-ImAwesome.mkv
MyTVShow.Original.S01E03-720p.HDTV.x264-ImAwesome.mkv
MyTVShow.Original.S01E04-720p.HDTV.x264-ImAwesome.mkv

You’d like to rename them to look something like this instead:

MyTVShow S01E01.mkv
MyTVShow S01E02.mkv
MyTVShow S01E03.mkv
MyTVShow S01E04.mkv

Normally you’d tediously edit each filename and rename them manually, but to do so individually across a large folder will take a long time. Surely there’s a way to rename them all in a more convenient manner?

There certainly is! And with just one command too…

One command? How can you possibly do that, you ask? Well, Linux commands generally have the ability to accept a regular or Perl expression to allow for complex matching tasks, simplifying your work, and we will utilise that here with the rename command’s ability to parse Perl expressions.

Note: As I understand it, only Debian-based distros such as Ubuntu carry the “rename” command as part of the default command set. Other distros may require you to add the command binary to your system.

The task in this case is to take a string to match on, in this case “MyTVShow.Original.”, take a wildcard match of the “SxxEyy” part (where “xx” and “yy” are any numeric characters), ignore everything after that and then create a new string for the filename that is formatted as “MyTVShow SxxEyy.mkv” and replace “xx” and “yy” with the Season and Episode number picked up in the wildcard match.

And even better than that, we will write this in such a way that we can support any file extension so it doesn’t matter if the folder contains “.mkv” or “.avi” or “.mp4″ files, they will all be preserved in the rename.

This is the command you need:

rename -n 's/MyTVShow\.Original\.[Ss](\d{2})[Ee](\d{2}).+(\.\D{3})/MyTVShow\ S$1E$2$3/' *

When you run it, you will see output as follows:

$ rename -n 's/MyTVShow\.Original\.[Ss](\d{2})[Ee](\d{2}).+(\.\D{3})/MyTVShow\ S$1E$2$3/' *
MyTVShow.Original.S01E01-720p.HDTV.x264-ImAwesome.mkv renamed as MyTVShow S01E01.mkv
MyTVShow.Original.S01E02-720p.HDTV.x264-ImAwesome.mkv renamed as MyTVShow S01E02.mkv
MyTVShow.Original.S01E03-720p.HDTV.x264-ImAwesome.mkv renamed as MyTVShow S01E03.mkv
MyTVShow.Original.S01E04-720p.HDTV.x264-ImAwesome.mkv renamed as MyTVShow S01E04.mkv

But hang on, when I list my files, they’ve still got the old names! What gives?

The “-n” parameter tells the rename command not to actually action any rename, but show you what it would have acted on – good for testing just in case you made a mistake in your match criteria. Once you are ready to commit the rename, either remove the “-n” parameter or if you’d like to see what the rename command is doing, replace it with “-v” for verbose output instead (it’s the same as “-n”‘s output).

So exactly how does this command work? Let’s break it down a bit:

rename -n ‘s/MyTVShow\.Original\.[Ss](\d{2})[Ee](\d{2}).+(\.\D{3})/MyTVShow\ S$1E$2$3/’ *

  • The first part specifies the rename command, the parameters to use and specifies the starting string we need to match on. You will notice that there are backslashes before the full stops. This is needed because the full stop character has other functions in an expression and so to specify it as a literal character, we need to “escape” out of the expression mode into “literal” mode, and that is facilitated by the blackslash. The character that follows the backslash is to be taken literally as part of the string we are constructing. If you wanted to literally specify a backslash character, for example, you’d have to specify a double backslash, ie: “\\”.

rename -n ‘s/MyTVShow\.Original\.[Ss](\d{2})[Ee](\d{2}).+(\.\D{3})/MyTVShow\ S$1E$2$3/’ *

  • This part matches the “SxxEyy” part of the filename. This is not a literal string in this case because we need to dynamically cater for the different Season and Episode numbers in each filename. In addition to that, Linux filenames are case-sensitive, so we also need to consider that the “S” and “E” parts could be upper or lowercase, so we start with “[Ss]” which means “match either a capital ‘S’ or a lowercase ‘s’ please”, then we specify that we wish to wildcard the next two digits by specifying “(\d{2})”. The “\d” means to match any numerical digit and is essentially a shorthand version of “[0-9]” (it also matches other language numerical digits beyond the English 0-9, but I digress). The “{2}” part means apply that digit match to the next two characters, so we match on “01” or “02” or “03”, etc.We apply the same process to the “Eyy” part of the string, again matching either a capital “E” or a lowercase “e” followed by any two numerical digits.Finally, we accept the remainder of the filename up to the filename extension with the “.” part (because we don’t care what’s here) and explicitly wildcard match the extension with the “+(\.\D{3})” part, which allows us to match any three character file extension (not just numbers), for example “.mkv”, “.MKV”, “.avi”, “.mpg”, etc, however it will NOT match “.mpeg” or “.jpeg” or “.myfilextension” because those are larger than three character extensions that while they form a part of perfectly legal filenames, they are also very uncommon. In this case we will ignore them and assume that we’ll only ever deal with three character file extensions.

rename -n ‘s/MyTVShow\.Original\.[Ss](\d{2})[Ee](\d{2}).+(\.\D{3})/MyTVShow\ S$1E$2$3/’ *

  • Now that we’ve specified our matching criteria, what do we do when we’ve found that match? We need to tell the rename command what we’re going to be renaming it to. The first forward slash means we’ve finished specifying our match criteria and are now specifying our rename string and it starts off with “MyTVShow” followed by an escape to be able to specify a space before the “SxxEyy” bit. We then specify the “SxxEyy” bit as “S$1E$2″.Now you didn’t know this, but in the previous matching criteria, the digit wildcard matches were automatically stored as variables because they were surrounded by parenthesis “(” and “Smilie: ;)”. Variables generated start at $1 and continue up as $2, $3, etc. You can now specify those variables as part of your destination filename and in this case, the Season number that was wildcard matched from the original filename is now specified as the first variable $1 in your destination filename, thus if “03” was in the original filename as the Season number, you can now write “03” as part of your destination filename. Ditto the Episode number as variable $2.Finally, we end the destination string with a straight up “$3″ that will specify the third variable we created which is the filename extension picked up in the wildcard match, which in our tutorial example will be “.mkv”. The beauty of this is that if you had multiple files with different file extensions, those extensions will be completely preserved.

rename -n ‘s/MyTVShow\.Original\.[Ss](\d{2})[Ee](\d{2}).+(\.\D{3})/MyTVShow\ S$1E$2$3/’ *

  • And finally, we specify which files the rename command will be applied to as a whole. In this case because we have an expression to do the matching, we don’t need to use traditional filename matching, so we just specify an asterisk to apply to “all files” because any file that does not match the search expression will be ignored.

Optional: Getting slightly trickier, but for good reason…

Let’s say you deal with a lot of these files that you have to rename with different names on a regular basis. While the above tutorial has saved you a fair bit of time, at the moment you’re always having to copy and paste the command down and then modifying it to suit the filename strings you are changing from and to, remembering to escape certain characters so that they are processed properly like the full stops. We can make this process even more convenient by using a Bash script to allow us to simply specify a command followed by old and new strings only and not have to worry about escape characters.

  1. Create a new file using your text editor (you can name it anything you like and it does not have to have “.sh” on the end):

    $ sudo nano /usr/bin/fixfilenames.sh
  2. Type or copy and paste in the following:

    #!/bin/bash
    # =============================================================
    # Bulk rename TV series files. Written by HyRax, January 2014

    # ==============================================================
    if [ $# == 0 ]; then
    echo ""
    echo "Usage: $0 OLDNAME NEWNAME"
    echo ""
    echo " Eg: If the original filename is 'MyTVShow.Original.S01E01-720p.HDTV.ImAwesome.mkv' then"
    echo " specify the command as '$0 MyTVShow.Original. MyTVShow' which will rename"
    echo " all the files into 'MyTVShow SxxEyy.mkv' format. Note that a space is assumed as wanted between"
    echo " the new name and the SxxEyy part. The Season and Episode numbers along with the file extensions"
    echo " will be preserved in each rename."
    echo ""
    exit
    fi

    cmd="rename -v 's/$1[Ss](\d{2})[Ee](\d{2}).+(\.\D{3})/$2 S\$1E\$2\$3/' *"
    echo ""
    echo "Renaming files... (Renamed files will be listed below. Nothing listed means nothing actioned!)"
    eval $cmd
    echo "Done."

  3. Save your changes by pressing CTRL+X, then Y and then Enter.
  4. Now let’s make the new script executable:

    $ sudo chmod +x /usr/bin/fixfilenames.sh
  5. Now you can rename your files as follows (using the tutorial’s filename example):

    $ fixfilenames.sh MyTVShow.Original. MyTVShow
  6. List your directory and you will see all your files renamed successfully!

Pat yourself on the back. You’re done. If you’d like to explore more about expressions and what they can do, there are dozens of general tutorials around on the web which will easily teach you how to modify your expression to cover even more complex matches should you have that need.

HowTo: Resize an LVM partition on a GPT drive after expanding the underlying array

Scenario: You have an Ubuntu Linux server. The storage system is a large RAID array, partitioned as a GPT disk and it has two partitions on it – a small boot partition and the second partition is setup for use with LVM with one or more Logical Volumes in it.

You’re starting to run out of space and intend to expand the system by adding one or more disks to the array. Once you’ve done this, you will obviously need to extend the partition to use the new space, but GPT is a slightly different kettle of fish to regular partitioning, and being a server you don’t have a GUI to use traditional tools.

So how do you do this?

The basic flow of necessary steps is essentially:

  1. Resize the array by adding new disks (not covered by this article).
  2. Resize LVM partition to use the new space in the array.
  3. Resize the Physical Volume in the LVM partition to use the newly resized space.
  4. Resize the Logical Volume(s) inside the Volume Group to their new sizes.
  5. Resize the filesystems in each Logical Volume to match their sizes.

WARNING: You are about to manipulate the partitions and data on your drive. Any mistake made during that process can result in data loss. Following this article is done at your own risk and no responsibility for any errors or data loss will be accepted by the author. Always have backups before performing any major changes to your drive’s geometry. You have been warned!

The instruction for this article was tested on the following server:

  • Ubuntu 12.04.3 LTS Server
  • An Intel SRCSATAWB PCI-E RAID controller (LSI chipset) – presents a single large drive to the OS
  • The array is a RAID6 array with eight 2TB drives (two drives were global hotspares)
  • The array was expanded from 8TB to 10TB by converting one of the global hotspares to an active member

As always, while this article is written with Ubuntu in mind, it should apply equally to just about any distribution.

So let’s begin:

  1. Using the instruction applicable to your RAID array, expand the array with new drives and begin the rebuild process. Note that it may take several hours or even days (!) to expand your array depending on what type of array you are using and the size of of your array members. You cannot proceed until the rebuild has concluded.
  2. Once the array has finished rebuilding, you will need to reboot into Recovery Mode or reboot into a Live CD/USB environment, as it is not possible to resize a partition while it is online.
  3. Since this is a GPT-partitioned disk, we have to use the Parted tool instead of FDisk. In your Recovery Mode or Live environment, open a terminal if you haven’t already got one and launch Parted to examine your array by typing in:

    $ sudo parted /dev/sda
    GNU Parted 2.3
    Using /dev/sda
    Welcome to GNU Parted! Type 'help' to view a list of commands.


    (If your array’s volume is not /dev/sda, substitute the appropriate device name)
  4. Now we have a “(parted)” prompt. First up, we need to switch the units of measurement we’re using to sectors. Do that by issuing the following command:

    (parted) u s
  5. Now list the existing partitions using the “print” command. You will see something similar to the following:

    (parted) print
    Model: INTEL SRCSATAWB (scsi)
    Disk /dev/sda: 19521474560s
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Number Start End Size File system Name Flags
    1 2048s 1953791s 1951744s ext4 Boot boot
    2 1953792s 19521474526s 19519520735s MYSERVER_HDD lvm


    NOTE: You may be shown a warning message advising that the GPT table is not at the end of the disk, saying that the disk size is smaller than the system expects it to be (because you resized your array, remember?). It will ask you if you wish to fix this. Type in “F” and hit enter. You may then be warned that the kernel is not yet aware of changes being made. Respond to this with Ignore by typing in “I” and hit enter. You may be prompted with the latter message several times whilst using Parted. Respond “Ignore” to it each time. In this environment, the current kernel does not need to be aware of the changes because we’re going to reboot at the end of it anyway.
  6. Make a note of the items that are highlighted in red above, namely the total sectors of the device (which represents the total size of your newly expanded array) and the start sector of the second partition. Please double-check your figures and make sure they are right. Any mistakes here can DESTROY YOUR DATA.
  7. Now we’re going to resize the second partition to use all of the newly created space in the array. Unfortunately GPT has no ability to resize. Instead you must remove the partition and recreate it. Don’t worry, as scary as it sounds, this process will NOT change any of the data on the drive. It simply deletes the geometry data relating to the start and end of the partition on the drive only. Remove the second partition with the following command:

    (parted) rm 2
  8. Now let’s create a new partition to replace it. Type in the following:

    (parted) mkpart
  9. You will be asked for name for the partition. Give it the same name you had for it before, or specify a new name if you like:

    Partition name?  []? MYSERVER_HDD
  10. You will then be asked about the file system type. You can’t specify LVM here, so just hit enter to accept “ext2″ – we’ll change it later:

    File system type?  [ext2]?
  11. You will then be asked for the start sector. Specify the value of the start of the second partition that you recorded earlier (don’t write the letter “s” on the end):

    Start? 1953792
  12. You will then be asked for the end sector. Specify the value of the total size of the drive that you recorded earlier minus one. If you specify the actual value, you will get an error saying that the value is “outside of the device” which is why you specify a value just inside that limit.

    End? 19521474559
  13. You will then be told that the system cannot actually make a partition up to that location (because there’s another partition on the disk taking up space), so the system will offer the next closest value which will just happen to be the maximum space remaining on the array. Simply respond “Y” for Yes.

    Warning: You requested a partition from 1953792s to 19521474559s.
    The closest location we can manage is 1953792s to 19521165533s.
    Is this still acceptable to you?
    Yes/No?

  14. Now we need to change the partition type to LVM as follows:

    (parted) toggle Partition number? 2
    Flag to Invert? lvm

  15. We’re now done with our partitioning so quit parted with the quit command:

    (parted) quit
  16. Reboot your server and boot up as normal. If you check your drive using parted or fdisk, it should now show that the total partition size includes the newly added space in your array, but nothing is using it yet. Now it’s time to tell LVM to use the new space by resizing the Physical Volume with the following command:

    $ sudo pvresize /dev/sda2
  17. Once completed, you can now check out the new free space (shown as free extents) in the LVM Physical Group by issuing the command:

    $ sudo pvdisplay
  18. Now we can start allocating this newly acquired free space to our LVM Logical Volumes. First up, let’s get a list of all our defined Logical Volumes:

    $ sudo lvdisplay
  19. Note down the “LV Name” of each Logical Volume you wish to add space to.
  20. Now let’s resize the Logical Volume. There are two ways you can do this. One method is to specify an absolute value that defines the new size of that Logical Volume, or specify a value that will add to the existing size of it. In this first example, I’m going to change the size of my Logical Volume called /dev/myserver/mylogicalvolume to be an absolute size of 20 gigabytes:

    $ sudo lvextend -L20G /dev/myserver/mylogicalvolume

    …which will make the /dev/myserver/mylogicalvolume Logical Volume 20 gigabytes in size regardless of its previous size. It does NOT add to the existing size.

    Alternatively to add space to the existing size using the following command instead:

    $ sudo lvextend -L+20G /dev/myserver/mylogicalvolume

    (note the plus sign between the -L and the 20G)

    …which will add 20 gigabytes of space to the /dev/myserver/mylogicalvolume Logical Volume. If it was 10 gigabytes in size before, it will now be 30 gigabytes in size.

    Alternatively, if you wish to allocate all remaining free space to a Logical Volume, issue the following command:

    $ sudo lvextend -l +100%FREE /dev/myserver/mylogicalvolume

    (notice that the parameter is a lowercase L instead of a capital L)

    Repeat for all Logical Volumes you are extending. There are other ways to allocate space as well, but the above are the most common methods that would be used. See the man page of the lvextend command for more information.
  21. You can confirm the new sizes for each Logical Volume by issuing the following command:

    $ sudo lvdisplay
  22. We’re nearly there! All that is left to do is now to resize the filesystems containing within our Logical Volumes to use the newly allocated space. Again, using the LV Names you recorded earlier, specify the following command for each Logical Volume you have modified:

    $ sudo resize2fs /dev/myserver/mylogicalvolume
  23. Once you have expanded the filesystems on all your Logical Volumes, you can check the free space on each of your filesystems by issuing the following command:

    $ df -h
  24. And that’s it! You have successfully expanded your LVM partition on your GPT-partitioned array! Pat yourself on the back. You are done.

HowTo: Launch and terminate an Impress (PowerPoint) presentation from a Terminal

The scenario is simple: You have a kiosk or display machine showing information, eg: a self-updating webpage. On a schedule you want to launch an Impress or PowerPoint presentation on the display which will loop. You want that loop to only run for a few minutes before terminating and going back to what was originally being displayed.

How do you do this?


Procedure:

  1. First of all you need a presentation file. If the original is from PowerPoint, load it into Impress and re-save it as an ODP file.
  2. Make sure that your presentation has been cleared of all “On Click” events, ie: All slides should advance automatically after X seconds. Any animated components within a slide should be updated to occur after the last action.
  3. Make sure your presentation is set to automatically loop at the end (Slideshow Menu->SlideShow Settings->Type set to Auto with zero seconds).
  4. Save your changes.
  5. Copy your presentation over to your kiosk machine.
  6. Using SSH or a local terminal, bring up the crontab into your favourite text editor (default is Nano with Ubuntu) with:

    $ crontab -e
  7. Now, assuming your presentation is at /home/kiosk/Documents/MyPreso.odp, add  the following lines:

    00 10 * * * DISPLAY=:0 /usr/lib/libreoffice/program/simpress -show /home/dashboard/Documents/MyPreso.odp --norestore
    15 10 * * * /usr/bin/killall soffice.bin


    What the above lines will do is launch Impress to open your MyPreso presentation in Show Mode at 10:00am on the dot on the first display (screen zero). The “–norestore” parameter prevents LibreOffice from asking if you want to recover any files which will occur if you terminate LibreOffice instead of closing the app as normal (we can’t because it’s a kiosk, remember?). Then, at 10:15am, the LibreOffice task will be terminated, thus ending the looping presentation.
  8. Now save your changes and exit the text editor. if using Nano, you’d press CTRL+X, then “Y” and then Enter
  9. Now test your schedule.

That’s cool. Now can we configure it to have a different presentation to run each day?

This is quite easy to do.

  1. First generate all the different presentations you will need to run on each day of the week. Name them accordingly. In this example we are naming them MyMondayPreo.odp, MyTuesdayPreso.odp, and so forth.
  2. Now modify the crontab to look like the following:

    00 10 * * 1 DISPLAY=:0 /usr/lib/libreoffice/program/simpress -show /home/dashboard/Documents/MyMondayPreso.odp --norestore # Monday
    00 10 * * 2 DISPLAY=:0 /usr/lib/libreoffice/program/simpress -show /home/dashboard/Documents/MyTuesdayPreso.odp --norestore # Tuesday
    00 10 * * 3 DISPLAY=:0 /usr/lib/libreoffice/program/simpress -show /home/dashboard/Documents/MyWednesdayPreso.odp --norestore # Wednesday
    00 10 * * 4 DISPLAY=:0 /usr/lib/libreoffice/program/simpress -show /home/dashboard/Documents/MyThusdayPreso.odp --norestore # Thursday
    00 10 * * 5 DISPLAY=:0 /usr/lib/libreoffice/program/simpress -show /home/dashboard/Documents/MyFridayPreso.odp --norestore # Friday
    15 10 * * * /usr/bin/killall soffice.bin


    You will notice that each line has one of the asterisks replaced with a number 1 through 5. This tells cron only to run that schedule on the day specified. In this case, the 1 represents Monday, the 2 is Tuesday, the 3 is Wednesday and so forth. Saturday is 6 and Sunday is both 1 or 7.

    You may be wondering why we only have one killall command instead of five? We don’t need five as the command to kill LibreOffice is the same each time, so it doesn’t need a day designation – it will run every day at 10:15am.
  3. Save your changes and test.

Now you can schedule your presentations to appear and disappear as required without manually interrupting the normal display on that kiosk. Naturally these instructions can be adapted for other uses.

HowTo: Fix Apt-Get failing with a “Method did not start correctly” error

So, you decide to install a new package on your system, or perhaps update your system with some outstanding updates. You either use the Software Centre or the Apt-Get command from a terminal to do this and you are suddenly greeted with the following error:

Failed to exec method /usr/lib/apt/methods/
E: Method  has died unexpectedly!
E: Sub-process  returned an error code (100)
E: Method /usr/lib/apt/methods/ did not start correctly

And everything stops. Repeating the command produces the same error over and over.

What just happened and how do you fix this?

What has happened is that one or more of your cached sources lists has corrupted itself and no amount of re-running apt-get update is going to fix this. We need to delete the cache of lists and get apt-get update to re-download them in their entirety – nice and fresh.

  1. In a terminal, type in:

    $ sudo rm -rf /var/lib/apt/lists/*…and hit Enter.
  2. Now type in:

    $ sudo apt-get update

    …and hit Enter. You will notice that this takes a bit longer than usual to complete.
  3. Now try your package installation or system update again:

    $ sudo apt-get install <name of the package you tried to install before>
    OR
    $ sudo apt-get upgrade

    …and this time you will see Apt behaving itself again.
  4. Pat yourself on the back. Crisis resolved.

HowTo: Pair a Sony PlayStation3 DualShock controller with Ubuntu

The ubiquitous Sony PlayStation3 DualShock controller. This controller has been around for ages now and IMO it’s one of the nicest multi-button game controllers out there. One of its nicer features is that it has USB and Bluetooth connectivity.

Click for full size!
The Sony PlayStation Dual Shock 3 Controller

It’s already been proven that you can connect a PS3 controller to Ubuntu using a standard USB cable, which is fine, but it’d be kinda cool to use Bluetooth as well. The thing is that the PS3 controller doesn’t follow the complete Bluetooth specification with regards to pairing. The reason for this is deliberate – you don’t want people being able to steal control of your PS3 controllers or your PS3 remotely, so pairing is performed manually using the USB cable. Once paired that way, the cable can be disconnected and you can continue using Bluetooth instead.

So can we replicate this in Ubuntu? Can we pair a controller via USB and then continue to use it via Bluetooth? Thanks to the QTSixA project, we can!

Prerequisites:

  • One PlayStation3 DualShock controller or compatible equivalent
  • One normal USB charge cable
  • Any Bluetooth adapter on your desktop PC or in-built in your laptop

Procedure:

  1. First we need to add the QTSixA project’s PPA to your system. Open a terminal and type in the following and hit Enter:

    $ sudo add-apt-repository ppa:falk-t-j/qtsixa
  2. You will be prompted about adding the repository. Just hit Enter:

    You are about to add the following PPA to your system:
    Packages for QtSixA and sixad software

    To enable this repository in Karmic and Lucid:
    sudo add-apt-repository ppa:falk-t-j/qtsixa

    In Jaunty and Intrepid, add the line to the software sources:
    deb http://ppa.launchpad.net/falk-t-j/qtsixa/ubuntu UBUNTU_VERSION main

    More info: https://launchpad.net/~falk-t-j/+archive/qtsixa
    Press [ENTER] to continue or ctrl-c to cancel adding it
  3. Once the PPA has been added, have your system update its cache of available software from the PPA’s with:

    $ sudo apt-get update
  4. Now let’s install the QTSixA application:

    $ sudo apt-get install qtsixa
  5. Now the fun can really begin! Get your PS3 controller and connect it to your system with its USB charge cable. The four red LED’s on the back of the controller will begin to flash and if you issue an lsusb command you will see the controller listed:

    $ lsusb
    Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
    Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
    Bus 004 Device 003: ID 0480:a006 Toshiba America Info. Systems, Inc.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 012: ID 054c:0268 Sony Corp. Batoh Device / PlayStation 3 Controller
    Bus 001 Device 003: ID 046d:08d7 Logitech, Inc. QuickCam Communicate STX
    Bus 001 Device 004: ID 046d:c517 Logitech, Inc. LX710 Cordless Desktop Laser
    Bus 001 Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

  6. Now let’s pair the controller to your PC’s Bluetooth adapter:

    $ sudo sixpair
    Current Bluetooth master: 00:25:56:2e:7f:52
    Setting master bd_addr to 00:1b:dc:00:3c:f1

  7. We’re nearly there! Now we just need to activate the controller so we can start using it! At this point you can now disconnect the USB cable (you don’t have to, especially if you’re still charging it) and enter the following command:

    $ sixad --start
    sixad-bin[13374]: started
    sixad-bin[13374]: sixad started, press the PS button now

  8. When prompted, press the PS button on your controller to activate it and the terminal will show something similar to the following:

    sixad-sixaxis[13430]: started
    New Device: 00:1E:3D:AA:82:6C PLAYSTATION(R)3 Controller (Bluetooth)
    sixad-sixaxis[13430]: Connected 'PLAYSTATION(R)3 Controller (00:1E:3D:aa:82:6c)' [Battery 05]

  9. That’s it! Your PS3 controller is now connected! You can now start using it in games that support using it.

Questions:

  • Can you pair multiple controllers?
    Yes! Just repeat the pairing process for all new controllers. The appropriate red LED number will light up on the controller to indicate which one it is.
  • The terminal is nice, but is there a GUI application to manage the controllers as well?
    Yes! Just launch the QTSixA application from the Ubuntu Dash menu launcher.
  • I don’t want to use my controller on my PC anymore – how do I reconnect it to my PS3?
    Simply reconnect the controller to your PS3 via its USB charge cable and turn your PS3 on. This will immediately change its pairing to the PS3 and prevent it connecting to your PC anymore.
  • Can I have the controller paired with the PS3 and the PC at the same time?
    No. The controller only allows for one master.
    .
  • I notice there’s a number of extra applications in the QTSixA suite. What are they for?
    The package allows for connecting other PlayStation accessories such as the keyboard and remote as well as extended features for the controller itself. Refer to the documentation of the QTSixA project for more information.