22

The default Ubuntu kernel -generic package doesn't seem to have symbols in it.

I'm trying to avoid compile a kernel with debug info manually.

Does Ubuntu provide a package with kernel debug symbols?

Pro Backup
  • 3,170
  • 3
  • 24
  • 33
daisy
  • 6,440
  • 16
  • 57
  • 76

3 Answers3

30
  1. First create a ddebs.list using:

    echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/ddebs.list
    
  2. Then add the GPG key for ddebs.ubuntu.com:

    wget -O - http://ddebs.ubuntu.com/dbgsym-release-key.asc | sudo apt-key add -
    
  3. Then run:

    sudo apt-get update
    
  4. Then install the symbols package using:

    sudo apt-get install linux-image-`uname -r`-dbgsym
    

    This is rather huge (>680MB), so prepare for a wait while you download it.

I use the Linux kernel debug symbols for tools like systemtap on the kernel.

David Foerster
  • 35,754
  • 55
  • 92
  • 145
Colin Ian King
  • 18,370
  • 3
  • 59
  • 70
  • `apt-cache search dbgsym` returns `pkg-create-dbgsym` only, was it in some other repository? – daisy Oct 06 '12 at 09:40
  • 3
    @warl0ck Yes, the `-dbgsym` packages are in special repositories that you must enable, to install them. [This explains how](https://wiki.ubuntu.com/DebuggingProgramCrash#Debug_Symbol_Packages). – Eliah Kagan Oct 06 '12 at 10:15
  • I've now updated the post to clarify how to do that. – Colin Ian King Oct 06 '12 at 19:22
  • step `apt-get update` results in a warning message: `W: GPG error: http://ddebs.ubuntu.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ECDCAD72428D7C01`, that is why I am extending this with a solution for that case. – Pro Backup Aug 12 '14 at 18:55
  • 3
    `sudo apt-get install linux-image-$(uname -r)-dbgsym=3.13.0-49.83 Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package linux-image-3.13.0-49-generic-dbgsym E: Couldn't find any package by regex 'linux-image-3.13.0-49-generic-dbgsym'` – Kenny Evitt May 25 '15 at 22:08
  • Step for adding GPG key is crucial and should succeed in order for download step of debug info packages to work. Should see message like `public key "Ubuntu Debug Symbol Archive Automatic Signing Key " imported ` . If it says "unchanged" status then the download will fail. – Drt May 29 '15 at 09:46
  • I needed the additional fix from dragosb's answer. (Not tested myself, but bbb31's answer should work on its own.) – Philipp Claßen Aug 21 '17 at 12:04
9

I tried Colin Ian King's answer and it did not work for me. I found out I must add two extra lines in /etc/apt/sources.list.d/ddebs.list

Edit the file via

sudo nano /etc/apt/sources.list.d/ddebs.list

and add the two lines below

deb http://ddebs.ubuntu.com trusty-updates main restricted universe multiverse
deb http://ddebs.ubuntu.com trusty-proposed main restricted universe multiverse

Replace trusty with your version that you get when you execute

lsb_release -cs
dragosb
  • 213
  • 2
  • 8
9

For 16.04+:

GPG key import

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

Add repository config

codename=$(lsb_release -c | awk  '{print $2}')
sudo tee /etc/apt/sources.list.d/ddebs.list << EOF
deb http://ddebs.ubuntu.com/ ${codename}      main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-security main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-updates  main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-proposed main restricted universe multiverse
EOF

sudo apt-get update
sudo apt-get install linux-image-$(uname -r)-dbgsym

(credit to Ubuntu Wiki)

Philipp Claßen
  • 4,354
  • 6
  • 25
  • 31