How Smooth is Upgrading Linux kernel in Debian 8.5?

10,102

Solution 1

The easiest way to install a newer kernel is to use Jessie backports.

First you need to add Jessie backports to your repositories, if it's not already there:

echo deb http://http.debian.net/debian jessie-backports main > /etc/apt/sources.list.d/jessie-backports.list

(as root), then

apt-get update
apt-get -t jessie-backports install linux-image-amd64

will install the current default backported kernel (4.8 as of this writing).

To provide the appropriate firmware for your laptop's wi-fi, you need to add non-free and install firmware-iwlwifi:

echo deb http://http.debian.net/debian jessie-backports main contrib non-free > /etc/apt/sources.list.d/jessie-backports.list
apt-get update
apt-get -t jessie-backports install firmware-iwlwifi

To solve the display problems, you can remove xserver-xorg-video-intel (nowadays Intel GPUs don't need a separate driver, they can use the kernel's mode-setting support), as suggested by GAD3R:

apt-get remove xserver-xorg-video-intel

(You may need to install xserver-xorg-video-dummy to satisfy other packages' dependencies.)

You should also install the Skylake firmware to enable all the GPU features:

apt-get -t jessie-backports install firmware-misc-nonfree

Enabling backports is safe: newer packages are not picked up automatically from backports, you need to explicitly select them using -t jessie-backports as above (but once you've done that, updates to the upgraded packages are picked up by apt-get upgrade).

Version 4.6 of the kernel already provided good support for Skylake, and it's improved since. If you upgrade as above, running apt-get upgrade will automatically upgrade to later versions of the kernel once they become available in the backports.

Solution 2

You can compile the latest stable kernel version 4.7.2 from the official website , following the steps described here

  1. su
  2. apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc
  3. apt-get install kernel-package
  4. cd /tmp/
  5. wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.7.2.tar.xz
  6. unxz linux-4.7.2.tar.xz

    tar xvf linux-4.7.tar

  7. cd linux-4.7
  8. cp /boot/config-$(uname -r) .config
  9. make menuconfig
  10. make-kpkg clean
  11. fakeroot make-kpkg --initrd --revision=1.0.NAS kernel_image kernel_headers -j 16
  12. ls ../*.deb
  13. dpkg -i *.deb
  14. reboot

Solution 3

My OS is Debian Jessie with Mate desktop

root@s32408:~# uname -a
Linux s32408 4.8.0-0.bpo.2-amd64 #1 SMP Debian 4.8.15-2~bpo8+2 (2017-01-17) x86_64 GNU/Linux

After upgrading the kernel to 4.8 from backports to fix a WIFI issue, I encountered the display bug when rebooting the system. Then I removed the Intel driver as stated above and it fixed the bug.

But, doing so, many essential packages became "no longer required". I did not pay attention in the first place and did some cleaning afterwards:

apt-get autoremove

And after the next reboot, I lost my graphical desktop and many useful applications.


Then I reinstalled a brand new OS and I found that installing the updated Intel driver from backports (instead of removing it) also fixes the display bug but does not break dependencies. In other words I did :

apt-get -t jessie-backports install xserver-xorg-video-intel

instead of:

apt-get remove xserver-xorg-video-intel

You may prefer to remove the driver anyway and tamper with dependencies to overcome the breakage as suggested by StephenKitt in the comments. Up to you.

Note that XCFE desktop is also affected by this issue but Gnome desktop is not.

Thanks to Léo Léopold Hertz for the hint about Gnome and StephenKitt for his great patience ;)

Share:
10,102
Léo Léopold Hertz 준영
Author by

Léo Léopold Hertz 준영

Updated on September 18, 2022

Comments

  • Léo Léopold Hertz 준영
    Léo Léopold Hertz 준영 over 1 year

    I would like to upgrade my Linux kernel to 4.7 in Debian 8.5, since it has significant better Skylake 6th generation support than the current linux kernel. In Ubuntu 16.04, the upgrade is easy. However, I now need Debian 8.5 because of stability, and I would like to do the same upgrade for it.

    Testing StephenKitt's answer

    I upgrade the kernel and reboot, but I get unsuccessfully when loading the OS. Fig. 1 Failure messages in startup

    enter image description here

    2nd iteration - Solving the Bug in startup [GAD3R]

    1. Boot in Linux kernel 3.16.x
    2. Run as su, apt-get remove xserver-xorg-video-intel
    3. Reboot

    Output: works! Resolution is now the 1920x1080. Since there is no complete support of Skylake in Linux kernel 4.6 etc this artifact here in Matlab 2016a without a firmware, you need some non-free adjustments as firmware; which you maybe already free firmware in Linux kernel 4.7

    # https://unix.stackexchange.com/a/307435/16920
    apt-get -t jessie-backports install firmware-misc-nonfree
    

    xserver-xorg-video-intel abnormal installation and its action's prevention

    I find out that the package xserver-xorg-video-intel may get installed as a dependency (and all its dependencies) in other conditions, as described a case in the thread How to Recover Debian of LK backports where runlevel conflict? The idea is to prevent the action of the package although it get installed by creating the file /etc/X11/xorg.conf

    # https://unix.stackexchange.com/a/308709/16920
    Section "Device"
            Identifier "Intel"
            Driver "modesetting"
    EndSection
    
    ## Bugs 
    # 1. LK 3.16 will fail now but LK 4.6 will work. TODO in the thread https://unix.stackexchange.com/a/308709/16920
    

    Hardware: Asus Zenbook UX303UA
    OS: Debian 8.5
    Related: Asus Zenbook UX303UA Linux compatibility, Linux Kernel - Mobile Skylake 6th Generation - Power Management

    • GAD3R
      GAD3R over 7 years
      Boot the 3.16 kernel , remove xserver-xorg-video-intel then reboot into the 4.6 kernel
    • Léo Léopold Hertz 준영
      Léo Léopold Hertz 준영 over 7 years
      @GAD3R Works! When can I install back the package?
    • GAD3R
      GAD3R over 7 years
      You need to install the intel graphic card from backport
    • Stephen Kitt
      Stephen Kitt over 7 years
      Actually you don't, Intel GPUs no longer need a separate driver on Linux. See the last paragraph in the package description: "The use of this driver is discouraged if your hw is new enough (ca. 2007 and newer). You can try uninstalling this driver and let the server use it's builtin modesetting driver instead."
  • GAD3R
    GAD3R over 7 years
    @StephenKitt the needed driver is xserver-xorg-video-intel packages.debian.org/jessie-backports/xserver-xorg-video-inte‌​l
  • Stephen Kitt
    Stephen Kitt over 7 years
    @GAD3R read the last paragraph of the package description in the link you gave above ;-).
  • Léo Léopold Hertz 준영
    Léo Léopold Hertz 준영 over 7 years
    Please, see the thread about system failures with external displays when using this configuration unix.stackexchange.com/q/320993/16920 I am troubleshooting now.
  • Stephen Kitt
    Stephen Kitt over 7 years
    You could also install xserver-xorg-video-dummy to satisfy the dependencies instead.
  • Acerimmer
    Acerimmer over 7 years
    @Stephen Thanks, I tried this but it didn't work... Still got the display bug with it.
  • Stephen Kitt
    Stephen Kitt over 7 years
    I don't understand — you say "I removed the Intel driver and it worked", and "installing the updated Intel driver from backports would also fix the display bug"; what setup gives the display bug? Installing the dummy package only satisfies the dependencies, the X server won't use it.
  • Stephen Kitt
    Stephen Kitt over 7 years
    Installing dummy goes with removing the Intel driver; it fixes the dependency breakage, but you do need to do both.
  • Acerimmer
    Acerimmer over 7 years
    @StephenKitt My explanation wasn't accurate. If I remove the Intel driver, the dependencies get broken and there is no way back. Installing dummy doesn't fix them. And even if I install the Intel driver back, the dependencies remain broken... Then I have to reinstall the OS from scratch. There might be something obvious that I'm missing but like I said I'm a beginner ;)
  • Stephen Kitt
    Stephen Kitt over 7 years
    OK, that means that removing the Intel driver is removing other packages (simultaneously), and you'd need to restore these to fix things. (apt-get & co. would tell you what's going to happen before they actually remove the packages though.) If you install the dummy driver at the same time as you remove the Intel driver (or before), you won't run into this issue.
  • Acerimmer
    Acerimmer over 7 years
    @StephenKitt Yes apt-get remove xserver-xorg-video-intel warns me about the dependencies about to be broken in the first place. And I just realized that fixing the dependencies is just as simple as apt-get install X where X is everything that was marked as "no longer required". But maybe this method is not really clean ? I think I'll start from scratch again and test the dummy install before the driver removal. I'll let you know if I do so. Thank you.
  • Acerimmer
    Acerimmer over 7 years
    @StephenKitt OK so as stated above I reinstalled a fresh OS with Mate. This time I tried to install dummy before removing the Intel driver, but the result is the same. If I do, many mandatory packages will be marked as "no longer required"... Now I intend to try again with the Gnome desktop. I'll let you know if that changes anything.
  • Stephen Kitt
    Stephen Kitt over 7 years
    apt-get remove doesn't mark packages as "no longer required", it removes packages which depend on whatever it is you're removing (xserver-org-video-intel here). Those removals cause other packages to be "no longer required", but that comes after you've confirmed the actual removals. Could you paste the output of apt-get remove xserver-xorg-video-intel somewhere? (Cancel the removal afterwards...)
  • Acerimmer
    Acerimmer over 7 years
    @StephenKitt Understood, my wording was inadequate. me@s32408:~$ sudo apt-get remove xserver-xorg-video-intel Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: alsa-base dmz-cursor-theme dns-root-data dnsmasq-base enchant eom eom-common espeak-data ffmpegthumbnailer galculator geoclue-2.0 gimp gimp-data gir1.2-atk-1.0 gir1.2-atspi-2.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-gtk-2.0 gir1.2-gtk-3.0 gir1.2-mate-panel gir1.2-pango-1.0 ...
  • Acerimmer
    Acerimmer over 7 years
    @StephenKitt Btw I noticed that installing dummy indeed helps a bit by decreasing the enormous list of packages that would become "no longer required". For instance this concerns several xserver-xorg-* packages.
  • Stephen Kitt
    Stephen Kitt over 7 years
    Thanks for the info; the issue is that task-desktop depends on all the video drivers :-(. (The important information here isn't the "no longer required" stuff at the start, but "The following packages will be REMOVED" at the end.) To remove the Intel driver without breaking everything, you need to explicitly install lightdm, mate-desktop-environment, and xorg as well as the dummy driver.
  • Acerimmer
    Acerimmer over 7 years
    I've just tried with Gnome. When I remove the Intel driver, the list of "no longer required" packages is quite short and the list of "will be REMOVED" packages is the same as with Mate. After the first reboot the desktop still works fine (just like with Mate). Then if I issue apt-get autoremove and reboot, the desktop keeps on working fine unlike Mate. So indeed, my problem is Mate-related. Moreover it affects XCFE too (I tried).