2015-05-28 14 views
6

sto cercando di analizzare crash dump sulla mia macchina Ubuntu utilizzando crash utilità come di seguitocrash dump su Ubuntu: vmlinuz o file di dettagli arresto formato non un file supportato

$ sudo crash /boot/System.map-3.2.0-23-generic-pae /boot/vmlinuz-3.2.0-23-generic-pae _usr_sbin_ietd.0.crash 

ma restituisce errore

crash: /boot/vmlinuz-3.2.0-23-generic-pae: not a supported file format 

secondo sintassi utility crash che ho fornito argomenti correttamente

crash <system-map-file> <vmlinux-file> coredump 

che cosa sono io doin sbagliato qui?

UPDATE: il file

vmlinuz nel bagagliaio dir sembra essere bzImage compressa

$ file vmlinuz-3.2.0-23-generic-pae 
vmlinuz-3.2.0-23-generic-pae: Linux kernel x86 boot executable bzImage, version 3.2.0-23-generic-pae ([email protected]) #36-Ubuntu SMP Tue Apr 10 , RO-rootFS, swap_dev 0x4, Normal VGA 
$ 
+1

'vmlinuz' è un'immagine compressa. Forse 'crash' richiede uncompressed (' vmlinux'). Puoi provare 'gunzip/boot/vmlinuz-3.2.0-23-generic-pae' (salva prima l'originale e assicurati che ci sia spazio per l'immagine non compressa nella partizione). – lurker

+0

ok è compresso ma in formato bzImmagine –

+1

OK stessa idea. Ho appena avuto il programma di decompressione sbagliato. È possibile trovare [questa domanda/risposta] (http://stackoverflow.com/questions/12002315/extract-vmlinux-from-vmlinuz-or-bzimage) utile. – lurker

risposta

7

Come da @ di lurker commenti vmlinuz viene compresso e può essere decompresso utilizzando sotto il comando (da Extract vmlinux from vmlinuz or bzImage)

$ sudo dd if=vmlinuz-3.2.0-23-generic-pae skip=`grep -a -b -o -m 1 -P '\x1f\x8b\x08\x00' vmlinuz-3.2.0-23-generic-pae| cut -d: -f 1` bs=1 | zcat > /tmp/vmlinux 
    4998324+0 records in 
    4998324+0 records out 
    4998324 bytes (5.0 MB) copied, 201.859 s, 24.8 kB/s 

    gzip: stdin: decompression OK, trailing garbage ignored 

Ora per l'errore

incidente: /var/crash/_usr_sbin_ietd.0.crash: non un formato

file supportato abbiamo anche bisogno di estrarre il file core dump da crash report utilizzando apport-unpack come di seguito (from here)

@ubuntu:/tmp$ sudo apport-unpack 
Usage: /usr/bin/apport-unpack <report> <target directory> 

@ubuntu:/tmp$ sudo apport-unpack /var/crash/_usr_sbin_ietd.0.crash /var/crash/ 
ERROR: Destination directory exists and is not empty. 
@ubuntu:/tmp$ 

@ubuntu:/tmp$ sudo mkdir coretest 

@ubuntu:/tmp$ sudo apport-unpack /var/crash/_usr_sbin_ietd.0.crash /tmp/coretest/ 
@ubuntu:/tmp$ cd coretest/ 
@ubuntu:/tmp/coretest$ 

@ubuntu:/tmp/coretest$ ls 
Architecture Date   ExecutablePath  ProblemType ProcCwd  ProcMaps Signal UserGroups 
CoreDump  DistroRelease ExecutableTimestamp ProcCmdline ProcEnviron ProcStatus Uname 

@ubuntu:/tmp/coretest$ ls -lt 
total 384 
-rw-r--r-- 1 root root  4 May 29 00:13 Architecture 
-rw-r--r-- 1 root root  24 May 29 00:13 Date 
-rw-r--r-- 1 root root  12 May 29 00:13 DistroRelease 
-rw-r--r-- 1 root root  10 May 29 00:13 ExecutableTimestamp 
-rw-r--r-- 1 root root 339968 May 29 00:13 CoreDump 
-rw-r--r-- 1 root root  5 May 29 00:13 ProblemType 
-rw-r--r-- 1 root root  66 May 29 00:13 ProcEnviron 
-rw-r--r-- 1 root root 969 May 29 00:13 ProcMaps 
-rw-r--r-- 1 root root 737 May 29 00:13 ProcStatus 
-rw-r--r-- 1 root root  2 May 29 00:13 Signal 
-rw-r--r-- 1 root root  31 May 29 00:13 Uname 
-rw-r--r-- 1 root root  14 May 29 00:13 ExecutablePath 
-rw-r--r-- 1 root root  14 May 29 00:13 ProcCmdline 
-rw-r--r-- 1 root root  1 May 29 00:13 ProcCwd 
-rw-r--r-- 1 root root  0 May 29 00:13 UserGroups 
@ubuntu:/tmp/coretest$ cd CoreDump 
bash: cd: CoreDump: Not a directory 
@ubuntu:/tmp/coretest$ sudo crash /tmp/vmlinux /boot/System.map-3.2.0-23-generic-pae /tmp/coretest/CoreDump 

crash 6.1.6 
Copyright (C) 2002-2013 Red Hat, Inc. 
Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation 
Copyright (C) 1999-2006 Hewlett-Packard Co 
Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited 
Copyright (C) 2006, 2007 VA Linux Systems Japan K.K. 
Copyright (C) 2005, 2011 NEC Corporation 
Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc. 
Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc. 
This program is free software, covered by the GNU General Public License, 
and you are welcome to change it and/or distribute copies of it under 
certain conditions. Enter "help copying" to see the conditions. 
This program has absolutely no warranty. Enter "help warranty" for details. 

GNU gdb (GDB) 7.3.1 
Copyright (C) 2011 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 
This is free software: you are free to change and redistribute it. 
There is NO WARRANTY, to the extent permitted by law. Type "show copying" 
and "show warranty" for details. 
This GDB was configured as "i686-pc-linux-gnu"... 

crash: /tmp/vmlinux: no debugging data available 

@ubuntu:/tmp/coretest$ 

per "Nessun dati di debugging disponibili", hanno bisogno di alcuni pacchetti debuginfo (nomeprogramma-DBG o progname-dbgsym) installati come da this link e questo one

Passi per il download dei pacchetti debuginfo per il kernel sono menzionati in que Bustione https://askubuntu.com/questions/197016/how-to-install-a-package-that-contains-ubuntu-kernel-debug-symbols

Tuttavia, passo di aggiungere una chiave GPG (come sotto) è di fondamentale importanza per il download di lavorare

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ECDCAD72428D7C01 

Si dovrebbe ricevere un messaggio come

chiave pubblica "Ubuntu Debug Symbol Archivio automatica Chiave di firma "importata

e non stato" non modificato ". Se dice "not changed" in questo passaggio, non sarai in grado di scaricare il pacchetto di debuginfo.

In questo caso prova a importare chiave GPG utilizzando http porta 80 come (here)

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 
+0

Felice che tu abbia ordinato tutti i pezzi! Puoi accettare la tua risposta su SO. :) – lurker

+1

@lurker funziona ora Ho scaricato anche il pacchetto debuginfo. Grazie –

2

vmlinuz è un file compresso, ma incidente richiede un file non compresso vmlinux, che viene compilato con -g opzione.
Assicurarsi che il kernel è stato compilato con l'opzione -g, e quindi è possibile ottenere un file di compresso vmlinux da compressa vmlinuz, utilizzando il metodo come segue:
1. od -t x1 -A d vmlinuz | grep "1f 8b 08"
        esempio si ottiene un'uscita:
        0018352 ac fe ff ff 1f 8b 08 00 00 00 00 00 02 03 CE fd
2. Calcolare l'offset a "1f 8b 08": 0.018.352 + 4 = 0.018.356.
3. Usare dd per decomprimere il vostro vmlinuz:
        dd if=vmlinuz bs=1 skip=18356 | zcat > vmlinux
ora si ottiene il file del kernel non compresso vmlinux. Complimenti!