The officially official Devuan Forum!

You are not logged in.

#1 2017-04-23 07:27:48

Registered: 2017-04-23
Posts: 6  

HOWTO: upgrade Devuan (stable) to the latest Linux kernel

This is a tutorial to upgrade the existing kernel to the latest version, or a version you select

Getting and compiling a Linux kernel need not be hard or complex.  The following tutorial is long, but not difficult. 

This tutorial assumes -

  • you've installed ( or upgraded to) Devuan 

  • you are compiling the kernel on the machine that will use it. Other configurations are do-able, just not part of this tutorial

  • you are compiling a i386 or amd64 system. This tutorial doesn't cover other architectures

  • you have a userid installed on the base system, if you are going to use userid 'root' then skip the 'setup sudo' part   

  • you know the 'root' password

  • you are ok with Grub. Grub update is completed by the 'make' install step. Tutorial uses only this method

Task list -

  • Setup 'sudo' so that you can do Administrator level work without being 'root'

  • Edit  apt-get  'sources.list'  to comment out the CD-ROM source, or move the cdrom definition to last place in the file 

  • Use apt-get to install the several prerequisites

  • Make a directory for the linux source files

  • Use   git   to clone the Linux branch (all of it to start)... roughly 3 GiB

  • Check latest linux version

  • Checkout the latest linux kernel version, or checkout a specific version

  • Get a copy of the kernel config from your current linux install

  • Use 'menuconfig' to prep the kernel .config file

  • Use 'make' to compile the kernel

  • Use 'make' to compile the various modules and to install everything

  • Reboot   to effect the new kernel

  • Check to see that your machine is using the new kernel version

  • Party !!

Detail task steps -

Switch User (su) to root to add your userid to "Sudo"  so that you can do Admin work without being administrator
  Open a Terminal window/screen, at prompt type


   and press [return/enter key], then provide root password  (default devuan pswd is:  toor )

Add  'Sudo' to your userid

    visudo        then press [return/enter key]

   Add your userid (ie:  bkm )  just below the entry for "root"  with same priviliges, etc..

     root    ALL=(ALL:ALL) ALL
     bkm     ALL=(ALL:ALL) ALL

   Press control-x to exit, select  "Y"  when prompted to save changes, then [enter]  key to exit
Back at root prompt, type in


Edit  sources.list  to comment out the CD-ROM source, or move the line with the definition to last place in file

     sudo nano /etc/apt/sources.list  

     Comment out (place a hash symbol  #  at beginning of line) "deb cdrom:..."
     Ctrl-x, then "Y" to save and exit

Use apt-get to install these several software prerequisites.

    sudo apt-get update          
    sudo apt-get install  libncurses5-dev build-essential  libssl-dev libelf-dev git  bison flex 

      press "Y" at  "Do you want to continue? [Y/n]"  prompt

Make a directory for the linux source files, then change directory into your new source directory.

    mkdir ~/src     
    cd ~/src       

Use   git   to clone the Linux branch (all of it to start)

    git clone [url][/url]      

Check latest linux version, cd into the git linux directory

    cd ~/src/linux   
    git tag -l              (that"s a lower case "L"  for list )


  check the listing for the highest level version, remember that 4.11 comes after 4.1

Checkout the latest linux kernel version after reviewing the git tag list (above)

    git checkout -f        

   OR if you want/know of a specific version then ie:

    git checkout v4.11-rc6   

Get a copy of the kernel config... from our current linux install

     cp /boot/conf*  ~/src/linux/.config      (note the  .config )

Validate the .config  using  'menuconfig'

    make menuconfig

  once in 'menuconfig'   (text based kernel config menu) then use arrow-keys to select <Exit>
   select <Yes> at the save .config prompt

Kick off the kernel compile, use 6 job threads to do the compile

    make -j 6

Kick off the kernel modules prepare, then install the modules

    make modules_prepare
    sudo make modules_install install

After the kernel is compiled, the large number of modules is installed, and GRUB2 is updated, then reboot to move to the new kernel version.

    sudo reboot

Once the reboot occurs you"ll see the GRUB boot menu,
  and if you do nothing (for the 5 seconds you"re allowed) then the latest kernel version will be used to boot the machine

Check to see if the machine is using the new kernel version
  Open a terminal session and at terminal prompt, type in:

  uname -a

  you should see something like...

     "Linux devuan 4.11.0-rc4+ #1 SMP Thu Mar 30.. x86_64 GNU/Linux"


  - maintaining your Linux kernel, housekeeping... 
         - assumes you start where you left off (above)

To go a bit further, you might want to customize your kernel a bit, or to recycle and compile another kernel.  Some helpful tips.

Gather information about your machine, helps when you want to customize your kernel.  The more you know about your machine, the finer you can tune it.

List and capture machine specific information. Run these commands, then store/print the output for reference.
  List PCI information

   lspci   >

  or   lspci -v              for more verbose information

  List USB information

   lsusb   >>

   or    lsusb -v          for more info

   List CPU info

   lscpu   >>

List Modules loaded and running on your machine

   lsmod  >>

Print out the       file and keep for reference.

Clean or Reset your kernel build environment.

Change to your Linux source directory, list the current kernel version, then save your existing .config file to something meaningful... ie: your kernel version!

   cd ~/src/linux
   uname -a 
   cp .config .config-4.11-rc2

Clean up and reset the kernel build env.

    make clean
    make mrproper

Copy your saved kernel configuration to  .config     

    cd ~/src/linux
    cp .config-4.11-rc2  .config

OR list the current /boot/configs and copy the one you want.  ie: latest

    cd ~/src/linux
    ls -la /boot/config
    cp /boot/config-4.11-rc2 .config  

Get the latest kernel updates from

   git fetch

List out the kernel versions.... remember 4.1, 4.11, 4.2...

   git tag -l 

Checkout the latest kernel version  (reset the master head) or select a specific kernel version (see way above).

   git checkout -f

Use steps below to  'make menuconfig' to validate the kernel .config

Now compile your kernel... and reboot.

Tune your kernel   .config   
Should you want to start tuning your kernel (shrinking it to the smallest possible size with the most flexibility) then you must modify the kernel .config   file by using the  'make menuconfig'  utility.  This is where your earlier inventory of machine hardware (above) is important. 

Ensure you've saved off your build environment .config or use the instructions above to make a copy of the exiting /boot/configxxx file.

An easy way to make a succinct kernel configuration, based on the currently loaded kernel modules

    cd ~/src/linux
    make localmodconfig

   check the listed modules against your machine inventory list (the listing). 

   Firmware for USB, networking cards, or wifi things are where most problems occur. 
   If it's ok with you then update your '/etc/apt/sources.list' for  contrib and non-free  repositories.
   firmware-linux-free comes with the standard install, but other firmware installs such as: firmware-linux, firmware-linux-nonfree,     firmware-iwlwifi, firmware-ralink, firmware-realtek, and many others, are in the 'contrib' and 'non-free' repositories.

The 'make'  wizard will ask you to decide on the fate of new/updated modules. 

For new or modified modules you'll be prompted to decide [Yes/No/Module/New] (New):  or similar.  Typically the default is in parens ie: '(New)', and that is probably a safe [enter] key for default option.

* PCI GPIO expanders
AMD 8111 GPIO driver (GPIO_AMD8111) [N/m/y/?] n
BT8XX GPIO abuser (GPIO_BT8XX) [N/m/y/?] (NEW) 

   go thru each module prompt till you're at the shell prompt again, then use   'make menuconfig'   (way above) to validate it.

Explore your kernel .config file
Explore your kernel .config via the 'make menuconfig'  menu.
Remember to refer to your previously printed/saved machine info and make intelligent decisions on what to remove, what to leave in.

cd ~/src/linux
cp .config-4.11-rc2 .config
make menuconfig

<exit> and <save>  to effect the .config changes, then use 'make' to compile your new, tuned kernel.  Reboot to enact it.

If your new, tuned, kernel doesn't boot
  Don't panic... we have the previous kernel remember? 

Reboot again, and at the restart Kernel Selection menu then use the arrow keys to select the 'Advanced...' options and select a previous kernel.

Last edited by batmore (2018-06-03 04:18:58)


#2 2017-05-01 15:20:33

From: Italy
Registered: 2017-04-15
Posts: 19  

Re: HOWTO: upgrade Devuan (stable) to the latest Linux kernel

Thanks for your guide! I have a question though: does Devuan/Debian ship with vanilla kernel? No custom patches?


#3 2017-05-01 20:07:54

Registered: 2017-04-23
Posts: 6  

Re: HOWTO: upgrade Devuan (stable) to the latest Linux kernel

Devuan RC currently ships with standard kernel.  On my machine...
  Linux devuan 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07) x86_64 GNU/Linux

Kernel as provided by Debian. So no "custom" patches that Devuan put in (that I'm aware of...).

Last edited by batmore (2017-05-01 20:09:06)


#4 2017-05-02 08:53:25

From: Italy
Registered: 2017-04-15
Posts: 19  

Re: HOWTO: upgrade Devuan (stable) to the latest Linux kernel

I see... I think the original package is this one. The page mentions "linux_3.16.39-1+deb8u2.debian.tar.xz" which seems to contain patches collected by Debian against the vanilla kernel. I think this answer my question, thanks smile


#5 2017-05-06 14:53:16

Registered: 2017-04-27
Posts: 2  

Re: HOWTO: upgrade Devuan (stable) to the latest Linux kernel

Hi batmore!
This was my first "selfmade" kernel...  smile
Thanks to you it was relatively easy. I'm now running on kernel version 4.9; until now no
problems occured.
Very nice HOWTO!
I forgot to mention, but

make menuconfig

did not work for me, so I tried

make nconfig

that way I could configue my kernel.
I did some searching, for menuconfig I obviously need the packages "ncurses-devel" or "libncurses5-dev";
those I did not find in the repositories. sad
Now I get on systemstart a failure-message on screen like "cpu freq kernel modules could not be loaded".
Otherwise everything seems to work well.
When I got time, I will start a new post!

Last edited by angus71 (2017-05-06 17:30:40)


#6 2018-03-20 20:21:48

Registered: 2017-04-23
Posts: 6  

Re: HOWTO: upgrade Devuan (stable) to the latest Linux kernel

I've updated the list of resources/prerequisits to install for make:  removed  module-init-tools, and added   bison and flex


#7 2018-06-02 18:41:44

From: UK
Registered: 2018-06-02
Posts: 1  

Re: HOWTO: upgrade Devuan (stable) to the latest Linux kernel

This is a very useful tutorial and I have a couple of updates/suggestions. Since kernel version 4.14 (I believe) the package "libelf-dev" is also required to compile. And with the package "debhelper" installed you can instead use

make -j 6 deb-pkg

to create a set of .deb packages to install, rather than using the make install steps. This makes it easier to copy your newly built kernel to other computers, or to uninstall it.


#8 2018-06-03 04:23:53

Registered: 2017-04-23
Posts: 6  

Re: HOWTO: upgrade Devuan (stable) to the latest Linux kernel

You are so right... I missed that library.  I'm glad you mentioned it, and I've updated the list of prerequisites.  I've not tried the "debhelper" deb-pkg route yet, so I'm off to give that a shot to see what it gains. 

great catch.


#9 2018-08-05 14:14:49

Registered: 2018-08-05
Posts: 2  

Re: HOWTO: upgrade Devuan (stable) to the latest Linux kernel

Hi everyone! May be not the right thread, but does anybody know where is the info regarding Devuan kernel rebuilding how-to? Can't find anywhere.


#10 2018-08-07 19:07:51

Registered: 2017-04-23
Posts: 6  

Re: HOWTO: upgrade Devuan (stable) to the latest Linux kernel

If you're refering to the production Devuan kernel, and how it's built, etc.. then I recommend going to  relay chat    #Devuan    and ask the question there... maybe from FSmithRed.


#11 2018-08-18 15:32:01

Registered: 2018-08-18
Posts: 1  

Re: HOWTO: upgrade Devuan (stable) to the latest Linux kernel

Sorry but with the next line:
cp /boot/conf*  ~/src/linux/.config

I have the error: ".config is not a directory" and I must step this. After I finish all the others steps all is OK but the ~/src directory is empty. It's ok?

Thanks in advance,

Last edited by mikel (2018-08-18 15:32:40)


#12 2018-08-19 00:48:15

Registered: 2018-08-14
Posts: 2  

Re: HOWTO: upgrade Devuan (stable) to the latest Linux kernel

mikel wrote:

Sorry but with the next line:
cp /boot/conf*  ~/src/linux/.config

I have the error: ".config is not a directory" and I must step this. After I finish all the others steps all is OK but the ~/src directory is empty. It's ok?

That error means you have more than one config* file in /boot, so the shell doesn't know which to use. You'll want to use something like:

cp /boot/config-4.9.0-7-amd64 ~/src/linux/.config

That version is the correct one for my ascii installations. You need the version that matches your current kernel, which you can see by typing:

uname -a


#13 2019-05-20 20:56:35

Registered: 2018-05-31
Posts: 144  

Re: HOWTO: upgrade Devuan (stable) to the latest Linux kernel

Way back before Devuan existed I'd build my own kernels. So much so, I created a script for it:

#! /bin/bash
# Small script for building a new 3.x kernel on Debian and derivatives
# Written by <private>
# Version: 1.0 @ May 6, 2014
# Requires minor editing for latest stable kernel version
# The make install and mkinitramfs steps requires root permissions.
# This script is released under the GPL:

# Preparing your system:

# First, we'll install the build environment with some extra's to aid configuration of the new kernel

apt-get install build-essential libncurses5-dev wget tar

# To keep things tidy a new directory for the kernel is created. Remove or comment out both lines if you don't want this.
# If you comment these line out or remove them, the kernel will be downloaded and installed in the current working directory.

mkdir ~/kernel
cd ~/kernel

# Getting the source and preparing it for use:

# edit these lines to represent the latest (longterm support) stable kernel from the team

wget -q
tar -xvf linux-3.12.18.tar.xz
cd linux-3.12.18

# Configuring the new kernel:

# Run manually if this part fails and accept all defaults, then comment out the next line with a # in front.
# Alternatively, use "make oldconfig" but this will ask a lot of questions you'd need to answer individually.
# Provided you have installed the correct packages, you can also use the "make xconfig" tool if you're working
# in a graphical environment.

make menuconfig

# Building the kernel and putting everything in place to use:

# This is the part that does the actual work:

make && make modules && make modules_install && make install && mkinitramfs -o /boot/initrd.img-3.12.18 3.12.18

# The last portion of the above line should be edited if another kernel version is used!

# Now you need to update your bootloader to add the new kernel. Most Linux distributions now use Grub2 by default.
# If yours uses the old Grub or Lilo, comment out this line and configure/run manually.


# After you've done that, and checked thoroughly twice, it's time to reboot into your new kernel.

exit 0

As you've noticed, this is aimed at the 3.x series kernel, I guess with minor editing this script can also be used for new 4.x and perhaps even the upcoming 5.x series kernel. Unless the tool-chain or its syntax has significantly changed since, I haven't had to build a kernel in several years, due to using a (cutting-edge) source-based distro. (Funtoo, in my case) This script was also intended as a teaching tool for those wishing to compile their own kernels but hadn't tried yet, hence the copious amounts of comments. wink


[edit: I've also found an earlier, undated version of this script, dealing with a 2.6.38 kernel (that's telling! wink ) last modified Spring 2011... tongue  [/edit]

Last edited by Dutch_Master (2019-05-21 04:01:30)


Board footer