devkit-disks-daemon assert failure: devkit-disks-daemon: atasmart.c:2701: sk_disk_set_blob: Assertion `blob' failed.

Bug #419663 reported by Atanas Atanasov
978
This bug affects 180 people
Affects Status Importance Assigned to Milestone
obsolete
Fix Released
Critical
devicekit-disks (Ubuntu)
Fix Released
High
Martin Pitt
Karmic
Fix Released
High
Martin Pitt

Bug Description

Binary package hint: devicekit-disks

Crashed without any specific reason.

ProblemType: Crash
Architecture: amd64
AssertionMessage: devkit-disks-daemon: atasmart.c:2701: sk_disk_set_blob: Assertion `blob' failed.
Date: Wed Aug 26 19:54:28 2009
DistroRelease: Ubuntu 9.10
ExecutablePath: /usr/lib/devicekit-disks/devkit-disks-daemon
Package: devicekit-disks 006-0ubuntu1
ProcCmdline: /usr/lib/devicekit-disks/devkit-disks-daemon
ProcEnviron:

ProcVersionSignature: Ubuntu 2.6.31-7.27-generic
Signal: 6
SourcePackage: devicekit-disks
StacktraceTop:
 raise () from /lib/libc.so.6
 abort () from /lib/libc.so.6
 __assert_fail () from /lib/libc.so.6
 sk_disk_set_blob () from /usr/lib/libatasmart.so.4
 ?? ()
Title: devkit-disks-daemon assert failure: devkit-disks-daemon: atasmart.c:2701: sk_disk_set_blob: Assertion `blob' failed.
Uname: Linux 2.6.31-7-generic x86_64
UserGroups:

Revision history for this message
Atanas Atanasov (thenasko) wrote :
Revision history for this message
Apport retracing service (apport) wrote : Stacktrace.txt (retraced)

StacktraceTop:raise () from /lib/libc.so.6
abort () from /lib/libc.so.6
__assert_fail () from /lib/libc.so.6
sk_disk_set_blob (d=0x0,
drive_ata_smart_refresh_data_completed_cb (

Revision history for this message
Apport retracing service (apport) wrote : ThreadStacktrace.txt (retraced)
Changed in devicekit-disks (Ubuntu):
importance: Undecided → Medium
tags: removed: need-amd64-retrace
visibility: private → public
Martin Pitt (pitti)
affects: devicekit-disks (Ubuntu) → libatasmart (Ubuntu)
Changed in libatasmart (Ubuntu):
status: New → Confirmed
Revision history for this message
Jonathan Prior (behe) wrote :

Affects me on i686.

Revision history for this message
Ciso (cisoprogressivo) wrote :

This is really annoying.
I can't mount any USB or CD device after this crash.

Revision history for this message
Nicklas W Bjurman (lordmetroid) wrote :

I thought it was fixed as of yesterday's update as the usb drives, sticks and CDs mounted yet again but today it crashed again, I was doing nothing special, simply moving files on the desktop and nautilus.

Revision history for this message
Martin Pitt (pitti) wrote :

This actually looks like an error in dk-disks itself, reassigning back.

affects: libatasmart (Ubuntu) → devicekit-disks (Ubuntu)
Changed in devicekit-disks (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Nicklas W Bjurman (lordmetroid) wrote :

Considering it is crashing constantly, this is not a bug you want to ship with, what reputation drop will Ubuntu get if it is constantly reporting crashes.

Revision history for this message
Busby (mobusby) wrote :

For me, this crash was immediately followed by the crash reported in bug #419662.

At the time of the crash I wasn't doing anything that had anything at all to do with disk io, just perusing some code. Suddenly my external hard drive started spinning up and I got a crash notification.

Revision history for this message
Claes Wallin (clacke) wrote :

Got this crash after attaching three USB disks, of which one is reported by palimpsest as having many reallocated sectors. Both lvm and md is involved, in particular two lvm/dm volumes are configured in a RAID-1 configuration, which is probably an untested configuration and an invitation to race conditions and general confusion.

Revision history for this message
Michael Hind (mike-hind) wrote :

It looks like the same bug to me although the c:2725 is different from the original but the same as #446742 and #450125

Revision history for this message
GATails (jenrichmichael) wrote :

I also got this crash shortly after bug #419662. 3 usb drives were attached at the time, but none of them were mounted.

Revision history for this message
xavxa (xavxa) wrote :

i got it all time i run Palimpsest 2.28.0 with 2 usb disk, usualy after #419662 bug
some times i got it without running palimpsest

Revision history for this message
Ciso (cisoprogressivo) wrote :

With the yesterday update I don't get the crash anymore but I still can't mount devices after a while (randomly as before).

Revision history for this message
Brady Merriweather (brady-merriweather) wrote :

Have anternal hard drive equipment. & external pen drives. I can't mount them either unless I plug them in first. Then reboot.

Revision history for this message
John Stevenson (jr0cket) wrote :

Mounted the drive successfully as of today, however when umount and mount via nautilus i get the following error on when remounting:

Error mounting: mount exited with exit code 32: mount: /dev/sdg1 is not a valid block device

Revision history for this message
davidpbrown (davidpbrown) wrote :

I can't relate to the detail but I'm getting this devkit-disks-daemon error apparently happening at the same time as another

Bug #471313 "seahorse-agent assert failure: ERROR:iop-profiles.c:606:IOP_generate_profiles: assertion failed: (obj && (obj->profile_list == NULL) && obj->orb)"

so they maybe related? devkit-disks-daemon is usually the one reported last.

Revision history for this message
davidpbrown (davidpbrown) wrote :

Also should have suggested the devkit-disks-daemon I see gives a "devkit-disks-helper-ata-smart-collect closed unexpectedly" error when trying to report it.

Revision history for this message
Ciso (cisoprogressivo) wrote :

I tried with a fresh install but nothing changed?
Why is it marked as "medium"? I can't mount any device on my pc after some minutes!

Revision history for this message
Markku (mleitso) wrote : Re: [Bug 419663] Re: devkit-disks-daemon assert failure: devkit-disks-daemon: atasmart.c:2701: sk_disk_set_blob: Assertion `blob' failed.

I expect that you also got all the updates after the fresh install? The
'medium' probably relates to the number of people reporting this particular
bug maybe.

2009/11/7 Ciso <email address hidden>

> I tried with a fresh install but nothing changed?
> Why is it marked as "medium"? I can't mount any device on my pc after some
> minutes!
>
> --
> devkit-disks-daemon assert failure: devkit-disks-daemon: atasmart.c:2701:
> sk_disk_set_blob: Assertion `blob' failed.
> https://bugs.launchpad.net/bugs/419663
> You received this bug notification because you are a direct subscriber
> of a duplicate bug.
>

--
"Intellectuals are reliable lagging indicators, near-infallible guides to
what used to be true."

Revision history for this message
Ciso (cisoprogressivo) wrote :

Yes, I got all the updates.

Revision history for this message
In , Martin Pitt (pitti) wrote :

We get gazillions of dupes for this crash:

#0 0x00007fc4138ce4e5 in raise () from /lib/libc.so.6
#1 0x00007fc4138d1f80 in abort () from /lib/libc.so.6
#2 0x00007fc4138c74a1 in __assert_fail () from /lib/libc.so.6
#3 0x00007fc413c0d199 in sk_disk_set_blob (d=0x0,
    blob=<value optimized out>, size=<value optimized out>) at atasmart.c:2701
 p = <value optimized out>
 left = <value optimized out>
 idv = <value optimized out>
 sdv = <value optimized out>
 stv = <value optimized out>
 bssv = <value optimized out>
 __PRETTY_FUNCTION__ = "sk_disk_set_blob"
#4 0x000000000040e99a in drive_ata_smart_refresh_data_completed_cb (
    context=0x0, device=0x1f25c50, job_was_cancelled=<value optimized out>,
    status=<value optimized out>, stderr=<value optimized out>,
    stdout=<value optimized out>, user_data=0x1f674e0)
    at devkit-disks-device.c:7912
 rc = <value optimized out>
 good = <value optimized out>
 num_bad_sectors = <value optimized out>
 temperature_mkelvin = <value optimized out>
 power_on_mseconds = <value optimized out>
 asd = <value optimized out>
 d = (SkDisk *) 0x1f280c0
 blob = (guchar *) 0x0
 blob_size = 1
 time_collected = <value optimized out>
 is_failing = <value optimized out>
 is_failing_valid = <value optimized out>
 collect_attrs_data = {attributes = 0x0, has_bad_attributes = 1}
 db = <value optimized out>
#5 0x000000000040cb5b in job_child_watch_cb (pid=<value optimized out>,

(full trace at http://launchpadlibrarian.net/30901828/Stacktrace.txt, but that's the interesting bit).

The full assertion message is:

devkit-disks-daemon: atasmart.c:2701: sk_disk_set_blob: Assertion `blob' failed.

This crashes in this code in src/devkit-disks-device.c:

        blob = (gchar *) g_base64_decode (stdout, &blob_size);

        if (sk_disk_open (NULL, &d) != 0) {
                if (context != NULL) {
                        throw_error (context,
                                     DEVKIT_DISKS_ERROR_FAILED,
                                     "unable to open a SkDisk");
                }
                goto out;
        }

        if (sk_disk_set_blob (d, blob, blob_size) != 0) {

as the stack frame #4 shows, blob == NULL (which triggers the assertion in libatasmart).

Revision history for this message
In , Martin Pitt (pitti) wrote :

Some analysis:

- According to some duplicates, this crash is 100% reproducible with some devices (unfortunately with none of mine)
- stdout is not NULL (the -O2 optimized that away unfortunately, but the condition is checked before)
- devkit-disks-helper-ata-smart-collect returned with exit code 0 (condition is checked before)
- blob_size could be already written by g_base64_decode(), or just be uninitialized, so we can't rely on the origin of "1"
- g_base64_decode() code shows that it can only return NULL in those conditions:

  g_return_val_if_fail (text != NULL, NULL);
  g_return_val_if_fail (out_len != NULL, NULL);

  input_length = strlen (text);

  g_return_val_if_fail (input_length > 1, NULL);

  We already know that text != NULL (which is "stdout" here), and we also know that out_len != NULL (it's a pointer to a local variable.

So it seems that the reason is that stdout is just a single character.

I propose to intercept this condition gracefully and add some debug logging what the output is, so that in the future we can get to the root cause.

Revision history for this message
In , Martin Pitt (pitti) wrote :

Created an attachment (id=31118)
git formatted patch

Revision history for this message
In , Martin Pitt (pitti) wrote :

I asked folks in the Ubuntu bug report to test the patch and supply the daemon output with the message. I'm eager to see what the bad output looks like.

Martin Pitt (pitti)
Changed in devicekit-disks (Ubuntu):
importance: Medium → High
Revision history for this message
Nico Isenbeck (nico-isenbeck) wrote :

Do you need further information for debugging or fixing this bug? Can I help you somehow?

Martin Pitt (pitti)
Changed in devicekit-disks (Ubuntu Karmic):
importance: Undecided → High
status: New → Triaged
Revision history for this message
Martin Pitt (pitti) wrote :

I analyzed the crash, and sent the analysis and a proposed patch to the upstream bug report.

I also applied the patch to the Debian package, I'll upload it to Lucid soon:
http://git.debian.org/?p=pkg-utopia/devicekit-disks.git;a=commit;h=c2aea81272f7bc69df6bac851664f66c6e9bbb91

Changed in devicekit-disks (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
status: Triaged → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

I backported the patch to the karmic package and built a test package in my PPA:

  https://launchpad.net/~pitti/+archive/sru-test

This is the only update in that PPA, so it's safe to just add it and upgrade your system.

I can't reproduce the crash myself, so I would like to get a confirmation from some of you that it works now.

Also, I would be very interested in learning how the invalid SMART data actually looks like. Could some of you please install the update, then do

  sudo /usr/lib/devicekit-disks/devkit-disks-daemon --replace 2>&1 | tee /tmp/dkd.log

and then reproduce the situation which previously led to this crash? (I think that for some of you it happened each time when you plugged in a particular USB hard disk). I'm looking for a message like

   Error decoding ATA SMART data: invalid base64 format: [...]

Once you got that, please attach /tmp/dkd.log here.

Thank you!

Changed in devicekit-disks (Ubuntu Karmic):
assignee: nobody → Martin Pitt (pitti)
milestone: none → karmic-updates
status: Triaged → In Progress
Revision history for this message
Nico Isenbeck (nico-isenbeck) wrote :

Hi Martin,

I applied your patch and plugged in my usb flash drive and it was automounted! Because automount worked sometimes even without the patch I tried it three times and every time my drive was mounted successfully. But I'll do some more tests tomorrow.

You find the output attached.

Your ppa (link?) is wrong, I found the patch here: https://launchpad.net/~pitti/+archive/ppa

Changed in devicekit:
status: Unknown → Confirmed
Revision history for this message
Markku (mleitso) wrote : Re: [Bug 419663] Re: devkit-disks-daemon assert failure: devkit-disks-daemon: atasmart.c:2701: sk_disk_set_blob: Assertion `blob' failed.

Thank you for the offer! The problem resolved it's self through an update
shortly after I sent up the report. Thanks again

Markku Leitso

Prostate Cancer.....What do you think? Check out:-

http://uk.movember.com/mospace/318004
Contact Me [image:
Facebook]<http://www.facebook.com/home.php?#/profile.php?id=1677415347&ref=name>

--- @ WiseStamp Signature <http://www.wisestamp.com/email-install>. Get it
now <http://www.wisestamp.com/email-install>

2009/11/11 Nico Isenbeck <email address hidden>

> Do you need further information for debugging or fixing this bug? Can I
> help you somehow?
>
> --
> devkit-disks-daemon assert failure: devkit-disks-daemon: atasmart.c:2701:
> sk_disk_set_blob: Assertion `blob' failed.
> https://bugs.launchpad.net/bugs/419663
> You received this bug notification because you are a direct subscriber
> of a duplicate bug.
>

--
"Intellectuals are reliable lagging indicators, near-infallible guides to
what used to be true."

Revision history for this message
Ciso (cisoprogressivo) wrote :

The correct PPA is the first one.
I don't get the crash error, but I still have the problem so I will do some test with this patch.

Revision history for this message
reini (rrumberger) wrote :

Occured right after I executed the "devkit-disks-daemon --replace" command and my Seagate came out of standby.

Revision history for this message
Nico Isenbeck (nico-isenbeck) wrote :

I did some more testing today and my usb flash drive was automounted every time. So it seems that the patch solved the problem for me.

Thank you Martin!

@Ciso: Yesterday it wasn't in the ppa.

Revision history for this message
Ciso (cisoprogressivo) wrote :

Seems to work. Thank you.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package devicekit-disks - 009-1ubuntu3

---------------
devicekit-disks (009-1ubuntu3) lucid; urgency=low

  Upload current Debian git head.

  [ Michael Biebl ]
  * debian/patches/09-reiserfs-support.patch
    - Add support for ReiserFS.

  [ Martin Pitt ]
  * Add debian/local/ubuntu.pkla: Allow passwordless file system operations
    for local foreground admin user sessions on Ubuntu. Install it in
    debian/rules. (LP: #465054)
  * Add 02-allow-simulated-smart.patch: Allow simulated SMART data on
    non-SMART devices. This is both useful for testing DK-disks itself, as
    well as recreating bugs with SMART handling. (fd.o #24772)
  * Add 03-hide-configuration-partition-12.patch: Hide Compaq recovery
    partition type 0x12. (fd.o #24999, LP: #451304)
  * Add 04-hide-wd-smartware-partition.patch: Ignore Western Digital SmartWare
    partitions. (fd.o #25009, LP: #474790)
  * Add 06-guid-partition-flags.patch: Fix setting flags for GUID partitions.
    (fd.o #25034)
  * Add 07-fix-atasmart-crash.patch: Fix common crash when
    devkit-disks-helper-ata-smart-collect succeeds, but returns invalid base64
    data on stdout. (fd.o #25043, LP: #419663)
  * debian/local/apport-hook.py:
    - Drop attaching /etc/fstab; it might contain samba (etc.) passwords which
      need to be filtered out.
    - Collect available ATA SMART blobs; they are very useful in debugging
      libatasmart related problems and do not usually pose a privacy risk.
 -- Martin Pitt <email address hidden> Sat, 14 Nov 2009 16:46:31 -0600

Changed in devicekit-disks (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Thanks for testing!

Uploaded to karmic-proposed queue. Needs to be processed by an SRU team member now.

Revision history for this message
In , Martin Pitt (pitti) wrote :

The patch was confirmed to fix the crash. It seems that the output was empty:

**** EMITTING CHANGED for /sys/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda
helper(pid 14142): completed with exit code 0

(devkit-disks-daemon:14138): GLib-CRITICAL **: g_base64_decode: assertion `input_length > 1' failed

(devkit-disks-daemon:14138): devkit-disks-daemon-WARNING **: Error decoding ATA SMART data: invalid base64 format:
**** ADDING /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0/host5/target5:0:0/5:0:0:0/block/sdc

(I got two different logs, bot the same).

Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Accepted devicekit-disks into karmic-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in devicekit-disks (Ubuntu Karmic):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
In , Zeuthen (zeuthen) wrote :

(In reply to comment #4)
> The patch was confirmed to fix the crash. It seems that the output was empty:
>
> **** EMITTING CHANGED for
> /sys/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda
> helper(pid 14142): completed with exit code 0
>
> (devkit-disks-daemon:14138): GLib-CRITICAL **: g_base64_decode: assertion
> `input_length > 1' failed
>
> (devkit-disks-daemon:14138): devkit-disks-daemon-WARNING **: Error decoding ATA
> SMART data: invalid base64 format:
> **** ADDING
> /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0/host5/target5:0:0/5:0:0:0/block/sdc
>
> (I got two different logs, bot the same).
>

Applied, thanks for tracking this down. FWIW, I think there's a bug in libatasmart - I often get this error

  Error retrieving ATA SMART data: helper failed with exit
  code 1: Failed to read smart data for /dev/sda: No such file
  or directory

when refreshing the SMART data from Palimpsest. Funny enough I can't reproduce when doing 'skdump /dev/sda' from the command line. I'll try to track this down when I find some free cycles.

Changed in devicekit:
status: Confirmed → Fix Released
Revision history for this message
Nico Isenbeck (nico-isenbeck) wrote :

The patch from karmic-proposed seems to work fine for me. Thank you!

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package devicekit-disks - 007-2ubuntu4

---------------
devicekit-disks (007-2ubuntu4) karmic-proposed; urgency=low

  [ Martin Pitt ]
  * Add 09-fix-atasmart-crash.patch: Fix common crash when
    devkit-disks-helper-ata-smart-collect succeeds, but returns invalid base64
    data on stdout. (fd.o #25043, LP: #419663)

  [ Steve Magoun ]
  * Backport 03-hide-configuration-partition-12.patch from Lucid to fix
    regression that caused Acer and other hidden partitions to appear
    after upgrading to Karmic (LP: #451304)
 -- Martin Pitt <email address hidden> Wed, 11 Nov 2009 23:29:29 +0100

Changed in devicekit-disks (Ubuntu Karmic):
status: Fix Committed → Fix Released
Santanu (csbarua)
Changed in devicekit-disks (Ubuntu):
status: Fix Released → New
status: New → Fix Released
Revision history for this message
In , Zeuthen (zeuthen) wrote :

(In reply to comment #5)
> FWIW, I think there's a bug in
> libatasmart - I often get this error
>
> Error retrieving ATA SMART data: helper failed with exit
> code 1: Failed to read smart data for /dev/sda: No such file
> or directory
>
> when refreshing the SMART data from Palimpsest. Funny enough I can't reproduce
> when doing 'skdump /dev/sda' from the command line. I'll try to track this down
> when I find some free cycles.

Just FYI, I tracked this down - see bug 25543 for a patch that fixes this.

Changed in devicekit:
importance: Unknown → Critical
Changed in devicekit:
importance: Critical → Unknown
Changed in devicekit:
importance: Unknown → Critical
To post a comment you must log in.