Tag Archives: ubuntu

Live from Hardy Herron

Yesterday seemed like as good a time as any to actually do the upgrade to Ubuntu 8.04 on my laptop. A series of wireless card crashes got me fed up to the point that I had to do something.

The upgrade, via update manager, only had one hitch, when the wireless card bonked out in the middle of it. I suppose it adds appropriate insult to injury, given how often the iwl4965 crashed on my over the last couple of months. Resuming the upgrade on wired ethernet, and all was well.

The Good

Upgrade went flawlessly; fonts look even better; wireless seems better; ssh-askpass now seems to actually trigger on login; firefox 3b5 is fast; liferea is much faster

The Bad

Pidgin 2.4’s usability improvements are anything but; A few of my firefox plugins (delicious links, firebug) don’t work with firefox 3b5 yet (as such, my daily links won’t be on the blog until delicious gets fixed).

The Amusing

During installation some 3rd party packages were removed, including Lotus Notes. While I appreciate Ubuntu’s attempt to make my life better, I sorted of need that for work. ๐Ÿ˜‰ I’m pulling from our internal repos now.

The Year of The Linux Desktop?

Like all previous years, this year probably isn’t any different, and it won’t be the break out year for Linux on the Desktop.

But…  (there’s always a but).

Something interesting happened over the last year.  People I never expected to be Linux users have installed Ubuntu.  My sister in law and nephew both count in this list.  At some level “regular folks” have now come to Linux.  I have no idea if this is a trend or not, but I find it interesting regardless.

More fun with dbus

Since my dbus post last week, I’ve been playing around more with dbus whenever I get a few minutes. The modern Linux desktop is pretty good, but with minor tweaks, you can make things even better. (all this code is now up in a mercurial repository called dbus-hackery).

Automating Inactivity

Pidgin makes sounds on every message to me, xchat makes sounds on certain key words. Without these cues, I’d never remember to go check these applications. Because I have a tendency to leave my laptop on overnight, I found that I’d often have xchat ringing away at midnight when someone was looking for me. If I forgot to mute my machine before that, it would often wake me up.

One of the programs sending signals on dbus is gnome-screensaver.

def connect_screensaver(session_bus)
    ss_dbus = session_bus.service("org.gnome.ScreenSaver")
    ss = ss_dbus.object("/org/gnome/ScreenSaver")
    ss.introspect
    if ss.has_iface? "org.gnome.ScreenSaver"
        ss.default_iface = "org.gnome.ScreenSaver"
        puts "Connected to screensaver"
    end
    return ss
end

def mute()
    IO.popen("aumix -vq") {|r|
        r.read.scan(/(d+)/) {|m|
            @@vol = m
            puts "saved volume: #{@@vol}"
            break
        }
    }
    puts "muting"
    system("aumix -v 0")
end

def unmute()
    puts "unmuting"
    system("aumix -v #{@@vol}")
end

ss = connect_screensaver(session_bus)

ss.on_signal("ActiveChanged") {|s|
    if s
        mute
    else
        unmute
    end
}

The connect will look exactly as expected from the previous look at dbus. The ActiveChanged signal outputs a single parameter, a boolean, which is true when the screensave goes active, false when the screensaver is deactivated.

Volume control on the command line is most easily done with aumix (though if you are on Ubuntu Gutsy you’ll have issues until you rebuild aumix yourself. Hopefully they’ll fix that bug soon.) A little regex fun captures the current levels to a package variable, and restores them back on unmute.

Now I’ve got global mute when the screensaver fires, restored when I return.

Better Away with Pidgin

My screensaver being locked is a pretty clear indication that I’m away, though it being unlocked isn’t a clear indication that I’m back. Especially on weekends, I pop back for a quick check of something, then the computer is put away again.

def set_away(pidgin)
    puts "trying to set away"
    name = "screensaver"
    status = pidgin.PurpleSavedstatusFind(name)[0]
    if not status > 0
        status = pidgin.PurpleSavedstatusNew(name, 5)[0]
    end
    puts "Status #{status}"

    pidgin.PurpleSavedstatusSetMessage(status, "screen saver auto away")
    pidgin.PurpleSavedstatusActivate(status)
end

ss.on_signal("ActiveChanged") {|s|
    if s
        mute
        set_away(pidgin)
    else
        unmute
    end
}

In order to set a status with a message, it has to be a saved status. To prevent growing that to infinity, I first look to see if it is defined, creating a new saved status if not. 5 is a magic number here meaning STATUS_AWAY (reference the pidgin status.h for more info). Then we set the message on that status, and activate it. A single line change on our screen saver signal adds this into play.

Keep on Hacking

One of the things I’m hoping to impress in these posts on dbus is that with a highly functional language like ruby, linking applications on a modern gnome desktop can be done even by mere mortals. Linking sound to your screen saver is something that would have required a reasonable chunk of c code. Now you can do it in 20 lines of ruby, thanks to dbus.

I’ve thought about creating some sort of extended control panel to enable the features I’ve hacked together, but the reality is the code is so small, and so simple, it seems like overkill. With code this easy, you should just jump in and hack it to your own needs.

As I keep playing with dbus, I’ll post more bits here. Twitter integration is still on my list of things to do, and maybe something I’ll even manage to get to this week.

USB Passthrough with VMWare and Ubuntu 7.10

While I don’t run windows on any physical hardware, I have a VMWare windows xp guest on my laptop that I use for a couple of applications. One of which is the programming software for my Logitech Harmony remote.

In my recent laptop update to Ubuntu 7.10, VMWare Server lost the ability to pass through the USB bus to the guest. Fortunately, a quick search on the VMWare forums came up with the following:

Please open the following file: /etc/init.d/mountdevsubfs.sh by following command – gksudo gedit /etc/init.d/mountdevsubfs.sh

Find the following lines:
#mkdir -p /dev/bus/usb/.usbfs
#domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
#ln -s .usbfs/devices /dev/bus/usb/devices
#mount –rbind /dev/bus/usb /proc/bus/usb

Unmark them so that look like this:
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount –rbind /dev/bus/usb /proc/bus/usb

Restart and your usb devices will be recognised

This worked like a champ, and now I can do the rest of my pre thanksgiving tweaks on the remote. ๐Ÿ™‚

On returning to Gnome

Just over a week ago I completely my conversion to Ubuntu (my laptop was the last machine over).  One of the reasons for doing this conversion was to get the benefits of some of the gnome stack, like dbus, which are very nicely configured in the Ubuntu environment.  It meant that after about 1.5 yrs with Ion, I gave it up for the default Ubuntu Gnome environment.

Running Ion for a year and a half gave me perspective on a few features that are really nice:

  • Go to Window By Name – Alt+G, start typing a window title name, go
  • Go to Urgent – Alt+K, jumps you to windows that need your attention
  • Go to Prev – Alt+K, if no urgent, jumps between current and last window
  • Dynamic Desktop Creation – for a new work effort move everything to a new workspace that is relevant to it
  • Kludges – policy based placement of windows so Pidgin stays on it’s own workspace
  • Full screen windows are the way to go
  • Scratchpad – a frame that is smaller than the rest of the workspace that pops up and back on demand.

There were also a lot of drawbacks:

  • Ion had so many key bindings it tended to collide with xemacs bindings (like Alt+G).  I lost some xemacs functionality while running Ion
  • Ion didn’t really do multi window applications well, like Inkscape or Gimp.  There was a float workspace type which acted like very old fvwm.  As such I tended to use Gimp and Inkscape less because they were hard to manipulate in the environment
  • Tumo (the Ion maintainer) decided that people were forking his software, so he removed access to the darcs repository, and you could only get snapshots.  And he changed the default license to something very odd.  Running a software stack that is fundamentally unsupportable because the maintainer is actively trying to make it hard for people to get source access is bothersome.
  • Config formats changed, and 2 attempts to roll forward to something current wasted 2 hours each.

One of the reasons for Ubuntu is that their community support is pretty good, and using main path base software was what I was looking for.  But I learned a lot of lessons in the time with Ion about things that I liked, and wanted to duplicate in a gnome environment.

Policy Engine

After watching many people in meetings on MS Windows get a sensitive IM while they are giving a presentation, and scrambling, you realize the value of a policy engine for windows placement.  IMs are always on Workspace 5, always.   My presentation won’t be on  Workspace 5, so  I can get to the IMs when I’m ready to deal with them.

One upon a time, the default gnome window manager did this.  Then we got Metacity, which pretty much can’t do anything (interesting enough that compiz is bringing features like this back).  The fact that useful features are being slipped past the anti-feature HIG overlords under the guise of eye candy has a certain irony that you don’t find many places. ๐Ÿ™‚

However, my laptop is old.  It can’t do compiz.  That’s ok, as Devil’s Pie can do it for you instead.  Devil’s Pie lets you create small policy files in lisp which control window behavior.  Before you run away screaming because of this being lisp, look, it isn’t that bad:

(if (is (application_name) โ€œfirefox_binโ€) (set_workspace 2)

See, didn’t make you blind or anything.  The policy for devil’s pie is way easier to grok than ion’s kludges file, and provides a few more options.

Scratchpad for Terminals

Remember Quake?  No?  Well it’s that first person shooter all us old folks rave about, as it existed prior to 3D hardware, and let us waste nights in college on our brand new Pentium computers.  When you hit the tilda button, you got a drop down console, that did an overlay on your screen, and let you type in commands, or Say stuff.

Behold Tilda.  The default configuration actually does look like the Quake overlay.  With a bit of configuration you can make it look like an Ion scratchpad with a terminal embedded.

Unfortunately I’m having mixed success with rendering in Ubuntu 7.10 (plus a bad interaction with the next piece of software).  I’m bad, and haven’t sent in a bug report, but I will so.  When tilda was working for me, it was great. 

In full disclosure I need to say I found out about Tilda by listening to LUG Radio, where Aq brought it back in the spring.

Desktop Navigation

Once I started to use Gnome again I knew I needed better desktop navigation than the default.  I even set aside most of a weekend to write my own “go to window by name” program, as I was convinced that libwnck would give me enough to do that.  While writing a bunch of sample code that would get, but couldn’t set window properties, I found superswitcher.

Superswitcher takes over your Windows key and/or Caps Lock and creates all manner of interesting key strokes to navigate and control your work spaces.  I’m pretty convinced it was designed as the ideal test can for libwnck, as it seems to use all the features in there.

You can dynamically create/destroy workspaces, navigate very nicely through windows based on typing partial names.

Things that I still want

Tilda to work.  After a few rez / derez of tilda on gutsy, it stops displaying properly.  I need to file a bug on this.

Jumping to urgent windows with Alt+K, and a command line interface to “Go to window by name”, which let’s me have an edit command that loads a file in xemacs, then jumps my focus there.  With the code provided by superswitcher and devilspie that shouldn’t be too bad, as soon as I figure out why libwnck was ignoring all my set requests for focus and workspace changing.

Superswitcher currently segfaults when tilda is running.  This has to do with tilda not being in any workspace, which defies the superswitcher logic.  Should be an easy fix, just need to carve out an hour or two to do it and send it in.

What makes you productive in Linux?

Sit down and think about it some time.  Post a comment about it, I’d love to hear your thoughts on this, as well as any experiences with other interesting Linux desktop tools that collectively make your environment optimized.

Switching to Ubuntu

In the last month I decided to switch my primary Linux distro from Mandriva to Ubuntu. It will take me until the end of the year to fully switch over, mostly because my work laptop can’t really afford the downtime, and it is scheduled for replacement come November anyway. There were reasons for leaving Mandriva, such as:

  • Stuff doesn’t “just work” on Mandriva any more. Recently I was doing some work where I wanted to reevaluate IDEs. The monodevelop and eclipse packages that I could get for the distro fell over sideways immediately. ๐Ÿ˜ฆ Even f-spot doesn’t work out of the box.
  • The perpetual issue that it took a month after release for the package install mirrors to sort themselves out, and the club urpmi repository has broken ssl certs, so curl won’t work with them.
  • 2007.1 breaks 3D on my laptop, so I can’t upgrade. Even though it is only basic 3D, it is enough to run the test apps I need for my work. In the current rev of Mandriva, I’m SOL.

There were also plenty of really good reasons to go to Ubuntu:

  • Being familiar with what I’m handing out. 12 months ago Ubuntu became the clear winner in the “Hey new person at our LUG, if you want to try Linux you should start with this“. Canonical sends me a bag of CDs whenever I ask for them, and they make good give aways at the LUG. I’d say better than 50% of our LUG is now on Ubuntu.
  • Easy for schools. I started doing some work with public schools in getting free / open software into them. Ubuntu / Edubuntu is definitely a good place to start. Again, being able to help support these folks with what they are using is a good thing.
  • Mono Integration. Ubuntu has been staying on top of the bleeding edge of Mono, as they use it for a lot of their featured desktop aps. Mono/C# is now part of my day job, so having the latest and greatest is a good thing.
  • Mark Shuttleworth.
  • Launchpad. Unlike all the rest of the distros the Canonical folks are actually spending time on their own support infrastructure, which is really good. While I wish they would support hg in addition to bzr for source management, it is a quite good start.
  • Polish. Ubuntu installations only start from a Live CD, so you can know that your system works with Ubuntu before trying to install. This means your risks of having a multiday failed install are drastically lowered.
  • Mark Shuttleworth. Seriously, go read his blog. He is an incredibly inspiring guy, and has really provided a vision of Linux hackers / users as human beings instead of IT trolls snapping at users.
  • Raw numbers. The number of Ubuntu users are on the rise, quickly. For instance, nomachine offers Ubuntu packages for their NX software. This has the side effect that I’ll be able to create less custom packages, as many more folks are packaging for the platform.

I’m sure I’ll think of more reasons, and rationale as I progress down this new road. I’ll also post on various bits about Ubuntu I’ve found either good or bad in the process. Other than the lack of a service command (which I’m just going to build my own package for, as muscle memory on tab completing that is too hard to break), the transition has been very smooth. My home desktop was migrated last weekend, and the media server just a couple of hours ago. Once I get back from vacation, I’ll start hitting some of the boxes at work that I maintain.

Nagios revisited, the debian way

I have to give the debian/ubuntu folks some credit for their packaging of nagios. While the mandriva configuration was pretty straight forward, you had to normalize things a lot yourself, otherwise you were adding 20 new lines for each service and/or host.

The configuration that is default in ubuntu uses hostgroups very effectively, so you setup a host group for every type of service. If you want to monitor a webserver on a host, you just add it to http_servers. In about an hour I had completely rebuilt my monitoring setup for home and offsite servers, and was getting alert emails again when things go funny.

Nicely done folks, nicely done.