Patching K3B on Kubuntu Hardy Heron

May 6th, 2008

I’ve recently built a new desktop machine - the subject of another post when I get time - and because the hardware is fairly recent I decided to try Ubuntu which I knew would support it rather than switch to an unstable branch of Debian.

My first impressions of Hardy Heron - Ubuntu’s latest release; I’m using the variant with the KDE desktop - are very positive. The installer is excellent and the hardware detection very impressive. As a comparison, it took me the better part of a day to install a fairly vanilla Windows XP Pro SP2 on the first partition of the box. Nearly every driver install required a reboot as did many of the security updates. By contrast, it took less than an hour to download and install Kubuntu and the installation includes a far greater range of packages than I have on the windows partition.

The one fly in the ointment has been a problem with K3b. If I started with a blank CD in the drive, all was fine but launching it with either an empty drive or a blank DVD caused the process to hang for a long while and finally launch with the warning:

“No CD/DVD writer found.
K3b did not find an optical writing device in your system. Thus, you will not be able to burn CDs or DVDs. However, you can still use other K3b features like audio track extraction or audio transcoding or ISO9660 image creation.”

After this the DVD drive was disabled, making it impossible to even eject until the machine had been shutdown completely and restarted.

Both growisofs and wodim worked from the command line so the problem had to be in the KDE application. Launching K3B from the console reveals debug information and showed the hang up was occurring after the step checking for RAW_R96R:

...
(K3bDevice::Device) /dev/scd0: checking for RAW_R96R

After a long pause the process would continue:

(K3bDevice::ScsiCommand) failed:
                           command:    GET PERFORMANCE (ac)
                           errorcode:  72
                           sense key:  NO SENSE (2)
                           asc:        0
                           ascq:       3
(K3bDevice::Device) /dev/scd0: GET PERFORMANCE length det failed.
(K3bDevice::ScsiCommand) failed:
                           command:    MODE SENSE (5a)
                           errorcode:  0
                           sense key:  NO SENSE (2)
                           asc:        0
                           ascq:       0
(K3bDevice::Device) /dev/scd0: MODE SENSE length det failed.
(K3bDevice::ScsiCommand) failed:
                           command:    MODE SENSE (5a)
                           errorcode:  0
                           sense key:  NO SENSE (2)
                           asc:        0
                           ascq:       0
(K3bDevice::Device) /dev/scd0: MODE SENSE with real length 65535 failed.
(K3bDevice::Device) could not open device /dev/scd0 for reading
                    (No such device or address)
Error while retrieving capabilities.
Could not initialize device /dev/scd0
Could not resolve /dev/scd0
/dev/scd0 resolved to /dev/scd0
(K3bDevice::Device) could not open device /dev/scd0 for reading
                    (No such file or directory)
could not open device /dev/scd0 (No such file or directory)
Devices:
------------------------------
kdecore (KAction): WARNING: KActionCollection::operator+=(): function is severely deprecated.
removing udi /org/freedesktop/Hal/devices/pci_8086_2922_scsi_host_0_scsi_device_                                                                                                                                                 lun0_scsi_generic
removing udi /org/freedesktop/Hal/devices/pci_8086_2922_scsi_host_0_scsi_device_                                                                                                                                                 lun0
removing udi /org/freedesktop/Hal/devices/pci_8086_2922_scsi_host_0
removing udi /org/freedesktop/Hal/devices/storage_model_DVDRW_LH_20A1S
Unmapping udi /org/freedesktop/Hal/devices/storage_model_DVDRW_LH_20A1S from dev                                                                                                                                                 ice /dev/scd0

dmesg reveals the following occuring

May  1 23:52:15 mingus kernel: [ 3580.143800]          cdb ac 00 00 00 00 00 00 00  00 01 03 00 00 00 00 00
May  1 23:52:15 mingus kernel: [ 3580.143801]          res 40/00:03:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
May  1 23:52:15 mingus kernel: [ 3580.455532] ata6: soft resetting link
May  1 23:52:15 mingus kernel: [ 3580.619411] ata6: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
May  1 23:52:45 mingus kernel: [ 3610.751976] ata6.00: qc timeout (cmd 0xa1)
May  1 23:52:45 mingus kernel: [ 3610.751985] ata6.00: failed to IDENTIFY (I/O error, err_mask=0x5)
May  1 23:52:45 mingus kernel: [ 3610.751993] ata6: failed to recover some devices, retrying in 5 secs
May  1 23:52:50 mingus kernel: [ 3615.752086] ata6: hard resetting link
May  1 23:52:56 mingus kernel: [ 3621.263794] ata6: port is slow to respond, please be patient (Status 0x80)
May  1 23:53:00 mingus kernel: [ 3625.752312] ata6: hard resetting link
May  1 23:53:06 mingus kernel: [ 3631.268013] ata6: port is slow to respond, please be patient (Status 0x80)
May  1 23:53:11 mingus kernel: [ 3635.804490] ata6: hard resetting link
May  1 23:53:16 mingus kernel: [ 3641.316197] ata6: port is slow to respond, please be patient (Status 0x80)
May  1 23:53:46 mingus kernel: [ 3670.813264] ata6: limiting SATA link speed to 1.5 Gbps
May  1 23:53:46 mingus kernel: [ 3670.813266] ata6: hard resetting link
May  1 23:53:51 mingus kernel: [ 3675.821377] ata6.00: disabled
May  1 23:53:51 mingus kernel: [ 3675.821404] ata6: hard resetting link
May  1 23:53:57 mingus kernel: [ 3681.736761] ata6: port is slow to respond, please be patient (Status 0x80)
May  1 23:54:01 mingus kernel: [ 3685.825584] ata6: hard resetting link
May  1 23:52:15 mingus kernel: [ 3580.143800]          cdb ac 00 00 00 00 00 00 00  00 01 03 00 00 00 00 00
May  1 23:52:15 mingus kernel: [ 3580.143801]          res 40/00:03:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
May  1 23:52:15 mingus kernel: [ 3580.455532] ata6: soft resetting link
May  1 23:52:15 mingus kernel: [ 3580.619411] ata6: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
May  1 23:52:45 mingus kernel: [ 3610.751976] ata6.00: qc timeout (cmd 0xa1)
May  1 23:52:45 mingus kernel: [ 3610.751985] ata6.00: failed to IDENTIFY (I/O error, err_mask=0x5)
May  1 23:52:45 mingus kernel: [ 3610.751993] ata6: failed to recover some devices, retrying in 5 secs
May  1 23:52:50 mingus kernel: [ 3615.752086] ata6: hard resetting link
May  1 23:52:56 mingus kernel: [ 3621.263794] ata6: port is slow to respond, please be patient (Status 0x80)
May  1 23:53:00 mingus kernel: [ 3625.752312] ata6: hard resetting link
May  1 23:53:06 mingus kernel: [ 3631.268013] ata6: port is slow to respond, please be patient (Status 0x80)
May  1 23:53:11 mingus kernel: [ 3635.804490] ata6: hard resetting link
May  1 23:53:16 mingus kernel: [ 3641.316197] ata6: port is slow to respond, please be patient (Status 0x80)
May  1 23:53:46 mingus kernel: [ 3670.813264] ata6: limiting SATA link speed to 1.5 Gbps
May  1 23:53:46 mingus kernel: [ 3670.813266] ata6: hard resetting link
May  1 23:53:51 mingus kernel: [ 3675.821377] ata6.00: disabled
May  1 23:53:51 mingus kernel: [ 3675.821404] ata6: hard resetting link
May  1 23:53:57 mingus kernel: [ 3681.736761] ata6: port is slow to respond, please be patient (Status 0x80)
May  1 23:54:01 mingus kernel: [ 3685.825584] ata6: hard resetting link
May  1 23:54:07 mingus kernel: [ 3691.752971] ata6: port is slow to respond, please be patient (Status 0x80)
May  1 23:54:11 mingus kernel: [ 3695.841797] ata6: hard resetting link
May  1 23:54:17 mingus kernel: [ 3701.757192] ata6: port is slow to respond, please be patient (Status 0x80)
May  1 23:54:46 mingus kernel: [ 3730.858562] ata6: limiting SATA link speed to 1.5 Gbps
May  1 23:54:46 mingus kernel: [ 3730.858565] ata6: hard resetting link
May  1 23:54:51 mingus kernel: [ 3735.884188] ata6: EH complete
May  1 23:54:51 mingus kernel: [ 3735.884287] ata6.00: detaching (SCSI 5:0:0:0)

It looks like the bug is probably in the libsata code failing to handle an error rather than K3B but I haven’t had a chance to investigate further.

As a quick workaround, download the k3b source and hack bool K3bDevice::Device::getSupportedWriteSpeedsViaGP to return false immediately and shortcircuit the call to ioctl that locks the device. The code will fall back to setting a maximum speed determined by the previous call to getSupportedWriteSpeedsVia2A.

Between the Devil and the Deep Blue Sea

May 4th, 2008

Housing market measures

178. For most people the acquisition of a house is the biggest single investment they will make. Homeowners rightly expect their investment to be protected by sensible policies pursued by Government.
179. I am determined that as a country we never return to the instability, speculation, and negative equity that characterised the housing market in the 1980s and 1990s.
180. Volatility is damaging both to the housing market and to the economy as a whole.
181. So stability will be central to our policy to help homeowners. And we must be prepared to take the action necessary to secure it.
182. I will not allow house prices to get out of control and put at risk the sustainability of the recovery.
183. I have therefore decided it is right to take two measures aimed at stability in the housing market.
184. First I will raise stamp duty from 1 per cent to 1.5 per cent on property sales above £250,000 and to 2 per cent for property sales above £500,000. This will take immediate effect after the Budget resolution has been voted by the House.
185. Second, continuing the reforms begun by the previous Government which removed mortgage tax relief at the higher rate of 40 per cent in 1991, and cut it to 15 per cent by 1995, I propose to reduce mortgage tax relief by a further 5 per cent from 15 per cent to 10 per cent from April 1998.
186. The timing of my measure should help to avoid a return to the conditions of the 1980s where the failure to take early action guaranteed worse problems later on.
187. I believe these measures will help to ensure a more balanced recovery.

The gap between Gordon Brown’s 1997 Budget promises and the reality of what Labour allowed to happen would be funny if the consequences of his dishonesty hadn’t been so serious.

As one of the thirty-something generation priced out of home ownership by an asset bubble that inflated faster than my salary grew, I say bring on the crash and end the bail-outs of irresponsible lenders. And kick out the party that presided over this socially disastrous boom.

Brown’s budget promises of 1997 have proved as believable as the official inflation figure of 3%. Anecdotally, my food and electricity bills are up around 15% so far this year and rents have been rising by around 8% pa for a long while.

Anyone who thinks the conservatives will be better is deluded.

The most controversial proposal in the report, which aims to improve the competitiveness of the British economy, would see a Tory government restore the opt-out from the European Social Chapter, which was removed by Labour in 1997. Redwood will also call for EU working time regulations to be repealed.

Tories plan to make £14bn savings in radical move to slash red tape | Special Reports | Guardian Unlimited Politics

Although Labour have proved to be every bit as mendacious, greedy and incompetent as the Tories were, in Redwood’s casual proposal to strip part-time and freelance workers (whose wages have stagnated for nearly a decade) of their pro-rata holiday pay and to remove the sparse legal protection low-wage workers enjoy in the UK, we can clearly see the Conservative contempt for anything but profit.

Growing up under Thatcher means I will never vote for that party of self-interest and greed. Her party created this situation; Labour’s main fault lies in refusing to reverse the damage. A decade of Blairite lies and Brownite economic mismanagement has finally driven me to the Liberal Democrats. I think Nick Clegg is a populist fool but maybe that’s what you need to win an election in the brain-dead, celebrity-obsessed wasteland Britain has become. Nonetheless, Vincent Cable, a man who seems widely respected on both political wings of the press, is a man who deserves more influence.

I’ve been dreaming of a time when
The English are sick to death of Labour, And Tories

Too many people consider a vote for the Liberal Democrats to be a wasted vote. But the belief that they can never get in becomes self-fulfilling. They made real progress in the recent elections and I hope that will only continue. Britain deserves better. Maybe the Liberal Democrats are the answer.

Podcasts for Software Engineers (and the Perfect Player: the Nokia N95)

April 27th, 2008

I’ve recently discovered an excellent new podcast on software engineering - Software Engineering Radio. I’ve long been a fan of IT Conversations and In Our Time and this is a very welcome addition to my listening schedule.

As I client I’ve been using my Nokia N95 after upgrading the firmware to v20.0.015. The upgraded phone has no difficulty addressing memory cards larger than 4G, vastly improved battery life while playing mp3s, no longer crashes from running out of memory (thanks to on demand paging which also cuts the boot time significantly) and has a podcast client built in that remembers where I left off a particular episode. This is ideal if, like me, you use podcasts to claw back otherwise wasted time and so often digest episodes in several minute chunks.

Oh, and you can sync up your subscriptions and download new episodes direct to the player using wireless which makes it extremely convenient.

I’m working through the Software Engineering Radio backlist at the moment and have particularly enjoyed the following episodes on game development, Erlang, Lisp and an interview with Erich Gamma. You know something must be good when you find yourself looking forward to doing the washing up because it will give you another ten minutes to listen to more of the latest episode. For anyone interested in software development, I’d heartily recommend it.

Extraordinary Customer Service from Amazon

March 8th, 2008

A DVD player I bought from amazon developed a fault.

I called them on Monday at lunchtime to report the problem.

Tuesday morning, they delivered a replacement before 8am. Tuesday evening a second courier came round to collect the faulty one and return it to amazon.

I’ve long been impressed by amazon but this time they have surpassed themselves.

56K Nostalgia

November 27th, 2007

What the lights on a modem mean:

TR Terminal Ready Illuminated when terminal software is activated
HS High Speed Illuminated during K56flex connections (32.000 to 56.000 bps)
CD Carrier Detect The modem is connected with another modem.
AA Auto Answer The modem is ready to answer incoming calls automatically.
OH Off Hook The modem has picked up the phone line, just like taking your phone handset “off hook.”
SD Send Data Flashes as data are sent.
RD Receive Data Flashes as data are received.
PWR Power The modem is receiving power.

Using Mutt with Exim4 to Send Mail via Smarthost over SSL (TLS) Connection on Port 465

November 26th, 2007

One day I’ll learn pine and I’m sure I’ll love it but for now I’m hooked on mutt.

Getting mutt to use exim4 for delivery is as simple as adding set sendmail="/usr/sbin/exim4" to your ~/.muttrc. Getting exim4 working as a smarthost to authenticate over port 465 is far harder.

The solution is to use a tunnel as outlined in this excellent post: exim4 with ssmtp on Debian.

Before finding this answer, I also discovered a very clear post on testing an smtp auth connection here and a useful tutorial on setting up and testing exim, both of which may be helpful to other people.

Truffaut on Jules et Jim

November 23rd, 2007

“Je peux dire que la lecture, en 1953, de “Jules et Jim”, premier roman d’un vieillard de 74 ans, a déterminé ma vocation de cinéaste. J’avais 21 ans et j’étais critique de cinéma. J’ai eu le coup de foudre pour ce livre et j’ai pensé: si un jour je réussis à faire des films, je tournerai “Jules et Jim”. J’ai peu après rencontré l’auteur du livre, que l’idée d’un contact avec le cinéma enchantait. Au début 61, j’ai pensé que le moment était venu de concrétiser ce vieux rêve. J’ai essayé de transposer fidèlement ce beau livre que l’éditeur Gallimard présentait ainsi : “Un pur amour à trois”. Jean Gruault et moi avons adapté ce livre méconnu avec le même amour et le même respect que s’il se fût agi de “Le Rouge et le Noir” de Stendhal, car pour nous le roman d’Henri-Pierre Roché est un chef-d’oeuvre digne des plus belles oeuvres classiques. Si ce film est réussi, il doit ressembler au livre dont il s’inspire et constituer ainsi un hymne à l’amour, peut-être même un hymne à la vie.”

François Truffaut

Amusing Compiler Warning

October 27th, 2007

In file included from vhook/imlib2.c:48:
/home/tim/src/ffmpeg/libavformat/framehook.h:25:2: warning: #warning VHOOK is deprecated. Please help porting libmpcodecs or a better filter system to FFmpeg instead of wasting your time writing new filters for this crappy one.

del.icio.us bookmarks for October 21st through October 25th

October 27th, 2007

Links for October 21st through October 25th:

del.icio.us bookmarks for October 13th through October 20th

October 21st, 2007

Links for October 13th through October 20th: