LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Kernel version 4.1 and 4.2 upgrade/compile guide (https://www.linuxquestions.org/questions/debian-26/kernel-version-4-1-and-4-2-upgrade-compile-guide-4175552272/)

m_yates 08-31-2015 07:00 PM

Kernel version 4.1 and 4.2 upgrade/compile guide
 
The purpose of this post is to concisely list the steps needed to install a newer kernel version in Debian Jessie, and also to compile your own custom kernel. For more detailed documentation, you can refer to the Debian kernel handbook:

http://kernel-handbook.alioth.debian.org/

Upgrading and customizing a kernel isn't something that most people will need to do. If all you need is to compile a new module, simply install the headers for your existing kernel from the Debian repositories. However, it is sometimes necessary to install a newer kernel to provide support for hardware that isn't supported by version 3.16. Reasons to consider customizing the kernel include the removal of unnecessary modules, patching the kernel source for some added functionality, or to tinker and learn about the process of creating Debian kernel packages.

With that said, here a 3 ways to do it outlined below (1) Installing a pre-compiled kernel from Debian backports, (2) Patching and compiling a custom kernel from the Debian backports source files, and (3) Compiling a custom kernel from the official sources at kernel.org.

1. Installing pre-compiled 4.1 kernel using Debian backports.


This is the fastest way to obtain a newer kernel. Simply edit your sources.list file:

Code:

su
nano /etc/apt/sources.list

and add the following to the bottom of the file:

Code:

# jessie backports
deb http://http.debian.net/debian jessie-backports main contrib non-free

Hit ctrl+o, then enter to save the changes, and ctrl+x to exit the nano text editor. Next, run apt-get update as root:

Code:

su
apt-get update

To see what kernels are available:

Code:

apt-cache search linux-image
On my 64-bit computer, the output is:

Code:

root@pinto:~# apt-cache search linux-image
linux-headers-3.16.0-4-amd64 - Header files for Linux 3.16.0-4-amd64
linux-image-3.16.0-4-amd64 - Linux 3.16 for 64-bit PCs
linux-image-3.16.0-4-amd64-dbg - Debugging symbols for Linux 3.16.0-4-amd64
linux-image-amd64 - Linux for 64-bit PCs (meta-package)
linux-image-amd64-dbg - Debugging symbols for Linux amd64 configuration (meta-package)
nvidia-kernel-3.16.0-4-amd64 - NVIDIA binary kernel module for Linux 3.16.0-4-amd64
linux-headers-4.1.0-0.bpo.1-amd64 - Header files for Linux 4.1.0-0.bpo.1-amd64
linux-headers-4.1.0-0.bpo.1-rt-amd64 - Header files for Linux 4.1.0-0.bpo.1-rt-amd64
linux-image-4.1.0-0.bpo.1-amd64 - Linux 4.1 for 64-bit PCs
linux-image-4.1.0-0.bpo.1-amd64-dbg - Debugging symbols for Linux 4.1.0-0.bpo.1-amd64
linux-image-4.1.0-0.bpo.1-rt-amd64 - Linux 4.1 for 64-bit PCs, PREEMPT_RT
linux-image-4.1.0-0.bpo.1-rt-amd64-dbg - Debugging symbols for Linux 4.1.0-0.bpo.1-rt-amd64
linux-image-rt-amd64 - Linux for 64-bit PCs (meta-package), PREEMPT_RT
linux-image-rt-amd64-dbg - Debugging symbols for Linux rt-amd64 configuration (meta-package)
root@pinto:~#

As can be seen above, kernel version 3.16 is available in the Debian stable repositories, and version 4.1 is available from the backports. There are 2 versions of the 4.1 kernel, with and without the realtime (rt) patch. To install the newer kernel from backports:

Code:

aptitude -t jessie-backports install linux-image-4.1.0-0.bpo.1-amd64
You may also want to install headers to allow the compilation of modules for the new kernel:

Code:

aptitude -t jessie-backports install linux-headers-4.1.0-0.bpo.1-amd64
You will see an error message about possible missing firmware for for module r8169 (a realtek chip). That firmware can be installed with:

Code:

aptitude -t jessie-backports install firmware-realtek
You can install other non-free firmware with:

Code:

aptitude -t jessie-backports install firmware-linux
Grub is automatically updated with an entry for the new kernel. At bootup, the Grub menu will allow you to select between the Debian/GNU-Linux default and advanced options. The default is the newer 4.1 kernel, the advanced options allow you to choose between the 4.1 and 3.16 kernels and recovery modes. After rebooting, you can confirm the new kernel is installed by running uname -r. The output of uname -r should be: 4.1.0-0.bpo.1-amd64.

2. Compiling a custom 4.1 kernel from the Debian backports sources

If you need to customize the 4.1 kernel, the kernel sources are available from Debain backports to allow you to compile your own. You can check what sources are available using apt-cache search linux-source (after adding the backports repository as described above):

Code:

root@pinto:~# apt-cache search linux-source
linux-source-3.16 - Linux kernel source for version 3.16 with Debian patches
linux-source - Linux kernel source (meta-package)
linux-source-4.1 - Linux kernel source for version 4.1 with Debian patches

The output above shows the 4.1 kernel source is available with Debian patches applied. To install the 4.1 kernel source:

Code:

aptitude -t jessie-backports install linux-source-4.1
The installed source files can be found in the directory /usr/src. The linux-source-4.1 package created a directory linux-config-4.1 containing configurations for different processor architectures and the files linux-patch-4.1-rt.patch.xz and linux-source-4.1.tar.xz.

Next uncompress the source, rt patch, and symbolically link the source to /usr/src/linux:

Code:

cd /usr/src
tar xf linux-source-4.1.tar.xz
unxz linux-patch-4.1-rt.patch.xz
ln -s linux-source-4.1 linux

I am applying the rt patch to the kernel just as a demonstration. I don't really need a realtime kernel, but I'm applying the realtime patch to illustrate how a patch is applied:

Code:

cd /usr/src/linux
patch -p1 < /usr/src/linux-patch-4.1-rt.patch

A kernel patch is a file typically ending with the .patch extension. A patch modifies the source code and typically only works for a specific version of the source code. If you have a patch written for the 3.16 kernel, it will likely fail if you try and apply it to the 4.1 version of the source. Check for errors after applying the patch command. The above rt patch worked fine since it was written specifically for this kernel source.

The kernel source package comes with a bunch of configurations for different processor architectures in the directory /usr/src/linux-config-4.1/. Since I am applying the rt patch to the amd64 kernel, I'll use the configuration supplied:

Code:

cd /usr/src/linux/linux-config-4.1
unxz config.amd64_rt_amd64.xz
cp config.amd64_rt_amd64 /usr/src/linux/.config

Make sure that you have all the tools needed for compilation:

Code:

aptitude install build-essential
Now, adjust the kernel configuration as needed using make menuconfig. Make sure you have libncurses5-dev installed first:

Code:

aptitude install libncurses5-dev
Code:

cd /usr/src/linux
make menuconfig

You can navigate the menus and make changes following the instructions on the top of the screen. Once you have the configuration as you like it, save it and exit.

Then you can compile the kernel package with:

Code:

cd /usr/src/linux
make clean
make deb-pkg LOCALVERSION=-kernel_name KDEB_PKGVERSION=1

The above command compiles the packages with my local version name -kernel_name appended, and applies a version number 1. You can choose whatever name you like in place of "kernel_name". Be prepared to wait a long time for the packages to compile.

When it is done, the kernel and header deb files can be found in the directory /usr/src/:

linux-image-4.1.3-rt3-kernel_name_1_amd64.deb
linux-image-4.1.3-rt3-kernel_name-dbg_1_amd64.deb
linux-headers-4.1.3-rt3-kernel_name_1_amd64.deb
linux-libc-dev_1_amd64.deb

Install the kernel and headers with:

Code:

dpkg -i linux-image-4.1.3-rt3-kernel_name_1_amd64.deb
dpkg -i linux-headers-4.1.3-rt3-kernel_name_1_amd64.deb

The deb file with dbg contains debugging symbols, and the one with libc-dev contains headers for glibc. I'm not installing either of those. Reboot and grub has been automatically updated with the new kernel as default. You can select older kernels using the advanced option on the grub menu.

3. Compiling a custom 4.2 kernel using the official sources from kernel.org

If Debian backports doesn't have a kernel new enough, you can download the latest version as a tar.xz from kernel.org. Move it to /usr/src and extract it there:

Code:

cd /usr/src
tar xf linux-4.2.tar.xz

remove the old symbolic link to /usr/src/linux if there is one:

Code:

cd /usr/src
rm linux

create a new symbolic link:

Code:

cd /usr/src
ln -s linux-4.2 linux

If you have the 4.1 source from backports installed, You can grab a 4.1 configuration file from the ones supplied from the linux-source-4.1 package:

Code:

cd /usr/src/linux-config-4.1
unxz config.amd64_none_amd64.xz
cp config.amd64_none_amd64 /usr/src/linux/.config

If you don't have linux-source-4.1 installed and don't want to install it, you can grab a configuration file from whatever is the latest version of the kernel you are running:

Code:

cd /usr/src/linux
cp /boot/config-<version> .config

where "config-<version>" is the configuration file for the whatever is the latest kernel version you have installed.

Make sure that you have all the tools needed for compilation:

Code:

aptitude install build-essential
Run make oldconfig to answer questions about configuration options that are new in version 4.2 compared to the earlier version:

Code:

cd /usr/src/linux
make oldconfig

You can just keep hitting the enter key to accept default selections for all of the questions, or choose a different answer. The default option is the one in uppercase.

You can further tweak things if you like using make menuconfig. Make sure you have libncurses5-dev installed first:

Code:

aptitude install libncurses5-dev
Code:

cd /usr/src/linux
make menuconfig

Follow the directions at the top of the screen to navigate menus and make any changes to the configuration that you want. Save and exit, then compile the kernel with:

Code:

make clean
make deb-pkg LOCALVERSION=-kernel_name KDEB_PKGVERSION=1

I added my local version -kernel_name and version number 1. You can pick whatever name you like instead of "kernel_name". The resulting kernel and header deb files will be placed in /usr/src and can be installed with:

Code:

dpkg -i linux-image-4.2.0-kernel_name_1_amd64.deb
dpkg -i linux-headers-4.2.0-kernel_name_1_amd64.deb

When you reboot, the latest 4.2 kernel will be the default in the grub menu. After bootup, uname -r gives: 4.2.0-kernel_name as the output, confirming that you are running the new kernel.

Hope that this is helpful. Post replies or message me if the guide needs improvement. I tested all of this on a fresh install of Debian Jessie with default options, so it should work. I'm submitting this post from the same machine running the 4.2 kernel released yesterday that I compiled as described above.

NOTE: One problem that I ran into is disk space. You will need about 10-15 GB free for compilation of each kernel source that you use. Apparently, the default is to compile with debugging symbols that take up huge space. After you are done, you can free up space with:

Code:

cd /usr/src
rm -rf linux-4.2
rm -rf linux-source-4.1

Enjoy!

mzsade 09-01-2015 09:56 AM

Thank you for the guide, @m_yates. In my peculiar case both the kernels that came with the distribution, 4.1 and 4.1-rt, failed to boot but i somehow bungled my way into successfully upgrading to kernel 4.2 without recourse to the old config.
Don't wish to clutter the thread by rambling on about it so i'll just post a link to my screenshot. :D

m_yates 09-01-2015 12:38 PM

Quote:

Originally Posted by mzsade (Post 5414186)
Thank you for the guide, @m_yates. In my peculiar case both the kernels that came with the distribution, 4.1 and 4.1-rt, failed to boot but i somehow bungled my way into successfully upgrading to kernel 4.2 without recourse to the old config.
Don't wish to clutter the thread by rambling on about it so i'll just post a link to my screenshot. :D

Congrats! Configuring a kernel from scratch isn't easy to do. I'm sure you learned a lot about your hardware specs and the all the configuration options. :)

mzsade 09-01-2015 01:41 PM

Thanks, amongst the clueless half-baked Linux users i guess i am the most advanced one. ;)

Have a couple of questions related to the upgrade,
1) Neither the image nor the headers are showing in synaptic. Is that normal? It's highly unlikely that i'd want to downgrade but if i were to, how'd i go about it?

2) Would it be safe for me now to remove kernel 3.16 via it's image and header from synaptic? I have booted from the new kernel several times now without any problems and other than an inconsequential error message about some jack driver being already installed or something to that effect, and pulseaudio, everything seems to be working fine..Please don't expend of yourself overthinking this, i consider this a test partition and it will be no big deal if i have to reinstall everything from scratch, i just want to know if i am missing something that's obvious. :)

m_yates 09-01-2015 04:37 PM

1) If you compiled the kernel as a deb package and installed it using dpkg, it should be in Synaptic. To find it, open Synaptic and click on the button labeled "Origin" at the lower left. Then click on "Local" at the upper left. You should then see a list of things installed locally from deb files, rather than from internet repositories. If you want to downgrade, reboot into the older kernel that you want to keep, then uninstall the newer kernel and headers using synaptic, aptitude, or apt-get. You should not try to uninstall the kernel while using it.

2) It is safe to remove unused kernels. It shouldn't affect you. If you use Synaptic, aptitude, or apt-get to remove it, the Grub menu should be automatically updated to delete the old entries. If you keep a Debian-based system for years, you may get new kernels as security updates. The default with any kernel update is to keep the old one in case you have a problem with the new one. However, once you are satisfied that the new kernel is working, it is safe to remove old ones to free up disk space.

mzsade 09-01-2015 07:37 PM

Quote:

Originally Posted by m_yates (Post 5414436)
1) If you compiled the kernel as a deb package and installed it using dpkg, it should be in Synaptic..

That's the thing, because of my failure with the distribution's kernels i decided to give the oldconfig a miss and after
Code:

cd /usr/src/linux
make menuconfig

and selecting all the defaults, did a
Code:

make #This took about 4hrs.
make modules
make modules_install
make install

Quote:

2) It is safe to remove unused kernels. It shouldn't affect you. If you use Synaptic, aptitude, or apt-get to remove it, the Grub menu should be automatically updated to delete the old entries.
Did that already, in fact changed "jessie" to "stretch" (except in the deb for backports), updated and did a
Code:

sudo aptitude safe-upgrade
Downloaded a ton of upgrades and can boot back into the system too but still don't see kernel 4.2 in synaptic, my fault entirely, goes without saying.
Anyhoo, this kernel upgrade hasn't quite been what i imagined it would be like, pulse stopped working, get that irritating "Driver pcspcr is already registered, Aborting" message after every boot, my Qupzilla has become as slow as iceweasel and /etc/xdg/openbox/autostart doesn't work anymore. Lesson learned, "if it ain't broke, don't fix it". :redface: :cry:

Edit: Now that i think about it, i do blame the guide to some extent. :p
For one thing, it should have been made as a standalone without any reference to the old kernels or their configs, that's the whole point of a "vanilla" kernel, isn't it.
These steps made me veer off:

Code:

Grab a 4.1 configuration file from the ones from the linux-source-4.1 package from Debian backports:

Code:
cd /usr/src/linux-config-4.1
unxz config.amd64_none_amd64.xz
cp config.amd64_none_amd64 /usr/src/linux/.config

Run make oldconfig to answer questions about configuration options that are new in version 4.2 compared to version 4.1:

And for someone who is trying to avoid having anything to do with the previous configs and wishes to use the guide only for the upgrade to 4.2, this, especially the "LOCALVersion=pinto" is a cryptic thing sprung out of nowhere. Makes the whole thing very disjointed.
Code:

make deb-pkg LOCALVERSION=-pinto KDEB_PKGVERSION=1
Instead, the make menuconfig step could have been expanded on, having avoided the above to lead directly to make clean with this "pinto" explained in more detail.

I apologize for being such an ungrateful wretch but in my own clumsy way, i am only trying to make this guide better to the best of my ineptitude.

m_yates 09-02-2015 07:59 AM

1) If you want to manage kernels using Debian's package management tools, then I suggest recompiling the 4.2 kernel as a deb package and install it that way as described above. After installing the deb file, reboot into that kernel. You can then delete the kernel you installed from source by deleting the installed files and directories for it:

Code:

su
rm -rf /lib/modules/kernel_version
rm -f /boot/vmlinuz-kernel_version*
rm -f /boot/initrd.img-kernel_version*
rm -f /boot/config-kernel_version*
rm -f /boot/System.map-kernel_version*
update-grub

where "kernel_version" is the name of the one you installed from source. MAKE CERTAIN that you choose the name of the kernel you installed from source, and not a kernel that you want to keep!

2) Sorry my "pinto" name is confusing. It is just the local name I chose for the computer and appended it to the kernel. I name all of my computers after cars. The old piece of junk test machine that I used to create this guide was named after the Ford Pinto. My laptop is "Boxster", my main desktop at work is named "Diablo" after the Lamborghini Diablo, etc. I'll edit the post to say "kernel_version" instead. You can choose whatever kernel name you like in place of "-pinto".

3) I wanted to keep this guide concise, and it is already long. As you probably found out for yourself, there are a lot of configuration options when you run "make menuconfig" and I can't go through all of them. It is much easier and faster to use an existing configuration as a starting point. However, you don't need to install linux-source from backports if you don't want to, you can use the config from whatever kernel you have installed:

Code:

su
cd /usr/src/linux
cp /boot/config-<version> .config

where "config-<version>" is the name of the configuration file for whatever is the latest version of the kernel you have installed. I'll update the post to show that option.

mzsade 09-02-2015 12:15 PM

Thank you very much, that brings so much clarity to my mind. I should let you know that in the meantime i upgraded to the latest liquorix kernel as per this and the results were identical to what i experienced with my upgrades to kernels 4.1 and 4.1-rt, i got the famous liquorix splash screen but the boot process froze exactly as before after this output:

Ignoring BGRT: Invalid Status 0 (expected 1)
Loading please wait...
fsck from util-linux 2.26.2
/dev/sda3: clean, XXXX/XXXXXX files, XXXX/XXXXXX blocks
systemd[1]: wfs-common-service: Job nfs-common.service/start deleted to break ordering cycle starting with sysint.target/start
systemd[1]: wfs-common-service: Job nfs-common.service/start deleted to break ordering cycle starting with sysint.target/start

Then the cursor disappeared and there was no other way out of it other than by powering off manually.

In the end i reinstalled because in the first place, i'd made a right mess of the whole thing, and on top of everything, changed my repos to Stretch and removed kernel 3.16 from synaptic of a system which was working quite well inspite of the cockamamie manner in which i had upgraded the kernel to 4.2.
I am now reconfiguring my system and narrating how i go about it on the Debian post installation Sticky. Will be a while before i get around to upgrading the kernel again. I will also have to look into the matter of pulseaudio and sound not working after the upgrade, and the "Driver pspcr is already registered, aborting" message before i go about it. I thank you again for your trouble and hope to be guided when i come to that stage.

mzsade 09-03-2015 01:51 AM

Hi, following this: 3. Compiling a custom 4.2 kernel using the official sources from kernel.org
Hit my first snag at
Code:

make oldconfig
, seems i do not have "make" by default so i am installing that, also dpkg-dev

Compiling is frozen here for the last 30 minutes,
Code:

dpkg-deb: building package `linux-firmware-image-4.2.0-3.16.0-4-amd64' in `../linux-firmware-image-4.2.0-3.16.0-4-amd64_1_amd64.deb'.
dpkg-deb: building package `linux-headers-4.2.0-3.16.0-4-amd64' in `../linux-headers-4.2.0-3.16.0-4-amd64_1_amd64.deb'.
dpkg-deb: building package `linux-libc-dev' in `../linux-libc-dev_1_amd64.deb'.
dpkg-deb: building package `linux-image-4.2.0-3.16.0-4-amd64' in `../linux-image-4.2.0-3.16.0-4-amd64_1_amd64.deb'.
dpkg-deb: building package `linux-image-4.2.0-3.16.0-4-amd64-dbg' in `../linux-image-4.2.0-3.16.0-4-amd64-dbg_1_amd64.deb'.

Will give it another 15 then snuff the process, maybe even delete the whole partition..

m_yates 09-03-2015 09:38 AM

You'll get make and dpkg-dev, among other things needed for compilation by installing:
Code:

aptitude install build-essential
I'll edit the post again to state that. I ran through the commands in the order I have them listed in the original post, and by the time I got to the compilation step I had everything installed that I needed except dpkg-dev. The other packages were either installed in the default Jessie install, or added as dependencies by aptitude in the earlier steps. I'll just edit the post to replace the line "aptitude install dpkg-dev" with "aptitude install build-essential". I shouldn't have assumed that everyone will run through all the commands in the post.

mzsade 09-03-2015 12:26 PM

I tried it again, this time i had everything installed including libncurses5-dev but make menuconfig was still terminated with an Error. Everything went fine with make oldconfig and you were right, i did get an inside look into the various hardware options when i paused to look at them, but sadly it seems a proper kernel upgrade is not for the likes of me. In my present state of despondency i am tempted to try this out but i don't think i can stoop so low. :(

Edit: You missed a typo; "make menconfig" :)

m_yates 09-03-2015 03:13 PM

Do you see a read/write error while compiling? I ran into that problem previously. The compilation would proceed for a long time, then crash out at some random point with a message about a read/write error, followed by some error about the module being compiled at the time of the crash. If you are seeing read/write errors, that is probably because your disk drive has bad sectors. When that was happening to me, I swapped in a new hard drive and everything worked after re-installing Debian on the new drive.

I corrected the typo. Thanks.

mzsade 09-04-2015 12:06 AM

Code:

make menuconfig
  HOSTCC  scripts/kconfig/mconf.o
In file included from scripts/kconfig/mconf.c:23:0:
scripts/kconfig/lxdialog/dialog.h:38:20: fatal error: curses.h: No such file or directory
 #include CURSES_LOC
                    ^
compilation terminated.
scripts/Makefile.host:108: recipe for target 'scripts/kconfig/mconf.o' failed
make[1]: *** [scripts/kconfig/mconf.o] Error 1
Makefile:531: recipe for target 'menuconfig' failed

aptitude install build-essential had returned 0 to install and 0 to upgrade since i already had all the packages installed. I must have some kind of a masochistic streak, this is for the fourth time, i think..

Edit: I am such an idiot, had libncurses5 not libncurses5-dev, forgot that this was a fresh installation..am going by the book this time. Sorry for pestering you needlessly.
Edit: Chose make silentoldconfig this time, thought it'd spare me the interrogation, it didn't, make menuconfig went without a hitch, make deb-pkg is doing it's thing, i will dull my mind a bit more till it finishes with Terminator Genisys which has been loading on my PC.

m_yates 09-04-2015 09:36 AM

The compilation took about 2 hours on my old PC, but I included all of the default modules in the configuration supplied by the linux-source-4.1 package. It is a good time to enjoy a delicious beverage or three while the compilation is running. Hope it worked for you this time.

mzsade 09-04-2015 11:18 AM

Code:

dpkg-deb: building package `linux-firmware-image-4.2.0-3.16.0-4-amd64' in `../linux-firmware-image-4.2.0-3.16.0-4-amd64_4.2.0-3.16.0-4-amd64-1_amd64.deb'.
dpkg-deb: building package `linux-headers-4.2.0-3.16.0-4-amd64' in `../linux-headers-4.2.0-3.16.0-4-amd64_4.2.0-3.16.0-4-amd64-1_amd64.deb'.
dpkg-deb: building package `linux-libc-dev' in `../linux-libc-dev_4.2.0-3.16.0-4-amd64-1_amd64.deb'.
dpkg-deb: building package `linux-image-4.2.0-3.16.0-4-amd64' in `../linux-image-4.2.0-3.16.0-4-amd64_4.2.0-3.16.0-4-amd64-1_amd64.deb'.
dpkg-deb: building package `linux-image-4.2.0-3.16.0-4-amd64-dbg' in `../linux-image-4.2.0-3.16.0-4-amd64-dbg_4.2.0-3.16.0-4-amd64-1_amd64.deb'.




make: *** No rule to make target 'KDEB'.  Stop.
:/usr/src/linux#

This was as close as i could get to the finish this time. :sniff

Dug up the bash history, would you please tell me what i did wrong?

Code:

:~# cd /usr/src
:~# tar xf linux-4.2.tar.xz
:~# ln -s linux-4.2 linux
:~# cd linux
:~# cp /boot/config-3.16.0-4-amd64 .config
:~# make silentoldconfig
:~# make menuconfig
:~# make clean
:~# make deb-pkg LOCALVERSION=-3.16.0-4-amd64 KDEB PKGVERSION=1


m_yates 09-04-2015 12:53 PM

You have a typo. You wrote:
Code:

make deb-pkg LOCALVERSION=-3.16.0-4-amd64 KDEB PKGVERSION=1
It should be:
Code:

make deb-pkg LOCALVERSION=-3.16.0-4-amd64 KDEB_PKGVERSION=1

mzsade 09-04-2015 01:34 PM

Darn me and my myopia, you have already taught me to purge as below:
Code:

su
rm -rf /lib/modules/4.2.0
rm -f /boot/vmlinuz-4.2.0*
rm -f /boot/initrd.img-4.2.0*
rm -f /boot/config-4.2.0*
rm -f /boot/System.map-4.2.0*
update-grub

There was a reference to "stale .o files' in the README. Does this cover that before i try again?

m_yates 09-04-2015 03:44 PM

I think you are fine in regards to stale .o files as long as you run "make clean" first before compiling.

mzsade 09-05-2015 08:48 AM

Success at last. yu de man!
Code:

dpkg-deb: building package `linux-firmware-image-4.2.0-3.16.0-4-amd64' in `../linux-firmware-image-4.2.0-3.16.0-4-amd64_1_amd64.deb'.
dpkg-deb: building package `linux-headers-4.2.0-3.16.0-4-amd64' in `../linux-headers-4.2.0-3.16.0-4-amd64_1_amd64.deb'.
dpkg-deb: building package `linux-libc-dev' in `../linux-libc-dev_1_amd64.deb'.
dpkg-deb: building package `linux-image-4.2.0-3.16.0-4-amd64' in `../linux-image-4.2.0-3.16.0-4-amd64_1_amd64.deb'.
dpkg-deb: building package `linux-image-4.2.0-3.16.0-4-amd64-dbg' in `../linux-image-4.2.0-3.16.0-4-amd64-dbg_1_amd64.deb'.
root@Sinai:/usr/src/linux#

Along with this;
Code:

dpkg -i linux-image-4.2.0-3.16.0-4-amd64_1_amd64.deb
dpkg -i linux-headers-4.2.0-3.16.0-4-amd64_1_amd64.deb

do you advise
Code:

dpkg -i linux-firmware-image-4.2.0-3.16.0-4-amd64_1_amd64.deb
dpkg -i linux-image-4.2.0-3.16.0-4-amd64-dbg_1_amd64.deb

?

Whether i am able to boot in the new kernel or not will be related to compatibility of my H/W with the combination of the distribution and the new kernel and i will pursue that elsewhere. I have only just begun to appreciate the thought and care put in, the in-depth understanding of the Linux kernel and the upgrade process involved, and the many years of Linux experience behind it, compressed into every step you have outlined in this tutorial and i am truly grateful for it.

mzsade 09-07-2015 06:13 AM

Ran
Code:

dpkg -i linux-image-4.2.0-3.16.0-4-amd64_1_amd64.deb
and it returned an error in locating archive. Felt like i was punched hard in my stomach. Then collected myself and ran
Code:

dpkg -i /usr/src/linux-image-4.2.0-3.16.0-4-amd64_1_amd64.deb
dpkg -i /usr/src/linux-headers-4.2.0-3.16.0-4-amd64_1_amd64.deb

Yaba-daba-doo! :D
Code:

sade@Sinai:~$ uname -r
4.2.0-3.16.0-4-amd64


silvanus-deb 11-21-2015 07:25 AM

Because I am on the "testing" release (64 bit), the upgraded kernels (both 4.1 and 4.2) have been installed through regularly running "apt-get dist-upgrade".

However, the system won't boot using 4.1 or 4.2. In order to successfully boot to the login screen, I have to select 4.0.0-2-amd64 in GRUB. When I try using 4.1 or 4.2, the last boot message I get is the result of fsck (clean). Shortly later the screen flickers and the message font changes (as in normal boot-up), so presumably the video driver has loaded successfully (???) but the system freezes at this point. I installed the realtek firmware, in case that was causing the problem, but it didn't help.

For what it's worth, I'm on a Dell Inspiron Mini 1012. Is there something in the latest kernels that won't cooperate with my old hardware?

I'm a non-technical user, but can type terminal commands and edit settings files like a trained seal if given specific instructions

m_yates 11-21-2015 11:40 PM

Silvanus-deb: You will probably get more help by creating a new thread. You should also clarify what kernel version works, since 4.2 is the default in Testing and you say it won't boot. You were apparently able to boot some kernel and install firmware. If all you care about is having it working, you can always just boot into the one that works, uninstall the others, and pin the kernel version in apt so it won't be upgraded again.

m_yates 11-25-2015 01:04 PM

If anyone follows this guide for compiling the 4.3 kernel from the sources from kernel.org, it will fail with the error:
Code:

openssl/opensslv.h: No such file or directory
You can fix that by installing libssl-dev:
Code:

apt-get install libssl-dev
After that do:
Code:

make clean
Then re-start the compilation and it will proceed as normal. I was going to put this in the original post, but it looks like I can no longer edit it.

mzsade 02-20-2016 01:33 AM

@m_yates, i cannot thank you enough for this awesome compile guide, learn something new each time i use it. This time i compiled the kernel on LMDE 2 using it's /boot/config and
<make localyesconfig> instead of <make oldconfig> and the results seem to have worked out very well for me. For one thing, the whole build took just a little over an hour as compared to the usual 4-5 hours, the linux-image and linux-headers were only 7 MB each and my system hasn't frozen on me once since then. What are your recommendations in this respect? I mean, is there a downside to this?

My laptop screen. :D

m_yates 02-20-2016 09:09 PM

Glad it has been of use. I've never actually tried using the localyesconfig target. As I understand it, localyesconfig takes all loaded modules from your running kernel and compiles them into a monolithic kernel without modules. There is also a localmodconfig option that is similar, except it selects all of your currently loaded modules from your running kernel and selects only those modules to compile for the new kernel.

The localmodconfig and localyesconfig targets will eliminate all modules that you aren't currently using, so it will be fast to compile and also make the kernel smaller. It is actually pretty clever to automate it, because a lot of people want to eliminate unused modules and options. Eliminating all the unused modules manually using menuconfig is time consuming and prone to error. If you do it manually and mistakenly delete something you need, the kernel won't work.

There are only a couple of problems with localyesconfig that I see:

1) The kernel you compile will only work on the computer that you compiled it on (or another computer that has exactly the same hardware).

2) If you add new hardware to your computer (such as an expansion card or peripheral), it won't work without compiling a module for it, or compiling a new kernel that has the required module for the new hardware built into it.

When you follow what I did, there are tons of modules compiled that you don't need. That is why the compile time is long and the size is huge. On the plus side, you take the resulting deb files that you compiled the way I did and install them on most any computer and it will work. What you did is make the kernel about as slim and lean as it can be.

mzsade 02-21-2016 02:51 AM

Thanks for the clarification, you are right about the peripherals, didn't think to check it before but now after you mentioned it i see that my flash drives are not being detected. But the localyesconfig/localmodconfig options are too attractive to pass up as i intend to compile the kernel only for the machine i am currently running it on, will try it once more with a couple of them plugged in while compiling. If i have understood the whole thing correctly that ought to work..

Edit: Oh yes, it works and how! Except for the odd SanDisk all my pen drives are Transcend so i plugged in a Transcend before compiling but now i can see every pen drive i plug in, in xfe file manager. :D

Xeratul 06-14-2016 02:03 PM

Quote:

Originally Posted by mzsade (Post 5414186)
Thank you for the guide, @m_yates. In my peculiar case both the kernels that came with the distribution, 4.1 and 4.1-rt, failed to boot but i somehow bungled my way into successfully upgrading to kernel 4.2 without recourse to the old config.
Don't wish to clutter the thread by rambling on about it so i'll just post a link to my screenshot. :D


Your method is quite long and might be much simpler.

You mention that you just need to grab the .config to make it work, but there is visibly much more than that to make a working kernel like you can find already compiled on the repositories !

best regards

rannyjohns 11-19-2018 03:34 AM

Nice to have it
 
Keep solving problems of he people.


All times are GMT -5. The time now is 06:30 AM.