Category Archives: Hacks & Slacks

Encrypted Drive Recovery in Ubuntu 14.04

I found a very simple guide for recovering data from an encrypted drive in the scenario where they drive will not boot (but, obviously, where the drive is still functional).

Take a look:

How to Recover Data from an Encrypted Harddisk on Boot Failure with Ubuntu 14.04

This method may work with other related versions of Ubuntu (assuming they are using the same application for encryption).  I have not tested it, but it looks sound enough.

Let me know your experiences.  Hopefully this will help someone not lose data.


Enable Hibernation in Ubuntu 14.04

If you are running Ubuntu post 10.04 (or post 11.04 if you use non-LTS releases) you may have noticed that hibernation is no longer an option.  You don’t get to choose it from your logout/shutdown options and you don’t get to choose it as an option if your battery is dying.

I’ve read some attempts at explanation, but as near as I can tell it has been disabled because they can’t get it to work consistently on every hardware.  Seems they’d rather have actions that can work on all hardware than to risk some users having unexpected crashes.

So before you attempt to enable hibernation, let’s test your hardware to see if hibernation is likely to work for you.

sudo pm-hibernate

If all goes well this terminal command should hibernate your machine and move all of your active session into a special location on your hard drive.  You will then need to power your machine on and it should come back to your hibernated session.  If that fails then your machine may not be a good candidate to enable hibernation.  If it works, give this a try.

Enabling hibernation for those machine capable of it is a simple matter of creating a configuration file with the relevant data included therein.  The file is called com.ubuntu.enable-hibernate.pkla and will live in the /var/lib/polkit-1/localauthority/50-local.d/ folder.

I used Gedit to create and save this file:

gksudo gedit /var/lib/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

This will open Gedit with elevated user permissions (so do be careful).  Simply add this code directly into the file, save it, and close Gedit.  (Mouse over to use the pointy-brackets button in the box for an easier copy and paste.)

[Re-enable hibernate by default in upower]

[Re-enable hibernate by default in logind]

That’s it.  You should (after a reboot) be able to use hibernation in the various circumstances where it might be appropriate.  For me that’s really just in the Power settings, but you may have additional uses for it.

Have fun.


Two-Finger Scrolling Unavailable—Not

So I’m using a different laptop.  It has a touchpad for mousing around, and on the touchpad are arrows indicating you are able to use edge scrolling.  This laptop is new enough it presumably has two-finger touch sensitivity, yet for whatever reason Unity’s System Preferences showed “Two finger scrolling” as greyed.

I prefer two-finger scrolling and thus I poked around the Webz to see what I could see.

I found this question asked and answered which had a solution to enable two-finger scrolling.  Essentially the solution (work-around really) is a collection of three commands which enable two-finger scrolling (why it is greyed is another matter for another time).

I tested it and it worked on my machine (a Lenovo w500) as well.  Great.

As advised in the article one could add those three lines as part of one’s start-up scripts (.bashrc in most cases), but I was feeling differently.  First I consolidated those three lines into one line using double-ampersands.  Then I created an alias called touchpad which contained those three-now-one lines of code.

Confusedly, this work-around only remained effective until the machine went to sleep.  I would understand any logout, but you’ll see from the code that this effects X and X must relaunch after sleep (or at least changes state enough to reset this).

Checking the man page for alias (which I had to find on-line as my bash in Ubuntu 14.04 doesn’t have it) I found that I could make an alias persist (or at least make it get recreated) by adding it to my .bash_aliases file in my home directory.

Now it works great.  I have added that alias to each user account I use on this laptop so it is easy to call.  Perhaps one day I’ll add the work-around elsewhere so I won’t have to instantiate it, but for now I have this.

Below you will see the code I used.  I hope this helps you today.

# by JamesIsIn from
# Do something nice today.

# Here is my alias. The code between the single quotes is what you would need if your aim was merely to test-fix your touchpad.

alias touchpad='xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 4 && xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 8 && xinput --set-prop --type=int --format=8 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 1 0'

# Here is my .bash_aliases file.

cat .bash_aliases
# command to enable two-finger scrolling

alias touchpad='xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 4 && xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 8 && xinput --set-prop --type=int --format=8 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 1 0'


Removing Superfluous Kernels in Ubuntu 10.04

Mostly I have moved on to Ubuntu 14.04, but I do still have a couple of old 10.04 machines on my network.  The newer versions seem to be doing a great job of cleaning out the old kernels and only leaving me a small number (five?) of kernels in case I do need to roll back for any reason.

(I have needed to roll back a kernel but it was on my 10.04 system when an upgrade broke, well, everything due to something related to Compiz.  That’s another story though.)

I noticed that my 10.04 system had a couple of dozen old kernels listed in grub, and that just looks sloppy to me.  I wanted to remove them.

I poked around Google a bit and came across this excellent article which walked me through the process of locating and removing old kernels:

Remove Old Kernels in Ubuntu with One Command

The article, however, removes all but the current kernel.  I wanted a bit more of a safety net than that on hand, so I opted to alter the command to leave a small number behind instead.

Here is my final code:

dpkg -l linux-* | awk ‘/^ii/{ print $2}’ | grep -v -e “2.6.32-6″[0-5] | grep -e [0-9] | grep -E “(image|headers)” | xargs sudo apt-get -y purge

As you can see the important change is in the first grep command.  Instead of excluding the current kernel by running uname -r, I opted to exclude a group of kernels based on their version numbers (60-65).  I could have added a second grep command immediately following to exclude some of the fifties if I had wanted to exclude more.  This is how that might have looked:

dpkg -l linux-* | awk ‘/^ii/{ print $2}’ | grep -v -e “2.6.32-6″[0-5] | | grep -v -e “2.6.32-5″[8-9] |grep -e [0-9] | grep -E “(image|headers)” | xargs sudo apt-get -y purge

This version would have added an exclusion for both 58 and 59 (thus excluding 58-65).

These old 10.04 systems won’t be running much longer here (I have plans to upgrade them both to 14.04 soon enough).  Hope this helps you nonetheless.


Install AD in Win7

I feel like you used to be able to install AD (Active Directory) through the “Turn Windows features on or off” dialog.  Apparently you must now first download the Remote Server Administration Tools (or maybe it was always that way and I just don’t do it often enough to remember).

Regardless, if you behave like a normal administrator it will give you headaches and will fail.  So I’ll give you the little advice necessary to make this installation go quickly and smoothly.

First go here and download the Remote Server Administration Tools.  I am running Win7 64 bit so I downloaded the 64 bit version.  If you are not sure, download them both and one of them will tell you it’s not compatible.

Ok, unfortunately you can’t just run the installer.  The simplest way to ensure it actually installs (no failure allowed) is to launch it from a command line being run as an administrator.  To do this open the Start menu and type cmd.  When you see cmd.exe, right-click on it and choose “Run as administrator”.

Now you are running the command line with elevated privileges.  Just launch the installer from the command line.  You can do this by merely entering the path and file name and hitting Enter.

I always downoad items to the desktop (since they are easy to locate and they exist as a reminder to delete them when done).  If I were signed into the built-in administrator account that path and file would look like this:


Click through the installation dialog and you will see the Remote Server Administration Tools appearing in your “Turn Windows features on or off” dialog.  I check the following items (checking a parent does not check the children).

  • Role Administration Tools
    • AD DS and AD LDS Tools
      • Active Directory Module for Windows PowerShell
      • AD DS Snap-ins and Command-line Tools
      • Server for NIS Tools
    • AD LDS Snap-ins and Command-line Tools
    • DHCP Server Tools
    • DNS Server Tools
    • Remote Desktop Services Tools

That’s it.  Hope that speeds your day along.


Migrating Your RDP History to a Different Windows 7 Machine

You would think this would be a simple operation.  Migrating my bash history for Cygwin meant moving one file.  But you’d be wrong.  This migration means moving two registry hives, one file, and the contents of one very difficult to locate hidden folder.  Well, at least it can be done.

I began with the RDP client already pinned to my Task Bar.  Your results may vary if you have not done so.  Let’s get started.

First open the registry editor (just type regedit in the Run dialog or in the search box for the Start menu).  Once there navigate to

HKEY_CURRENT_USER —> Software  —> Microsoft  —> Terminal Server Client

In this location you will find two hives called Default and Servers.  Export each of those hives (right-click  —> Export), move them to the new machine, and import them (right-click  —>  Merge).

Then you need your Default.rdp file (and any other .rdp files you may have saved if you’d like).  This is a hidden file located in your My Documents folder.  Migrate that file to your other machine (just copy it into the same location on the destination machine).

Finally locate this hidden folder.  You will not be able to navigate to it in the usual manner, even if you have hidden files enabled for viewing.  Just put this in your Explorer window:


Migrate the entire contents of that folder to your new machine and you will migrate all of your so-called Jump Lists.  If you are already using your new machine and would rather not see certain Jump Lists overwritten, only copy in the unique files.  (I don’t know how to determine which file is which list at this time.)

Now you have all four of those items migrated (two registry hives, one file, and the contents you selected from one folder) just go ahead and restart your machine.  Now you should be all good to go.

I hope this helps you along.


Advanced Background Slideshows in Ubuntu

I have been enjoying the background images in the more recent versions of Ubuntu, especially in conjunction with the included slideshow which automatically moves through the images included with each particular version.  I have one machine where I have upgraded it from 13.04 to 13.10 and finally to 14.04.  The trouble is that each version has its own images and slideshow, and I wanted a way to combine them all into a single slideshow.

I figured these were being stored somewhere as a list and I just needed to find and modify that list.  What I have found will be useful if you would like to either do what I have done, add some of your own images to the built-in slideshows, or even create your own slideshows in the list.

After a little digging I found two files which will assist in this endeavor.



So take note of these files and the folders which contain them.  First, in each of the containing folders (in bold) there will be entries for each version your machine has upgraded through.  If you have simply done a fresh install of 14.04 (for example) you will only have an entry for Trusty, but if (like me) you have upgraded starting with 13.04 you will see entries for Raring, Saucy, and Trusty.  All machines should have the ubuntu-wallpapers.xml entry.

The XML files located in gnome-background-properties contain information System Settings —> Appearance —> Backgrounds uses to populate its roster.  If your image or slideshow file doesn’t have an entry here, it will not appear there.

The XML files located in backgrounds/contest are the slideshow files.  Manipulating them or creating a new one (which I did) will alter (or create) your existing slideshows.

To create a slideshow of all the images from each of the three versions on my system, I first created a file called all.xml inside the backgrounds/contest folder.  I then populated that file with information culled from all three of the other slideshow XML files also in backgrounds/contest.

Let’s go over that briefly.

First, to create the file you can simply use touch as the super-user (the folders in which we are working at root-level access only; normally users should stay out).  Just enter this command in your terminal:

sudo touch /usr/share/backgrounds/contest/all.xml

Name it whatever you’d like.  I chose all because I’m making a slideshow from all of the existing (on that system) stock images.

Now you can modify that file again using elevated privledges:

gksudo gedit /usr/share/backgrounds/contest/all.xml

Note that you should be very careful using your text editor while elevated as you can break your system by opening, changing, and saving the wrong file.

I just opened the other XML slideshow files and copied out the relevant sections to create my super slideshow file.  Here are the basics.


<!-- This animation will start at midnight. -->

<!-- Raring -->





The background tag surrounds the entire document.  Each slideshow entry is supported by static and transition tags.  You will need that bit at the top in your slideshow (I guess; I included it), and you will need an entry (static and transition) for each image file you want included.

Note, the default transition time was set to 1795 seconds and I reduced mine to 595 seconds (just under 30 minutes and just under ten minutes respectively).  You should be able to set the duration time for each file the same or different as you see fit.

Also, the transitions in each of the existing files includes one which transitions from the last image to the first image.  You will want to adjust any transitions so ensure that each file transitions to the next in line and then the final transition should point back to the first image.

If all you have done is modify the existing slideshow file(s) you are done (unless you want to include those new images files in the System Settings dialog as individual options).  If you have created a new file, you will now want to add a reference to that file in the ubuntu-wallpapers.xml file.

Mine now looks like this:




  <wallpaper deleted="false">
    <name>All 13.04 - 14.04 Community Wallpapers</name>



That’s pretty much it.  You can see how this works. The whole of your wallpaper options are wrapped in the wallpapers tag and each individual entry is wrapped in its own wallpaper tag. (I have not explored any options except the default zoom.)

There is one last item to note (though I did not have need of this myself).  If you want to see an image you have added appear in the roster, it will need to appear in one of the XML files in the /usr/share/gnome-background-properties/ folder.  The slideshow won’t appear in Systems Settings until you include its entry (as we have done above) and neither will any file you would like to select individually.  You may be able to create your own XML files in this folder as well (as we did similarly in creating the all.xml file) but I have not tested this.

Have fun with that.


Gnome-Do and Unity, Harmoniously

Gnome-do is without a doubt the fastest application launcher I have used on any platform. Once I got into the -do groove I was hooked, utterly. I don’t want to go back.

Apple (either Launchpad or Spotlight), Windows (Metro Modern whatever), and Ubuntu (Unity Dash) all not only offer a slower experience, but each one takes you completely away from what you were doing and you thus lose continuity in your workflow making you wonder why you walked into the kitchen and so you walk back to the living room to see that you needed a fork and so you walk back into the kitchen and forget…

Gack!  Don’t do it!

By contrast gnome-do sneaks in almost unnoticed and let’s you get to the next step without hampering that tenacious continuity with an “oh, look!  squirrel!”.

Simple, small, and unobtrusive is great, but as if that were not enough it’s also exceptionally speedy.  Oh, and it learns from what you select (the stuff you use tends to come earlier and earlier as you type in subsequent searches).

The trouble is with the latest versions of Ubuntu you get Unity.  Unity uses the super key (Windows key or Command key or Apple key or…) to evoke the Dash (similar to how Windows uses the Windows key to evoke whatever they are calling that tile-oriented mess of an application launcher in Win8 now).  For whatever reason, that key binding supersedes any other attempts to use the super key in non-Unity key bindings (shortcuts).  (There is a bug report here for this particular behavior.)

Fortunately I found this fix.  (Which works only some times.  See notes in comments below.)

You’ll need to install the CCSM and (of course) gnome-do.  Enter these into your terminal (or find them in the Ubuntu Software Center):

sudo apt-get install compizconfig-settings-manager

sudo apt-get install gnome-do

Once these are installed open CCSM and navigate to the Ubuntu Unity Plugin (located under Desktop).  Do be careful in the CCSM; it’s powerful and you can really bug things up if you muck around without some due diligence.

For this fix we’ll just be changing one item and it’s a pretty safe one.  On the Launcher tab the first item is called “Key to show the Dash, Launcher and Help Overlay“.  Click the edit button (the one that looks like a pencil).  Put exactly this in that box:


Ok your way out of this and test it.  If you hit ctrl+windows you should see the Dash take over.  Great.  This change will allow other key bindings to make use of the super key.

Now open gnome-do (using the Dash if you’d like).  If you click on the small triangle in the upper-right of the gnome-do window you’ll see Preferences.  You can poke around in this preferences area with impunity, but for our purposes again we are just making one change.  On the Keyboard tab you are going to change the shortcut for Summon Do.

You are supposed to be able to double-click on the current shortcut (in this case likely just Disabled) and give your new shortcut.  I have had to quadruple-click in 13.04 and I don’t know why.  Regardless, change that shortcut to super+space.  Again, test this to ensure that when you hit super+space gnome-do is summoned.


Unfortunately there was a quirk: I would create the shortcut for super+space and it would revert to Disabled at every reboot.

If you find that the key binding for gnome-do is not persistent (and I found this to be the case on every 13.04 system I tested), there is a fix.  After persistence fails on reboot, return to the gnome-do preferences and set the shortcut for Summon Do to ctrl+space.  Reboot.  Now when you hit super+space (yes, super+space) it should work and it should remain persistent.

Enjoy your gnome-do.  I know I do.


Archiving in the Land of On-Line Archives with Outlook


Back when Outlook used to require users to keep archived mail locally—you know, back when hard drives were small—there was a useful feature for automatically archiving mail along definable parameters (like age and size and so forth).  Now that storage space is in many respects limitless Microsoft has caught up and allowed greater storage on the server-side for archived mail.

Here at Pop we, upon request, allow users access to their very own on-line archive.  The advantage of an on-line archive over the old-style local archive are significant: you have access to the archive from anywhere you have access to your regular inbox.  However, there is a price to be paid.  For whatever reason, once the on-line archive has been activated for a user Outlook no longer displays any mention of the auto-archiving features and functionality.  The menu items are not merely grayed-out; they are gone from the menus completely.  It’s like double-think.


Anyway, I have written this page as a helpful guide for users looking to automate at least some aspects of the archiving process using their on-line archive.  The sleek auto-archiving features are gone, so we’ll have to make-do with a clever deployment of rules.

These rules will run client-side (within Outlook) and thus can only be run while using Outlook.  (The mail archived using the rules would subsequently be accessible from Outlook Web Access, but there is currently no way to run these rules from OWA.)

Let’s take a look at some options for creating rules.

What to do?

It is not currently possible to get the same functionality from a rule as was previously available through the Auto-Archive features, so we’ll try to get as close as currently possible.

Under the HOME tab in Outlook’s Ribbon you’ll find a Rules drop-down.

Choose “Manage Rules & Alerts…“.  This will bring up a list of your current rules (if any).

If you have not already done so, please create a new rule to get started (using the “New Rule…” button near the upper-left).

(If you already created a rule for archiving and are just here to run it again, pull up that rule for editing and skip to The Next Section.)

Since there is no template for our purpose, we’ll just hit Next.

Under the area called “Step 1” locate the check box for “received in a specific date span” and check it.  (Uncheck all others.)

Note that “Step 2” remains the same for configuring your rule.  This will be important for subsequent runnings of this rule.

The next line should already read “move it to the specified folder” and then “and stop processing more rules“, so from here we can simply configure our rule for archiving into your On-Line Archive.

The Next Section

If you click on “in a specific date span” you will get a small dialog for choosing a date range.

Check “Before:” and select a date (presumably one month before today) before which you’d like to move messages into your archive.

Click OK.

Now, click on “specified” (within “move it to a specified folder“) and you will encounter a folder selection dialog.

Scroll down and find your Online Archive.  I recommend creating a folder for each year in your archive (2012, 2013, &c) and simply move all old message into the appropriate year.  Either create a folder or select a folder within your On-Line Archive.

(At this point Outlook may try to sneak in a check box for “on this computer only”; you may and probably should uncheck that.)

(If you are planning on duplicating your folder hierarchy in your archive, you will want to select the specific folder you are archiving from your inbox.  Below I will advocate for a flat hierarchy (no sub-folders) in your archive which has substantial advantages.)

Next > Next > Next > will get you to the last page of wizard dialog.  Now the dialog changes a bit.

  • Step 1 shows your name field for the rule (call it Archiving Rule or similar).
  • Step 2 shows options and you will want to uncheck “Turn on this rule“.
  • Step 3 shows the parameters you just configured for your rule.

Click Finish.

Now you should be back at your list of rules.  Double-check that your newly created Archive Rule is unchecked.

Run, Rule, Run

Go ahead and click the “Run Rules Now…” button.

You are now confronted with a dialog for manually running rules.

Check only your Archive Rule.

Note that you can select the folder upon which to run this rule by browsing at “Run in Folder:“.  Running your rule against your Inbox is usual.  (Selecting “Include subfolders” streamlines the process of flattening your hierarchy into your single annual archive folder.  I recommend you checkInclude subfolers“.)

You may want to “Apply rules to:” “Read Messages“, but the default of “All Messages” will typically be appropriate.

Now it’s time.  Run Now.

A Flat Hierarchy

Many of us use subfolders beneath our Inbox.  Some of us even us deep paths of subfolders in complex and organized hierarchies.  However, I recommend using a simple and as flat as possible hierarchy in your On-Line Archive.

There are some values gained from doing this which make the loss of organization insignificant.

Outlook didn’t used to have a very decent search algorithm, but that’s changed as Microsoft tries to compete with Google.  And we benefit.  The searching of the On-Line Archive is quick and efficient; however and for whatever reason, search in the archive cannot search through subfolders.

So, if you use a flat hierarchy you search through everything by searching in that folder.  If you have a complex hierarchy within your archive you must search one folder at a time.

Simple Nearly Flat Hierarchy
Simple Nearly Flat Hierarchy

Keeping your folders clean like this above example will also keep your happy smile clean!


More for Copying Drives or Partitions

We had a Clonezilla image that was too large and so I was testing out different possible methods for cramming that too-large disc image (500 GB) onto a smaller drive (150 GB). I tried just shrinking the partition on the original drive (down to 65 GB), but since the images we create a disc images this had no impact.

I found this article which, while attempting to explain how to cram a larger drive onto a smaller, also includes a screen shot of Clonezilla where Clonezilla tells us it cannot do so.

No, I Can't
No, I Can't

I tried anyway and it failed same as before.  Maybe there is a way to do this (without hacking the files within the image as this clever thread discusses) but I didn’t find it in there.

Instead I opted to try using dd to copy the disc directly from large to small and let it fail when the small drive runs out of space.  In theory this ought to work since the partition table, both of the partitions Windows creates, and all of files are located at the front of the drive.  It’s running now; I’ll add more later.

It works brilliantly.  Just make certain your partition is significantly smaller than the available space on the destination drive so as to ensure all important data will fit before the copying of the large drive fails.  (In my example the 500 GB drive contained a 65 GB partition which was much smaller than the 150 GB destination drive.)

On that note, here is some information on using dd to make such a copy.  If you are going from same or small to same or large this will definitely work (and would be much faster than using Clonezilla as an intermediary).

sudo dd if=/dev/sda of=/dev/sdb bs=1M

In this case my source and destination were drives a and b respectively.  The bs=1M is a lovely addition which will slightly speed up the process according to the below linked thread.

I used GParted to help figure out which were the source and destination drives.  Be very careful.  If you run dd in the wrong direction you have just copied empty space over what you intended to copy.  I have done this; it sucks.

In doing my research I also came across this thread which contained some other useful possible solutions to the matter.

He includes my above mentioned use of dd but he also mentions using cat which I will echo here for your entertainment and edification.

sudo cat /dev/sda > /dev/sdb

This would basically take as input anything (in order) on a and output it to b.  Again, this seems like a plausible solution for going from a larger to a smaller drive.  If I’m able to make a test I’ll add more information.

I tried using cat but I received permissions errors (including using sudo) and I gave up and used dd instead.  I was running an Ubuntu 10.04 live CD so that may have contributed (but I’ve never seen sudo receive a permissions error using the live CD previously).  Also, both drives were unmounted (though this is usually what is desired in a case like this).

If you are copying a Windows drive there is another recommended step.  After you have copied your drive (using dd) you may want to run chkdsk.  If it runs automatically, great.  If not, boot into Windows and run this command to tell chkdsk to run on the next boot cycle.  (In this example c represents your Windows drive.)

chkdsk c: /r

Sorry not to have anything more definitive than the dd solution (which is pretty good).  If you have a vetted solution feel free to post it in the comments.