Category Archives: Ubuntu

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.

Share

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]
 Identity=unix-user:*
 Action=org.freedesktop.upower.hibernate
 ResultActive=yes

[Re-enable hibernate by default in logind]
 Identity=unix-user:*
 Action=org.freedesktop.login1.hibernate
 ResultActive=yes

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.

Share

Album Art Wallpaper Changer

If you’ve been following along you know all of my music is ripped or downloaded as FLAC and is living on an Ubuntu server here on my network. I do a fair job of scanning in the album art (there are stacks yet to be scanned because it takes too much time, but that is neither here nor there). I thought I’d like to make use of all these scanned covers as rotating background art on my hi-fi machine.

Really there are three problems. First, get a complete list of the cover images. Second, mount that location and list in a useful manner. And third, rotate (randomly) through those images as backgrounds.

First I tackled the mounting part. I already was mounting the music share (referred to as MusicShare in the script) so I simply added an administrative folder (referred to as zetc) in that share which included a folder to house the images. I could then place a shortcut in my Pictures folder on the client machine and make a call to that folder with whatever I used to rotate the images.

Next I wrote the necessary script, but I want to save that for the end so let’s talk about the application for changing the wallpapers now. I selected Wallch and it seems to have all the options I need and seems to work well enough. (I have it running on two machines currently and I have not seen any issues worth reporting.)

Wallch is in the standard repositories so you can locate it in the Ubuntu Software Center or install it using the Terminal (with sudo apt-get install wallch). The only unusual thing I did was add a custom time interval in the Preferences dialog as I wanted a 15 second interval (the included intervals went from 10 seconds to thirty). Set it to randomly select images and called that good.

Let’s look at this script briefly as that’s really the meat of this matter. There are issues with using symbolic links in smb shares (if I serve symbolic links I lose the use of non-Windows standard characters) so I created a folder (as mentioned above) to house the hard links to the found image files.

I didn’t care to sort out proper names for them as I won’t likely ever look in the folder or care about what any particular file is called, so the image links are all named incrementally without regard for album, artist, or location.

Finally, I didn’t want to concern myself with what may or may not be located in my links folder when I run the script again (to create a more current set of links), so I remove all files located in the links folder before filling it up again with the new image links.

Here is my script. I hope this helps you with your music art needs.

##
#!/bin/bash
# by JamesIsIn from JamesIsIn.com
# Do something nice today.

directory="/media/MusicDrive/MusicShare/"
zedfile="/media/MusicDrive/MusicShare/zetc/CoverSlideshow/ZedList"
zedfolder="/media/MusicDrive/MusicShare/zetc/CoverSlideshow/SymLinks/"

find "$directory" -type f -name [Cc]over.[Jj][Pp]*[Gg] -o -name [Cc]over.[Pp][Nn][Gg] -o -name [Cc]over.[Bb][Mm][Pp] -o -name [Cc]over.[Tt][Ii][Ff] > "$zedfile"

declare -a zedfind
let i=0
while read zedline; do
zedfind[$i]="$zedline"
((i++))
done < "$zedfile"

echo "I have found" ${#zedfind[@]} "cover images."
echo
read -p "Press <ENTER> to coninue. "
echo
echo

rm "$zedfolder"/*

for (( ii=0 ; ii < ${#zedfind[@]} ; ii++ )) ; do
originalfile=$( basename "${zedfind[ii]}" )
echo "Creating link:" $ii-"$originalfile"
ln "${zedfind[ii]}" "$zedfolder"$ii-"$originalfile"
done

unset

exit

##
Share

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.

##
#!/bin/bash
# by JamesIsIn from JamesIsIn.com
# 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'

##
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

Some Good and Bad News in Ubuntu 14.04

I have been upgrading certain machines here at work and testing various items along the way.  First one item of concern.

There is a great package out there for Windows domain integration called likewise-open.  We had a 13.10 machine running and connected to our Windows domain using this package.  It’s a great package and it really streamlines the domain membership problem.

Unfortunately there is currently no 14.04 package available in the repositories.  The machine we upgraded is currently not able to log in using domain credentials.  Since it’s Friday at 16:09, I created the user a local administrative level account and we’ll look to doing more as is necessary (but surely next week).

I imagine this package will appear in the repositories before long.  We shall see.  Just be forewarned if you are planning to upgrade any Windows domain connected Ubuntu machines any time soon.

But there is a nice delight to offset this.  The old vmware-view-client package which was broken due to a misplaced dependency and which has finally been removed from earlier-version repositories has been replaced in the 14.04 repositories with a working version.  Now you can use vmware-view-client to attach to your View sessions and you can do so using the VMWare native PCoIP protocol.

Have fun with that.

Share

Installing VMware (Fusion) Tools for Ubuntu 13.04

Recently (not so recently now because I’m a slow blogger) I was installing, or rather attempting to install, the VMware Tools into a virtual machine running Ubuntu 13.04, and I ran into a bit of trouble.  This may happen to you too.

First you’ll see this problem:

Searching for a valid kernel header path…
The path “” is not a valid path to the 3.5.0-26-generic kernel headers.
Would you like to change it? [yes]

Enter the path to the kernel header files for the 3.5.0-26-generic kernel?

Clearly no path (“” <— note the lack of… anything) cannot be correct.  But how do you find the correct path?

The kernel header path in question should be under /usr/src/[your current kernel version]/include.  Of course you’ll need to know your current kernel version.  You can find this by running uname -r (it will return something like linux-headers-3.5.0-26-generic).  So this is the answer to the above question:

/usr/src/linux-headers-3.5.0-26-generic/include

This may yet fail if the headers were not installed alongside the kernel.  Sweat not, little piggies!  Enter this command to install the proper headers:

sudo apt-get install linux-headers-$(uname -r)

Once that install finishes you can hop back over to the Tools installation and insert the above path once again.

The path “/usr/src/linux-headers-3.5.0-26-generic/include” is not a valid path
to the 3.5.0-26-generic kernel headers.
Would you like to change it? [yes]

Enter the path to the kernel header files for the 3.5.0-26-generic kernel? /usr/src/linux-headers-3.5.0-26-generic/include

The path “/usr/src/linux-headers-3.5.0-26-generic/include” appears to be a
valid path to the 3.5.0-26-generic kernel headers.
Would you like to change it? [no]

I hope that helps you get where you want to be.

Share

Switch Audio In/Out More Easily

If you have ever struggled to change from one audio device to another, you’d surely appreciate having a simple click-click method for making that change.  The folks over at OMG! Ubuntu have hipped me to the existence of just such a switcher.

It can easily be done by adding the following repository (or PPA) through your Terminal:

sudo apt-add-repository ppa:yktooo/ppa

You will then be able to install it using your preferred method, either through the Ubuntu Software Center or through a Terminal:

sudo apt-get update && sudo apt-get install indicator-sound-switcher

That’s the long and short of it.  Hope that makes your lives that much better.

Share

Be an Expert Screen Shooter in Ubuntu

I mean, why not, right?

The built-in screen capture software in Ubuntu is pretty good.  Hit a button (Print Screen) and it snaps your screen into the copy buffer.  Then you save it as an image file though a simple dialog.

But, and this happened to me recently, you may find need to capture something like a menu which doesn’t like to stay put while you press the appropriate button.  Fortunately there is a way to work with this.

Take a look at the manual page for the Gnome screen shot application:

man gnome-screenshot

Apparently you can add border effects.  Who knew?

Anyway, for my interests the one to know is the -d or –delay= argument.  This allows you to hit Enter, mouse to the menu, and hover over the item of interest before you screen shot fires.

Try five seconds:

gnome-screenshot -d 5

Exciting, eh?

Pew pew pew!

Share

Evernote, Everpad, and Ubuntu

With Canonical abandoning Tomboy and Tomboy synchronization through Ubuntu One, I have been forced to seek out a different notes solution.  Evernote is very popular, is available for a wide variety of environments (Windows, Mac, Android, &c), and has been mostly free for quite some time.

I’m willing to give it a shot to see how it goes.  I have it running on my work Windows machine and my work Mac.  I have also installed it on my Android tablet.  Finally I installed it on my old Ubuntu 10.04 machine (under WINE) in order to transfer all of my Tomboy notes into Evernote.

In newer versions of Ubuntu you will have access to Everpad.  This is an open source application which takes advantage of the Evernote API (since Evernote has thus far failed to create a native Linux version of their application).

Personally I find Everpad to be a little clunky and it seems to inappropriately fiddle with formatting when synchronizing between instances.  Nonetheless, let’s go over installation and initial set up so you can try it for yourself.

sudo add-apt-repository ppa:nvbn-rm/ppa
sudo apt-get update && sudo apt-get install everpad

You will be required to invisibly enter your password.

Once you have it installed, it’s not very obvious how to get started.

Right-Click Menu
Right-Click Menu

Yep, right-click on the Everpad icon and choose Settings and Management.  This will open the Settings and Management dialog.

Settings and Management
Settings and Management

Now you will need to log into your Evernote account (if you don’t have one, go to their Web site and create one).  Click the Authorise button.

Authorize
Authorize

Log in using your Evernote credentials.

That’s pretty much it.  If you already have notes it will (on schedule) synchronize your notes.  If you’d like to manually synchronize your notes (and again this is not obvious), that’s also pretty easy.

Manual Synchronization
Manual Synchronization

If you click where is tells you about your last synchronization, it will spawn a manual synchronization.  Easy but not obvious.

Again, it tended to goof up my formatting as I moved from Everpad to other instances of Evernote.  As such I am giving Evernote a run under WINE to see how that performs.

So far it seems fine.  If you’d like to try Evernote under WINE, install WINE through the Ubuntu Software Center (or however you’d like) and download the Windows version of Evernote.

Have fun with that.  I’ll report back if I have any issues worth mentioning.

Update:

After having run Evernote under WINE for some time now I can say I see no issue worth mentioning.  You may have some slight trouble with getting the correct icon in the dock (it tends to use the WINE icon instead).  Not a show stopper, obviously.

Share