The tool to reprocess an Apport crash report to produce a symbolic stack trace, apport-retrace, has been pretty hard to use on a developer system so far: It either installed the packages from the crash report, plus its debug symbol packages (“ddebs”) into the running system (which frequently caused problems like broken dependencies), or it required setting up a chroot and using apport-chroot with fakechroot and fakeroot.
I’m happy to announce that with Apport 1.22, which landed in Oneiric yesterday, this has now become much easier: In the default mode it just calls gdb on the report’s coredump, i. e. expects that all the necessary packages are already installed and will complain about the missing ones. But with the new --sandbox/-Smode, it will just create a temporary directory, download and unpack packages there, and run gdb with some magic options to consider that directory a “virtual root”. These options haven’t been available back when this stuff was written the first time, which is why it used to be so complicated with fakechroots, etc. Now this does not need any root privileges, chroot() calls, etc.
As it only downloads and installs the bare minimum, and does not involve any of the dpkg/apt overhead (maintainer scripts, etc.), it has also become quite a lot faster. That’s how the apport retracers were able to dig through a backlog of about a thousand bugs in just a couple of hours.
So now, if you locally want to retrace or investigate a crash, you can do
$ apport-retrace -s -S system /var/crash/_usr_bin_gedit.1000.crash
to get the stack traces on stdout, or
$ apport-retrace -g -S system /var/crash/_usr_bin_gedit.1000.crash
to be put into a gdb session.
If you do this regularly, it’s highly recommended to use a permanent cache dir, where apt can store its indexes and downloaded packages: Use -C ~/.cache/apport-retrace for this (or the long version --cache).
You can also use this to reprocess crashes for a different release than the one you are currently running, by creating a config directory with an appropriate apt sources.list.
The manpage has all the details. (Note that at the time of this writing, manpages.ubuntu.com still has the old version — use the local one instead.)
Enjoy, and let me know how this works for you!
#1 by bulot on 2011/08/29 - 10:58
Zitieren
on Oneiric i386
oem@oem-desktop:~$ apport-retrace -g -S system /var/crash/_usr_bin_ccsm.1000.crash
ERROR: report file does not contain one of the required fields: CoreDump DistroRelease Package ExecutablePath
hm, what next ?
#2 by pitti on 2011/08/29 - 11:18
Zitieren
You need to run the crash through the frontend first to complete the .report file with the packaging information. I. e. click on “Report…” on the crash popup, but then not send it to LP. Alternatively you can use the -R option, see manpage.
#3 by bulot on 2011/08/29 - 14:08
Zitieren
Thanks for replying,
i read manpage and tried a few tweaks, but its not clear for a non techy, and googling around let me thinking i’m not alone. A more automated script might help the whole crowd.
#4 by fta on 2011/09/11 - 21:56
Zitieren
doesn’t work for me: http://paste.ubuntu.com/687123/
seems it’s creating two temp dirs in /tmp, and it’s looking for that missing file in the wrong dir
#5 by pitti on 2011/09/12 - 10:54
Zitieren
@fta: Can you please report this as a bug in LP, so that this gets a bit more info? We can then discuss reproducing etc. tthere, better than in a blog comment. Thanks!
#6 by Andor Kiss on 2012/11/20 - 15:01
Zitieren
Again, apport-retrace does not work for me either. I get the same error as the first poster, can you make a non-technical GUI so that regular users can contribute? Thanks
#7 by pitti on 2012/11/20 - 15:23
Zitieren
Please see my answer (second comment). If you use the “Analyze locally…” button that appears in the crash notification dialog (you need to have apport-retrace installed to see it), everything will work just fine. That’s about as non-technical as it can get for debugging crashes, I’m afraid.