Skip to content

Instantly share code, notes, and snippets.

@bobisme
Created July 12, 2011 17:29
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save bobisme/1078482 to your computer and use it in GitHub Desktop.
Save bobisme/1078482 to your computer and use it in GitHub Desktop.
Build/install custom linux kernel headers in ubuntu.

Linux Headers

  • Install tools to build:
sudo apt-get update
sudo apt-get install kernel-package fakeroot wget bzip2
cd ~/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.3.tar.bz2
  • Build
tar xjf linux-2.6.39.3.tar.bz2
cd linux-2.6.39.3

# Restore config
zcat /proc/config.gz > .config

make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-linode34 kernel_headers
  • After it finishes compiling:
cd ..
sudo dpkg -i linux-headers-2.6.39.3-linode34_2.6.39.3-linode34-10.00.Custom_i386.deb
cd /usr/src
sudo ln -s linux-headers-2.6.39.3-linode34 linux-headers-2.6.39.1-linode34
cd /lib/modules/2.6.39.1-linode34
sudo ln -s /usr/src/linux-headers02.6.39.1-linode34 build
@darbee
Copy link

darbee commented Sep 3, 2018

when I run : sudo dpkg -i linux-headers-2.6.39.3-linode34_2.6.39.3-linode34-10.00.Custom_amd64.deb
it report error:
Selecting previously unselected package linux-headers-2.6.39.3-linode34.
(Reading database ... 218157 files and directories currently installed.)
Preparing to unpack linux-headers-2.6.39.3-linode34_2.6.39.3-linode34-10.00.Custom_amd64.deb ...
Unpacking linux-headers-2.6.39.3-linode34 (2.6.39.3-linode34-10.00.Custom) ...
Setting up linux-headers-2.6.39.3-linode34 (2.6.39.3-linode34-10.00.Custom) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 2.6.39.3-linode34 /boot/vmlinuz-2.6.39.3-linode34
Error! Your kernel headers for kernel 2.6.39.3-linode34 cannot be found.
Please install the linux-headers-2.6.39.3-linode34 package,
or use the --kernelsourcedir option to tell DKMS where it's located

@slightlytwisted
Copy link

The same thing happened to me, but after rebooting with the newly built kernel I was able to run sudo dpkg -i to install the custom headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment