Tag Archives: linux mint

bells and whistles

I mean, for God’s sake, why? Why would I want a ding? What purpose is it serving apart from getting on my nerves? Ok, so a ding might be handy to let you know it’s time to type something. But you don’t need it, and might, just might, want an easy, elegant, solution to switching the damn thing off. Linux Mint has surpassed even Microsoft Windows in providing a pompous, pointless, unwanted, not-easily-switchoffable, ding.

The problem is neatly summarised on this forum post. Simple question, that you’d thing would have a simple answer. Well, the answer is simple, but not elegant. I found it on a website showing tips and tricks for post-mint customization. I didn’t follow the instructions exactly, as I didn’t want to change the sound. I wanted to remove it. Here’s what I did:

Press Alt+F2 to bring up “Run Application” window.
typed gksu nautilus /usr/share/sounds/LinuxMint/stereo into the box.
Rename the original file desktop-login.ogg to destop-login-youcanthurtmeagain.ogg

and that seemed to do the trick. I thought I might need to create a blank empty sound file containing NOTHING, but Mint didn’t appear to complain when it found nothing annoying to play before asking me to login. It doesn’t feel a very elegant solution, but it works.

Grub2 – multiple OS – menu display

I guess it’s progress. There was a time when I used to have machines configured so that, if on boot, I held the shift-key down, I got a menu for multiple boot choices on a dual-boot PC.

So let’s just spell that out.

On a dual boot PC, what I want to do is be able to access the grub menu on boot, if I feel like it. And if I don’t, I just want it to silently boot the default OS.

9 times out of 10 I want my PC to just boot up the default OS without questions. And if I want to interrupt the boot and get the grub menu, I want to be able to do that. It’s not much to ask.

That’s it. That’s all I want. Used to be able to do it. Now I can’t. I’ve just spent a couple of “surely I’m missing something really obvious” hours looking for the tweak, the variable, the switch to do this. And I don’t think you can. Can you?

I have had the hilarious pleasure of setting


in /etc/default/grub. Certainly not one of my better ideas, but nice to know I’m not the only one. I needed a visit to unetbootin to create a bootable usb drive to fix things. Even that was a bit inelegant, involving as it did directly editing /boot/grub/grub.cfg on the root partition, then rebooting, then ‘doing it properly’ by editing /etc/default/grub and running update-grub.

So all I want is to have the machine quietly booting into Windows7 by default, and if I choose otherwise, allow me to interrupt the boot and get the grub menu. I use to do this in LILO, and I’m sure it used to be possible in GRUB. Now I’m not so sure.

I’ve even tried step 11 of the GRUB2 tweaks, and that did something. It hid the menu altogether. Not what I’m after. And I’m wary of hacking config files too much, secure in the knowledge that they have a habit of getting unhacked on upgrades.

So I’ll give up on this one.


Wireless not enabled automatically on Acer Aspire One

The first problem, or niggle really, is the wireless. When I boot the netbook wireless is not enabled automatically. It’s a simple matter to right-click the network manager applet and select Enable Wireless, then everything seems fine. Just annoying.

So of the the University of Google to find who else shares my pain. Before long I discover that this might be an Acer thing (none of my other PCs have this problem). Like many problems there’s often lots written and complex solutions. I don’t want complicated solutions, I just want the loose-wire solution. Press a button and it’s all lovely.

Sure enough, a post on the Linux Mint forums described exactly what I’m experiencing. There’s another forum post that describes one fix, but I ended up following the hints described in this thread.

Sometimes I like to understand what’s going on under the bonnet, sometimes I try and understand what’s going on, and sometimes I just copy and paste. Like so …

dougie@barra ~ $ rfkill list all
0: acer-wireless: Wireless LAN
    Soft blocked: yes
    Hard blocked: no
1: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
dougie@barra ~ $

and …

dougie@barra ~ $ sudo rmmod -f acer-wmi
dougie@barra ~ $ sudo rfkill unblock all
dougie@barra ~ $ rfkill list all
1: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
dougie@barra ~ $

As soon as I ran the rmmod line the wireless suddenly sprang into life.

The next trick is to get this to happen automatically on boot, which is pretty straightforwards. Just add the lines to the end of /etc/rc.local as explained in post 12 of this thread.

f-spot, exiftool, exiv2, and exif header weirdness

I decided to revisit an old bug that I logged about a problem I have with f-spot handling of exif headers. Now I’m more confused than ever. I can see what’s happening, but not how or why.

The problem I’m having is that when I upload some photos to gallery websites the handling of exif data doesn’t appear consistent. For example, have a look at this photo. If you look at the right hand side of the screen where the photo title is shown it also shows the caption. It looks like this:

From Zenfolio gallery

Now have a look at the same photo uploaded to picasaweb (the sizes are slightly different – I think picasaweb changed them on the fly when I uploaded via google plus). In this case there is no garbled text and picasaweb has used the exif description field for the photo caption. i.e:

from picasaweb

So what’s happening here? Well, here’s what I think is happening. Picasaweb is extracting the caption from the exif field Description, and Zenfolio is extracting the caption from the field UserComment. Here’s what I get if I run exiftool on the image file (you might need to click on the image to see it properly):

exiftool -UserComment -Description test1.jpg

As you can see the UserComment field contains garbled characters.

A lot of my photos have this and the inconsistencies can cause me headaches. I decided on a brute-force scan of my photo collection to address the issue. I thought, why not just duplicate the Description field into the UserComment field? That way, whatever package or gallery reads the image file will probably get the caption. So here’s the script I used:


#       Process all jpegs and overwrite UserComment field with Description
#       field where they differ.
find /jpegs -type f -iname '*.jpg' | while read fname
        field_usercomment=$(exiftool -UserComment "${fname}" | sed 's/^.*: //')
        field_description=$(exiftool -Description "${fname}" | sed 's/^.*: //')

        if [[ "${field_usercomment}" != "${field_description}" ]] ; then

                echo "$fname"
                echo "User Comment: ${field_usercomment}"
                echo "Description: ${field_description}"

                echo "${fname}"
                exiftool -overwrite_original -UserComment="${field_description}" "${fname}"

After a satisfying hour or two my photos all looked a bit tidier. So now I have a cludge – something that will get round the problem. But I’d really like to treat the cause, and not the symptom. So what’s the cause?

My first guess has always been the camera. I have a knackered old Nikon Coolpix that gives me problems. But I see this problem with other cameras too, my Canon DSLR and compact camera have acquired the garbled field in some pictures too.

So I turn to f-spot, the photo-management software I use in Linux Mint. I checked the exiftool output from a test file, then imported it into f-spot. I then added a tag so that f-spot would write out the exif data (I have f-spot configured to Store Tags and Description inside image files where possible) then had a look at the image file. Here’s what I got:

exiftool output

The output from the first invocation of exiftool is on the jpeg before importing into f-spot. The second example shows the output of exiftool run on the file after it has been imported into f-spot. It looks like f-spot does something to the image that mangles the UserComment field.

At this point I assumed (erroneously I think) that f-spot must be storing the UserComment and Description fields in its sqlite database. Using sqlite3 on the command line I had a look at the structure of the photos table:

dougie@phoenix ~ $ echo '.schema photos' | sqlite3 .config/f-spot/photos.db
    time            INTEGER NOT NULL,
    base_uri        STRING NOT NULL,
    filename        STRING NOT NULL,
    description        TEXT NOT NULL,
    roll_id            INTEGER NOT NULL,
    default_version_id    INTEGER NOT NULL,
    rating            INTEGER NULL
dougie@phoenix ~ $

There’s the description field, but no UserComment field. But it looks to me that f-spot is certainly writing to the UserComment field when it updates an image file. Perhaps it’s dependent on the type of contents of the Description field. It doesn’t, however, make any difference as far as I can tell what the contents of the Description field are. In this example the text ends with an exclamation mark, but I can’t detect any pattern in the text I put in Description fields that might provide a clue.

So if f-spot isn’t storing the UserComment field directly what, when, and why is it writing to the field in the image file? It seems that here we enter the murky world of XMP and I rapidly lose the tenuous grasp I had on the underlying technology up to this point.

Back in 2008 there was a discussion on the f-spot mailing list about how f-spot stores its data in the image file. Re-reading that thread it sounds as if f-spot writes its tags to the XMP metadata and not all utilities are able to read that. This was 2008 mind, and f-spot has jumped a few versions since then.

Out of the same thread came a hint on using exiv2. This is a tool I use a lot, especially for adjusting ‘date taken’ timestamps, but hadn’t found it any use for extracting the UserComment field. It turns out I hadn’t RTFM properly and it is possible if you tell exiv2 to look at XMP data. This leads to some interesting output. Here is the example file again, using both exiv2 and exiftool to examine the field contents:

dougie@phoenix ~ $
dougie@phoenix ~ $ exiftool -UserComment -Description /jpegs/2011/07/17/test1.jpg
User Comment                    : 桷⁹畲污湯⁧桴⁥敢捡⁨桷湥礠畯挠湡挠瑵琠敨挠牯敮ⅲ††††††††††††
Description                     : why run along the beach when you can cut the corner!
dougie@phoenix ~ $
dougie@phoenix ~ $ exiv2 -p a /jpegs/2011/07/17/test1.jpg
Exif.Image.ImageDescription                  Ascii      77  why run along the beach when you can cut the corner!                        
Exif.Image.Software                          Ascii      21  f-spot version 0.8.0
Exif.Image.ExifTag                           Long        1  162
Exif.Photo.DateTimeOriginal                  Ascii      20  2011:07:17 09:37:13
Exif.Photo.UserComment                       Undefined  84  why run along the beach when you can cut the corner!                        
Exif.Image.GPSTag                            Long        1  296
Exif.GPSInfo.GPSVersionID                    Byte        4
Exif.GPSInfo.GPSLatitudeRef                  Ascii       2  North
Exif.GPSInfo.GPSLatitude                     Rational    3  55deg 32' 25.410"
Exif.GPSInfo.GPSLongitudeRef                 Ascii       2  West
Exif.GPSInfo.GPSLongitude                    Rational    3  1deg 37' 58.960"
Exif.GPSInfo.GPSAltitudeRef                  Byte        1  Above sea level
Exif.GPSInfo.GPSAltitude                     Rational    1  9.5 m
Exif.GPSInfo.GPSTimeStamp                    SRational   3  09:37:13
Exif.GPSInfo.GPSMapDatum                     Ascii       7  WGS-84
Exif.GPSInfo.GPSDateStamp                    Ascii      11  2011:07:17
Xmp.xmp.CreateDate                           XmpText    19  17/07/2011 09:37:13
Xmp.xmp.Rating                               XmpText     1  0
Xmp.xmp.CreatorTool                          XmpText    20  f-spot version 0.8.0
Xmp.dc.description                           LangAlt     1  lang="x-default" why run along the beach when you can cut the corner!                        
Xmp.dc.subject                               XmpBag      2  Dougie Nisbet, Coastal Run - 2011
Xmp.exif.UserComment                         LangAlt     1  lang="x-default" why run along the beach when you can cut the corner!                        
dougie@phoenix ~ $

Interestingly, exiv2 is displaying the UserComment data in clear text, in two places, which I’m guessing must be something to do with the different types of metadata – XMP and EXIF.

So does this mean this has nothing to do with f-spot at all? If exiv2 is able to read the text, perhaps it’s something to do with the utility used to examine the image file? If I have a look at the file using geeqie and open up the EXIF window geeqie seems to understand the text too:

geeqie EXIF window

Perhaps this is an unrelated setting I need to have a look at. Language, Locale, who knows. The issue seems to crop up in different places so it may very well be unrelated to f-spot. For the time being I have a fairly straightforward work-around, I just need to remember to run a script to copy the description field into the UserComment field for any images I update in f-spot. It’s a bit of a nuisance but fairly easy to automate, and a lot less time-consuming than trying to get to the bottom of the mystery!

Mask files, sizes, and motion.conf tweaks

The tweaks don’t seem to be having much effect. Even with the lightswitch option set to 80, and the smart_mask_speed set to 10, it’s still pretty wild and windy out there.

# Dynamically create a mask file during operation (default: 0)
# Adjust speed of mask changes from 0 (off) to 10 (fast)
smart_mask_speed 10

# Ignore sudden massive light intensity changes given as a percentage of the picture
# area that changed intensity. Valid range: 0 - 100 , default: 0 = disabled
lightswitch 80

So it has to be the mask file. The way the mask file works is by using an identically sized image as the webcam and making all areas to be monitored white, and all not to be monitored black. Or is it the other way around? I did this using the gimp and after a couple of false starts it turned out to be pretty easy. Here’s my rough notes:

  1. Make a copy of an existing webcam image to use as the template. This way the dimensions of the image will be correct
  2. Use the Free Select Tool (it looks like the laso) to select an area that you want to be monitored for movement.
  3. Select Bucket Fill. Under the section for Affected Area make sure it’s ticked for Fill Whole Selection. Make sure your foreground colour is white (I kept getting this wrong. It doesn’t matter. Just click on the arrows to reverse foreground/background and do it again).
  4. Click on the area to be filled and it should fill with white.
  5. For the background, go to Select -> Invert, then swap your foreground and background colours. Click on the area you want to be black

You need to save this as a ‘pgm’ file. For some reason a pgm file is huge compared to a jpeg, e.g.

-rw-r--r-- 1 dougie dougie 691254 2011-05-25 14:24 mask1 - 25May2011_1407.54-00.pgm
-rw-r--r-- 1 dougie dougie  12639 2011-05-25 14:26 mask1 - 25May2011_1407.54-00.jpg

although I’m sure it’s possible to reduce the size there doesn’t seem much need at the moment.

Mask File for motion

mask file

Now it’s just a matter of pointing the appropriate option in motion.conf at the mask file and seeing what happens.

Here’s my first attempt:



motion.conf options

Hmmmm, there are a few options in the motion.conf file I haven’t seen before. Or at least, that I can’t recall having seeing before. These look promising:

# Dynamically create a mask file during operation (default: 0)
# Adjust speed of mask changes from 0 (off) to 10 (fast)
smart_mask_speed 0

# Ignore sudden massive light intensity changes given as a percentage of the picture
# area that changed intensity. Valid range: 0 - 100 , default: 0 = disabled
lightswitch 0

The trouble with creating a mask file is that it assumes the camera stays fixed in the same position, and that’s pretty unlikely. So I’ll try tweaking these settings and see what happens. Far less effort. Currently running at about 1000 images an hour. Let’s see if I can get that down a bit …


controlling the loco-motion

So here’s the problem:

[slickr-flickr tag=”webcam2″ type=”gallery”]

This is a USB webcam pointing at the nestbox. The software is motion, running on a Linux Mint box, and uploading to my flickr photostream using flickr_upload. There are a couple of homebrew shell scripts involved too.

The trouble is, even though the motion config file can be tweaked and various things twiddled to adjust various thresholds, most of which are black magic, all it needs is a windy day and I find I’ve got 40,000 or so JPEGS on my harddrive. All of blades of grass blowing in the wind.

So I think I’m going to have to create a mask file. I can’t remember how to do it, even though I’ve done it many times before. I’ll do that later. And I’ll write it down.

Time delay of adding caption to photo slideshow

photos make a great screensaver and the xscreensaver with glslideshow option is what I use. I often use it for ident practice, e.g. plants, birds etc. The image appears randomly on the screen and I think, I know what that is …

At the moment I have various scripts that can create ad-hoc collections of images based on the embedded tags. I also overlay a caption over the images using the convert bit of imagemagick and that works well.

What I want to do is have a time delay so that an image appears for say, 10 seconds, and then a caption appears over it. The filename would be ok. I can control how long the image appears in xscreensaver, and it’s surprisingly easy to train yourself to not-look at the filename or caption, but I’m curious as to whether it’s possible (without too much effort) to add the caption after some time-out period.