Ubuntu Dapper HAL update DOESN’T break USB mass storage automounting

The recent update to HAL available for Ubuntu Dapper seems to break USB mass storage device automounting. The broken version is 0.5.7-1ubuntu18.2. (Oops – no it doesn’t… see below).

I haven’t figured out why yet (I will post when/if I do) (ahem), but here’s how to downgrade if you’re affected by this and don’t want to wait on a fix. (But this bit might still be useful if you ever need to downgrade apt packages and fix them to a specific version while waiting for a fix that you really need.)

Run the following command as root:

apt-get install hal=0.5.7-1ubuntu18 \
libhal1=0.5.7-1ubuntu18 \
libhal-storage1=0.5.7-1ubuntu18

You’ll need to reboot. You can use an entry in /etc/apt/preferences to keep these packages to this version until new packages that don’t break HAL are available. Create that file if it doesn’t exist and add the following lines:

Package: hal
Pin: version 0.5.7-1ubuntu18
Pin-Priority: 1000

Package: libhal1
Pin: version 0.5.7-1ubuntu18
Pin-Priority: 1000

Package: libhal-storage1
Pin: version 0.5.7-1ubuntu18
Pin-Priority: 1000

You should really read man 5 apt_preferences, and you should monitor what updates to these packages become available. I can’t guarantee that keeping these packages at this version won’t break anything else.

I have to say that this has soured me a little on Ubuntu. One of the reasons I chose this distro was because I don’t have anything like as much time to myself as I once did and I don’t want to spend what time I do have troubleshooting minor conifg issues like this on my machine, and Ubuntu has a reputation as a very stable, well maintained distro. USB drive automounting might not sound like a very important feature, but it’s this kind of thing that will put off non-technical users, or even technical ones with small kids and short tempers. Still, I’ll try and look into this problem and maybe file a bug report if no one else has already.

Update 11th December 2006

I now regret writing that last paragraph. To be honest I had misgivings almost immediately after posting it as I thought it a bit harsh but I decided to leave it. Anyway, I have now found that the upgrade did not break USB automounting at all – it was the device I was using to test it. My fault. PEBKAC. The device in question is my Sony Ericsson mobile phone, a K750i. Quite a nice phone, but it is a little temperamental at times – prone to occasional crashes and lockups. Normally this gets mounted as a mass storage device when I plug it in as it contains a 128MB Memory Stick Duo, but every so often it fails for reasons unknown (syslog just says
Device offlined - not ready after error recovery). Having done some reading up on the way that HAL, D-BUS, udev and gnome-volume-manager work I upgraded HAL again ready to start troubleshooting only to find that everything was working fine, then I encountered the error with my phone and all became clear. My CF card reader and Seagate external hard disk both work exactly as they should. The phone mounts most times, but occasionally fails. I think I’ll have less luck toubleshooting that than I would HAL et al. My apologies to Ubuntu for my unwarranted harsh words above.

External Hard Disk setup

I recently purchased a Seagate 250 GB external USB hard disk to use as a backup medium for my home network. This will be connected to my main Linux box (currently running Kubuntu Breezy) and important personal data and system files will be rsync‘d to it on a regular basis.

Herewith some notes on configuration, somewhat distro-specific although not uselessly so. (At least I hope not, as I plan to rebuild my home server fairly soon and may well switch. I’ve been experimenting with Kubuntu after years as a Slackware user and have not settled on a final decision just yet.) On that note: please bear in mind that this post is not intended as a definitive HOWTO but should be considered as my notes on what I did to get this working for me under a particular set of circumstances, with far less time to research everything involved than I’d really have liked. In other words: Your Milage May Vary.

The disk comes preformatted with the somewhat limited FAT32 filesystem. Given that all files being backed-up will be coming from systems running one flavour or another of Linux and that the disk will probably only need to be accessed directly from Linux systems, I’m going to reformat with ext3 using the following steps:

  1. Plug in the disk. Kubuntu detects it and pops open a window asking what to do. I select “Open in a new Window” initially which mounts the disk at /media/sda1 and opens a Konqueror window at system:/media/sda1 to view the volume.
  2. Looks fine. I close Konqueror, open a Konsole window and type sudo fdisk /dev/sda at the prompt to check the partiton table of the disk (type p at the fdisk prompt), which contains no surprises as the disk is one large FAT32 volume. Type q to quit fdisk.
  3. Unmount the disk manually : sudo umount /dev/sda1. This needs to be done in order to format the disk.
  4. sudo mkfs.ext3 /dev/sda1. Wait a couple of minutes for the format to complete.
  5. Check it mounts ok: sudo mount -t ext3 /dev/sda1 /media/sda1. Great.
  6. Check it still automounts properly on power-on by unmounting manually, turning the disk off, then turning it back on again. All fine.
  7. In the default state, the disk is mounted on a dynamically-created directory under /media named for whichever device node it is assigned when it’s plugged in. This means that the mount point may change, making the task of writing scripts to automate the backup procedure more complicated. The following steps go a long way to ensuring that the disk is always mounted in the same place:
    1. Added the following entry to /etc/udev/rules.d/hal.rules (more information on writing udev rules):
      BUS=="usb", SYSFS{product}=="Seagate External Drive", \
      KERNEL=="sd?1", NAME=="%k", \
      SYMLINK=="seagate", GROUP=="hal"
    2. sudo mkdir /media/seagate
    3. Added the following line to /etc/fstab:
      /dev/seagate    /media/seagate  ext3    noauto,rw,user 0 0

    You need to restart your hald for this to take effect. I ended up rebooting, but I couldn’t see why something like /etc/init.d/dbus restart wouldn’t do the trick.

    It’s worth noting that although this does mount the disk under /media/seagate, it still shows up in Konqueror at system:/media/sda1. Not sure why at time of writing – this feels like a bug.

    Also note that I used e2label to the give the device a label (“SEAGATE”). I was initally looking at using this to mount the volume to the desired mount point with a line in fstab starting LABEL=SEAGATE, but the udev/hal fix turned out to be the simplest option(!)

  8. mkdir some top level folders: music, photos and home. Then do an initial series of rsync runs, starting with a simple rsync -av /media/photos/ /media/sda1/photos/. Everything sysncs fine. Now I’ll be able to backup quickly as and when necessary, and write some scripts to automate everything … eventually.

Reclaim the Buses demo and rally

(Hey, it’s amazing what gets you posting to a neglected weblog again after a few months – and in the end it wasn’t until well after the Spring Equinox. Oh well, on to the matter in hand, and this time I’m not even going to suggest when I next expect to post.)

Polly and I went along to the demo with Uma and a couple of friends; since we all sit around bitching about the terrible bus service in the city it seemed right to support a group that aims to improve matters. I was curious, too, as I’ve never been to a demo or rally in Bristol and was interested to see who and how many would turn up. I was a bit concerned that there’d only be a handful of us and that the event would get hijacked by the usual suspects, the ones that turn up to any and every protest event with an agenda of their own and a load of branded publicity materials, and for a while it seemed my fears might be realised: we arrived at Castle Park to be greeted by a line of comrades thrusting newspapers and petitions at anyone who looked even slightly interested in the motley gang of activists preparing their banners and placards in the background. At this stage the gathering looked less like a protest at the state of the bus service in Bristol and more like a recruitment drive for any number of local left-wing political factions.

For a while this annoyed me so I’m going to indulge in a minor rant. At larger, better attended events the presence of these guys peddling their papers and ideas has less impact as they tend to fade into the background and help bulk up the numbers, but at smaller event like saturday’s demo they can end up dominating proceedings. This is a real problem for a group that wants to build up a broad base of support as they tend to warp the agenda and put people off. Pretty much every sane person in Bristol would agree that First provide an unreliable and massively overpriced bus service that falls way short of meeting the needs of the population, but this does not mean that they want to sign SWP petitions tenuously linking the war in Iraq to the issue of the day, call for more general re-nationalisation programs, abandon capitalism altogether for some unlikely socialist utopia or even become associated with these views by attending events where they appear to be the dominant ideology.

Anyway, I digress. Having successfully avoided paying money for party political propaganda from the paper sellers we made it over to the gathering crowd where eventually a Marshall gave us a bunch of leaflets and a hand-made placard to carry. As time went on the crowd grew until there were around a hundred or so people armed with Reclaim the Buses banners headed-up by two large cardboard buses parodying First’s livery. As this was Uma’s first demo, we thought she might appreciate the chance to join in so we gave her the placard to carry. (I’m not sure whether she approved – for all I know she might wholeheartedly support privatisation – but being only one year old and unable to speak she was left with little choice.)

[Uma in pushchair with placard]

She didn’t follow the march all the way round the city centre anyway, as despite having been told by one of the marshalls that we were going to go along the river on a quieter, more pedestrianised route we ended up wandering down the middle of the road through central Bristol while the traffic piled up behind us (including, amusingly, a line of First buses that looked for all the world like part of the procession). Mark and I took Uma and left the march after a while when it became obvious that some of the drivers were becoming annoyed with the protest and getting aggressive towards the demonstrators. We watched from the sidelines as the parade moved through the city centre and up and down Park Street before gathering on College Green for a rally. At this point we decided we’d done our bit and went to a nearby cafe for tea and sandwiches.

[The protestors marching through the city centre]

I reckon the organisers can count the event a success. The props were eye-catching and the volunteers handing out leaflets friendly and enthusiastic. Apart from a handful of idiots in their cars most people treated us all with good humour. The city was busy so a lot of people will have seen the demo and been given a leaflet, boosting the profile of the campaign. Despite the relatively low numbers and my initial fears I don’t think the event suffered too much from hijacking by opportunistic political activists as most of the banners and leaflets distributed during the actual march were fairly non-partisan.

As I mention above, I don’t think that anyone in Bristol is going to seriously argue against the proposition that the bus service is very poor. There may be some debate over how to deal with this and not everyone might agree with public ownership, but the presence of a campaign trying to focus some attention on the problem has to be a good thing if it inspires more people to actually do something rather than glumly accept the status quo. Even if that’s just giving a local councillor an earful on the issue over the coming weeks as they campaign for votes in the upcoming election it’ll be worthwhile.

Personally, I think that Bristol is too small for a free-market solution, although my objections are based on practical rather than ideological grounds. The market in Bristol just isn’t big enough to support the kind of competition necessary for this approach to work, so there has to be some level of public control or regulation to ensure the service meets the needs of the city. This isn’t really my field so I don’t have any detailed suggestions about what kind of model we should adopt, but if other cities can find a decent balance then I can’t believe that it’s not possible here – it just needs some political will. Nor do I believe that anyone can seriously argue that this isn’t desirable – Bristol is clogged with traffic but to get people out of their cars there must be a viable alternative, and at the moment there just isn’t.

Still alive, but tired

Bloody hell, I’m knackered. This is the first chance I’ve had since last week to even sit down in front of my computer, let alone actually use it to do anything, such as read email or surf the interweb. This is due in part to getting a few days work at short notice – as I’d left all my seasonal chores until the last minute based on the pessimistic assumption that nothing would come up this side of Christmas, this has resulted in a rather manic weekend getting everything sorted.

Still, life has generally been pretty full recently despite being out of work – having a small child around leaves you with very little scope for much else. Most of my other projects are on indefinite hold right now, and will probably remain so for some time. That includes posting here and to Uma’s website – although I’m just taking advantage of a small lull to write this and put up a new baby photo, so if you want to see pics of Uma and you don’t have the password, send me an email and I’ll let you know.

What else what else… well, I’m still looking for permanent work. If you’re in the Bristol area and you need a geek, particularly one who speaks Linux, please think of me. Also – Polly and I marked our ninth annniversary last weekend. Wow. Here’s to us, Pol, especially now there’s three of us!

That’s all I’ve got time for right now. Maybe I’ll post again on Wednesay to mark the Winter Solstice. Or maybe it’ll be nearer the Spring Equinox before I get around to it again…

Posted in Uncategorized

Bristol No2ID

[Bristol No2ID Logo]The Bristol branch of the national campaign against ID cards and the hideously Orwellian National Identity Register have stepped up a gear lately and are making news locally and nationally. This week Bristol City Council voted unanimously to oppose the ID card scheme as Bristol No2ID members demonstrated outside the council buildings.

Previously Dave Gould gave Home Office Minister Andy Burnham a fantastic grilling in front of the TV cameras during an ID card propaganda roadshow in the Galleries shopping centre. Dave’s been particularly active in the local group and deserves a lot of credit for his persistance – he certainly puts me to shame, as I’ve recently missed both a meeting and the Demo last Tuesday :-(

Anyway, here’s a token contribution as I lend what little Google Juice I can muster towards the new Bristol No2ID website. There’s a mailing list, too, so get yourselves signed up if you live in the area and care about your civil liberties – they’re being reomved faster than you might think.

Posted in Uncategorized

Autumn in retreat

Apropos my post of a week or so back, it seems autumn’s been and gone already. Here’s a shot of our local park a week ago:

alt="[Swings in Victoria Pary (Autumn)]"
title="Swings in Victoria Pary (Autumn)"
class="landscape-photo"
id="p3685"/>

And here’s the same spot earlier today (althought there are still some leaves on the trees):

alt="[Swings in Victoria Pary (Winter)]"
title="Swings in Victoria Pary (Winter)"
class="landscape-photo"
id="p3706"/>

It’s been a strange few weeks – only a month ago you could get away with wearing a T-shirt and the leaves were still green. We wake up this morning to find a clear, crisp day, most of the leaves gone and a layer of fine snow dusting the rooftops and gardens around us.

alt="[Snow on the rooftops of south Bristol]"
title="Snow on the rooftops of south Bristol"
class="landscape-photo"
id="p3694"/>

My favourite weather, by far. The snow’s mostly melted now, but the sky’s still clear and the sun’s out.

Posted in Uncategorized

More on securing SSH

Just a brief post to flag that I’ve re-written my earlier post on securing SSH servers to include quite a lot more detail. I’d be very interested in any feedback and suggestions on this, particularly stuff I’ve missed out or any mistakes that may have slipped in, so please get in touch if you’ve any comments (I really must implement a commenting system here at some point).

Autumn at last

Autumn’s well and truly here now, if a bit late.

alt="[Red and Yellow leaf]"
title="Red and Yellow Leaf"
class="portrait-photo"
id="p3659"/>
Posted in Uncategorized