{"id":130,"date":"2018-02-05T15:44:07","date_gmt":"2018-02-05T23:44:07","guid":{"rendered":"https:\/\/sysprogs.com\/tutorials\/?p=130"},"modified":"2018-02-05T15:44:07","modified_gmt":"2018-02-05T23:44:07","slug":"getting-kernel-symbolssources-on-fedora-linux","status":"publish","type":"post","link":"https:\/\/sysprogs.com\/VisualKernel\/tutorials\/setup\/fedora\/","title":{"rendered":"Getting Kernel Symbols\/Sources on Fedora Linux"},"content":{"rendered":"<p>This tutorial shows how to prepare your a RedHat-based (e.g. Fedora, CentOS) Linux machine for kernel debugging without rebuilding the kernel.<\/p>\n<p>Note that if you are using VisualKernel, this will be done automatically by the VisualKernel project wizard. This page provides instructions on doing it manually in order to help diagnosing common problems.<\/p>\n<p>As the kernel provided by the distribution does not include sources and symbols, we will need to install the corresponding packages manually. This page provides step-by-step instructions on doing that:<\/p>\n<ol>\n<li>Determine the exact\u00a0<strong>release<\/strong>\u00a0and\u00a0<strong>version<\/strong>\u00a0of your kernel by running the following commands:\n<pre class=\"code\">uname -r\r\nuname -v<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sysprogs.com\/VisualKernel\/legacy_tutorials\/setup\/fedora\/img\/01-releasever.png\" width=\"657\" height=\"340\" \/>In this example the release is\u00a0<strong>3.9.5<\/strong>\u00a0and the version number is\u00a0<strong>#1<\/strong>.<\/li>\n<li>Before we can download the kernel symbol package we need to enable the debug repository in the system repository list. Go to the\u00a0<strong>\/etc\/yum.repos.d<\/strong>\u00a0directory to find out the name of your repository list file:<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sysprogs.com\/VisualKernel\/legacy_tutorials\/setup\/fedora\/img\/02-repos.png\" width=\"683\" height=\"447\" \/><\/li>\n<li>Edit the file (e.g.\u00a0<strong>sudo nano fedora.repo<\/strong>) to enable the debuginfo repository:<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sysprogs.com\/VisualKernel\/legacy_tutorials\/setup\/fedora\/img\/03-debuginfo.png\" width=\"683\" height=\"447\" \/><\/li>\n<li>Install the kernel debug package by running the following command:\n<pre class=\"code \">yum install kernel-debuginfo-&lt;release&gt;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sysprogs.com\/VisualKernel\/legacy_tutorials\/setup\/fedora\/img\/04-install.png\" width=\"683\" height=\"654\" \/>Note that if you are running a debug kernel (installed via the\u00a0<strong>kernel-debug<\/strong>\u00a0package), you need to install the\u00a0<strong>kernel-debug-debuginfo-xxx<\/strong>\u00a0package instead.<\/li>\n<li>Find the directory with your kernel symbols under\u00a0<strong>\/usr\/lib\/debug\/lib\/modules<\/strong>\u00a0and use gdb to check that the version recorded in the symbols matches the kernel version you are running:<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sysprogs.com\/VisualKernel\/legacy_tutorials\/setup\/fedora\/img\/05-version.png\" width=\"683\" height=\"548\" \/><\/li>\n<li>Find the kernel source directory for your kernel version under\u00a0<strong>\/usr\/src\/debug<\/strong>:<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sysprogs.com\/VisualKernel\/legacy_tutorials\/setup\/fedora\/img\/06-sources.png\" width=\"683\" height=\"548\" \/><\/li>\n<\/ol>\n<p>Now that you have installed and checked both symbols and sources you can use gdb to debug the kernel on your machine.<\/p>\n<p>Note that if you are using VisualKernel, the symbols and sources will be automatically installed by the project wizard. See\u00a0<a href=\"http:\/\/sysprogs.com\/VisualKernel\/tutorials\/kgdb\/\">this tutorial\u00a0<\/a>for a detailed example.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to prepare your a RedHat-based (e.g. Fedora, CentOS) Linux machine for kernel debugging without rebuilding the<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[],"_links":{"self":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/130"}],"collection":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/comments?post=130"}],"version-history":[{"count":1,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/130\/revisions"}],"predecessor-version":[{"id":131,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/130\/revisions\/131"}],"wp:attachment":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/media?parent=130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/categories?post=130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/tags?post=130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}