给ubuntu安装调试符号(符号表)和源码

参考下面的链接中的方法,比这篇文章介绍的方法好

https://drgn.readthedocs.io/en/latest/getting_debugging_symbols.html#ubuntu


参考:

可以参照第一篇文章尝试用apt-get install安装,如果觉得速度慢,可以参考第二遍文章,到ubuntu官网,切换要安装的ubuntu的操作系统代号下,然后搜索linux-image-unsigned-$((uname −r))-dbgsym,可以在host执行uname -r获得ubuntu的版本。

比如:

$ uname -r
5.13.0-41-generic

$ lsb_release
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal

然后进入https://launchpad.net/ubuntu/focal ,搜索linux-image-unsigned-5.13.0-41-generic-dbgsym即可。
image

再说一下第一种方法,这个方法需要添加软件源:

echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse
 deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse
 deb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list

在执行apt update时,如果报告下面的错误:

W: GPG error: http://ddebs.ubuntu.com focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C8CAB6595FDFF622
E: The repository 'http://ddebs.ubuntu.com focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://ddebs.ubuntu.com focal-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C8CAB6595FDFF622
E: The repository 'http://ddebs.ubuntu.com focal-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://ddebs.ubuntu.com focal-proposed InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C8CAB6595FDFF622
E: The repository 'http://ddebs.ubuntu.com focal-proposed InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

那么可以参考下面博客的方法:
https://blog.csdn.net/wm9028/article/details/122982116

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

最后再执行apt update就可以了,或者执行

sudo apt install ubuntu-dbgsym-keyring

最后安装符号表:

sudo apt -y install linux-image-$(uname -r)-dbgsym
posted @ 2022-05-21 17:05  摩斯电码  阅读(92)  评论(0编辑  收藏  举报