Category Archives: Hacks & Slacks

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.

Share

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:

c:\Users\Administrator\Desktop\Windows6.1-x64-RefreshPkg.msu

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.

Share

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:

%AppData%\Microsoft\Windows\Recent\AutomaticDestinations

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.

Share

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.

/usr/share/gnome-background-properties/ubuntu-wallpapers.xml

/usr/share/backgrounds/contest/trusty.xml

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.


<background>
  <starttime>
    <year>2009</year>
    <month>08</month>
    <day>04</day>
    <hour>00</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>

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

<!-- Raring -->

...

  <static>
    <duration>595.0</duration>
    <file>/usr/share/backgrounds/Leftover_by_Sagar_Jain.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Leftover_by_Sagar_Jain.jpg</from>
    <to>/usr/share/backgrounds/Stop_the_light_by_Mato_Rachela.jpg</to>
  </transition>

...

</background>

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:


...

<wallpapers>

...

  <wallpaper deleted="false">
    <name>All 13.04 - 14.04 Community Wallpapers</name>
    <filename>/usr/share/backgrounds/contest/all.xml</filename>
    <options>zoom</options>
  </wallpaper>

...

</wallpapers>

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.

Share

When Connections Don’t Connect

Finally fixed a network issue here.  Re-terminated the cat-5 run (both ends) from the attic to the basement.  I was only seeing a 10 Mb connection negotiated between my two 1 Gb switches.  Now I see 1 Gb.  Crimping sucks.  I switched this long run to keystones.

It’s the run from my attic to my basement.  I had to terminate it somehow.  When I realized the connection speed wan’t negotiating properly I did a little testing to ensure there was no other culprit then cut off the crimped ends and installed the keystones.  I was worried after doing the first one (and seeing no change) I was going to have to replace the cable run.  Thankfully re-terminating the opposite end fixed it.

I’d have to drill two large outdoor holes (in and out) for the factory-crimped ends.  Not a very good option.  Keystones are better.  And once I get wall-plates on it will look almost like it belongs.

If it were my house I’d run some cat-6 in-wall and it would be done.  Actually, I’d run a lot of cat-6 and be done.

Share

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:

<Control><Super>

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.

Reboot.

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.

Share

Archiving in the Land of On-Line Archives with Outlook

History

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.

Why?

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!

Share

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.

Share

You Want Netflix, LOVEFiLM, or Redbox on Ubuntu?

Apparently it’s no problem.  It’s no problem not because Microsoft has finally pulled their giant collective head out of their minuscule collective ass; it’s no problem because it represented a challenge worthy of hacking in the open-source community.

You may already be running WiNE on your system.  That’s fine but you’ll need to swap it out for this specially modified version from a guy named Erich Hoover.  He has also built a set of packages for each of those services.

You can find the full instructions over at OMGUbuntu:

[How To] Watch LOVEFiLM, Redbox Instant or Netflix on Ubuntu

Love to hear your success stories or interesting related hacks.

Go get ’em, tigers.

Share

Give Windows Photo Viewer the Lightbox Look

You may have a different (read: wrong) opinion, but I can’t stand looking at an image surrounding by blinding white monitor; it really detracts from the photograph or drawing (or what have you) I’m supposed to be admiring.  Is this why some folks wear sunglasses indoors?  Maybe.

Not all applications do this (the Mac application Preview uses gray for its background color), but Windows Photo Viewer does.  Usually it’s a blinding white light all around the picture.  Well, if you have a Samsung monitor it might be a dingy yellow light.  Microsoft surely blames that on Samsung, in spite of the fact that it is Microsoft’s software which is choosing the background color.  I digress.

There is great fortune in certain corners of the world of computing and here we have one.  It is possible to select the background color in Windows Photo Viewer.

If you have a Samsung monitor you may want to see this thread if my instructions don’t work for you.  There is a Control Panel item called Color Management and on its All Profiles tab under ICC Profiles, you will want to remove any mention of Samsung.  You should have an item (also under ICC Profiles) called sRGB IEC61966-2.1 which is what you want to use instead.  I had it.  If you don’t you may want to look over that thread to see if there is better advice than merely “add it”.

Now let’s change the background color.  This is done (let’s have some fun!) through the registry editor.  Run regedit (pressing Windows-R will open the run dialog, or you can type regedit into the search field in your Start menu).

Navigate to this key:

HKEY_CURRENT_USER ——> Software ——> Microsoft ——>  Windows Photo Viewer ——> Viewer

Right-click in the right-hand pane and choose New ——> DWORD (32-bit) Value.  This will create a new item which you will call Backgroundcolor and then give a hexadecimal value which corresponds to your preferred background color (black is ff000000 which is really ff followed by the color black and I’m not clear why the ff is neededdon’t shot the messenger).

Depending upon your Backgroundcolor choice you may want to either create or alter your Textcolor key as well.  Follow the same above procedure for creating the key or if it already exists merely double-click it to change the hex number.

(I believe using HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER will change this for all users, but I have not tested this.)

Have fun with that.

Share