{"id":134,"date":"2018-11-22T18:43:54","date_gmt":"2018-11-22T20:43:54","guid":{"rendered":"http:\/\/vargolino.com\/wp\/?p=134"},"modified":"2018-12-03T10:16:09","modified_gmt":"2018-12-03T12:16:09","slug":"upgrading-the-linux-image-in-debian-stretch","status":"publish","type":"post","link":"https:\/\/vargolino.com\/wp\/?p=134","title":{"rendered":"Upgrading the linux-image in Debian stretch"},"content":{"rendered":"<p>In the last few days I was trying to make some BPF scripts work and for that I tought I needed to upgrade my Debian to a new kernel. The original version is 4.9 with all the debian patches, and I&#8217;ve decided to go for the latest one available, which was 4.18.<\/p>\n<p><code>$ apt-cache search linux-image<\/code> got me a lot of options, like these<\/p>\n<pre>...\r\nlinux-image-amd64 - Linux for 64-bit PCs (meta-package)\r\n...\r\nlinux-image-4.9.0-7-686 - Linux 4.9 for older PCs\r\nlinux-image-4.9.0-7-686-dbg - Debug symbols for linux-image-4.9.0-7-686\r\nlinux-image-4.9.0-7-686-pae - Linux 4.9 for modern PCs\r\nlinux-image-4.9.0-7-686-pae-dbg - Debug symbols for linux-image-4.9.0-7-686-pae\r\n...\r\nlinux-image-4.18.0-0.bpo.1-686 - Linux 4.18 for older PCs\r\nlinux-image-4.18.0-0.bpo.1-686-dbg - Debug symbols for linux-image-4.18.0-0.bpo.1-686\r\nlinux-image-4.18.0-0.bpo.1-686-pae - Linux 4.18 for modern PCs\r\nlinux-image-4.18.0-0.bpo.1-686-pae-dbg - Debug symbols for linux-image-4.18.0-0.bpo.1-686-pae\r\nlinux-image-4.18.0-0.bpo.1-amd64 - Linux 4.18 for 64-bit PCs\r\nlinux-image-4.18.0-0.bpo.1-amd64-dbg - Debug symbols for linux-image-4.18.0-0.bpo.1-amd64\r\nlinux-image-4.18.0-0.bpo.1-cloud-amd64 - Linux 4.18 for x86-64 cloud\r\nlinux-image-4.18.0-0.bpo.1-cloud-amd64-dbg - Debug symbols for linux-image-4.18.0-0.bpo.1-cloud-amd64\r\nlinux-image-4.18.0-0.bpo.1-rt-686-pae - Linux 4.18 for modern PCs, PREEMPT_RT\r\nlinux-image-4.18.0-0.bpo.1-rt-686-pae-dbg - Debug symbols for linux-image-4.18.0-0.bpo.1-rt-686-pae\r\nlinux-image-4.18.0-0.bpo.1-rt-amd64 - Linux 4.18 for 64-bit PCs, PREEMPT_RT\r\nlinux-image-4.18.0-0.bpo.1-rt-amd64-dbg - Debug symbols for linux-image-4.18.0-0.bpo.1-rt-amd64\r\n...\r\n<\/pre>\n<p>I know my machine is amd64 (like most home computers) and I assumed bpo stanted for backport.<\/p>\n<p>Ultimately i&#8217;ve fired this:<\/p>\n<p><code>$ sudo apt-get install linux-image-4.18.0-0.bpo.1-amd64<\/code><\/p>\n<p>But bcc (https:\/\/github.com\/iovisor\/bcc) didn&#8217;t like it, issuing this error:<\/p>\n<pre>chdir(\/lib\/modules\/4.18.0-0.bpo.1-amd64\/build): No such file or directory\r\n<\/pre>\n<p>So I&#8217;ve tried to install the headers in order to build the kernel modules but the <code>linux-headers-4.18.0-0.bpo.1-amd64<\/code> package was complaining the the installed <code>linux-compiler-gcc-6-x86<\/code> was not the correct one, with this message:<\/p>\n<pre>The following packages have unmet dependencies:\r\n linux-headers-4.18.0-0.bpo.1-all : Depends: linux-headers-4.18.0-0.bpo.1-all-amd64 (= 4.18.6-1~bpo9+1) but it is not\r\n going to be installed\r\nE: Unable to correct problems, you have held broken packages.\r\n<\/pre>\n<p>Nice, don&#8217;t you love when <code>apt<\/code> tells you that you&#8217;ve held broken packages?<\/p>\n<p>So, I&#8217;ve looked up and found out that I had 3 different versions available<\/p>\n<pre>$ apt-cache show linux-compiler-gcc-6-x86 | grep Version\r\nVersion: 4.18.6-1~bpo9+1\r\nVersion: 4.9.130-2\r\nVersion: 4.9.110-3+deb9u6\r\n<\/pre>\n<p>And, of course, the one I had installed was for the 4.9 kernel<\/p>\n<pre>$ dpkg -l | grep linux-compiler-gcc-6-x86\r\nii  linux-compiler-gcc-6-x86             4.9.130-2                         amd64        Compiler for Linux on x86 (meta-package)\r\n<\/pre>\n<p>Installing the correct one was simple:<\/p>\n<pre>$ sudo apt-get install  linux-compiler-gcc-6-x86=4.18.6-1~bpo9+1\r\n<\/pre>\n<p>Then installing the headers was just a matter of issuing the apt command<\/p>\n<pre>$ sudo apt install linux-headers-4.18.0-0.bpo.1-amd64\r\n<\/pre>\n<p>Afterwards, as I was trying to use some new BPF features, I needed the userland headers properly installed, and upgraded the linux-libc-dev package as well.<\/p>\n<pre>sudo apt-get install linux-libc-dev=4.18.6-1~bpo9+1<\/pre>\n<p>Update:<br \/>\nThis guy&#8217;s post is way better:<br \/>\n<a href=\"http:\/\/jensd.be\/818\/linux\/install-a-newer-kernel-in-debian-9-stretch-stable\">http:\/\/jensd.be\/818\/linux\/install-a-newer-kernel-in-debian-9-stretch-stable<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the last few days I was trying to make some BPF scripts work and for that I tought I needed to upgrade my Debian to a new kernel. The original version is 4.9 with all the debian patches, and I&#8217;ve decided to go for the latest one available, which was 4.18. $ apt-cache search &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/vargolino.com\/wp\/?p=134\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Upgrading the linux-image in Debian stretch&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-134","post","type-post","status-publish","format-standard","hentry","category-solution","entry"],"_links":{"self":[{"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=134"}],"version-history":[{"count":5,"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/134\/revisions"}],"predecessor-version":[{"id":142,"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/134\/revisions\/142"}],"wp:attachment":[{"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}