2

I have a Lenovo G710 laptop that ran Ubuntu flawlessly since 15.04.

After updating to 20.04 there were occasional random complete freezes of the desktop. Having updated to 20.10, it now boots okay and the login screen appears normal. The desktop is fine until I try to open any application. The application name appears at the top, and then the desktop completely freezes. In some cases the app icon in the dock becomes pixelated. Sometimes a portion of the desktop flickers to solid black.

The mouse still moves occasionally, and I can CTRL+ALT+F3 to a command line.

Various searches suggest a graphics driver problem. It's an Intel Haswell graphics chip.

I've tried both the Ubuntuand Ubuntu on Wayland options at log in, both give the same results.

What is the best way to approach this?

EDIT:

Output of ls -al ~/.local/share/gnome-shell/extensions

drwxrwxr-x 4 carl carl 4096 Oct 26 18:29 gTile@vibou
drwxrwxr-x 3 carl carl 4096 Aug 13 18:55 systemMonitor@gnome-shell-extensions.gcampax.github.com
drwxrwxr-x 3 carl carl 4096 Oct 30 14:53 user-theme@gnome-shell-extensions.gcampax.github.com
drwxrwxr-x 2 carl carl 4096 Sep 10 18:11 weatherintheclock@JasonLG1979.github.io
drwxrwxr-x 3 carl carl 4096 Oct 30 14:53 workspace-indicator@gnome-shell-extensions.gcampax.github.com

Output of ls -al /usr/share/gnome-shell/extensions

drwxr-xr-x 2 root root 4096 Oct 30 13:53 desktop-icons@csoriano
drwxr-xr-x 3 root root 4096 Oct 30 13:53 ubuntu-appindicators@ubuntu.com
drwxr-xr-x 3 root root 4096 Oct 30 13:53 ubuntu-dock@ubuntu.com

Output of free -h

              total        used        free      shared  buff/cache   available
Mem:          5.7Gi       735Mi       4.2Gi        73Mi       855Mi       4.7Gi
Swap:         2.0Gi          0B       2.0Gi

Output of sysctl vm.swappiness

vm.swappiness = 60

EDIT 2 Output of dmesg includes i915 GPU HANG

13
  • 1
    You may have a GNOME Shell extension that doesn't work in 20.10. Edit your question and show me ls -al ~/.local/share/gnome-shell/extensions and ls -al /usr/share/gnome-shell/extensions and free -h and sysctl vm.swappiness. – heynnema Oct 30 '20 at 20:14
  • @heynnema I've done that. – Carl H Oct 31 '20 at 14:06
  • Go to extensions.gnome.org/local and temporarily disable the 5 gnome-shell extensions that you see in ~/.local/share/gnome-shell/extensions, and then restart gnome-shell or log out/in, and see if the problem is gone. Report back. – heynnema Oct 31 '20 at 14:15
  • @heynnema I removed the extensions via the command line as using any app just causes a crash. It seems to have made some difference, there's no freeze now, but apps don't open, and after a while the GNOME session restarts itself. – Carl H Oct 31 '20 at 15:29
  • Reboot your computer and retest. Edit your question and show me ls -al /var/crash. Do you have any startup applications enabled? Are you running with Wayland, or just stock Ubuntu? – heynnema Oct 31 '20 at 15:41
8

UPDATE : Linux kernel 5.11 includes the patch so the problem has been resolved. It seems that the problem will be resolved for Ubuntu 21.04 too which will be shipped with kernel 5.11 at least.

UPDATE 2 : It seems that Ubuntu 21.04 froze with kernel 5.10, if this is the case and the patch is not included then there are 2 choices,

  1. you upgrade from your current installation, reboot with one of your patched kernels and follow the patching procedure for the new kernels

  2. you boot from the 21.04 .iso image and in the boot menu you select "(Safe graphics)" to avoid loading the i915 driver, after the installation you first log in the terminal and you either manually install a patched kernel or recompile the patched i915 module for the new kernel and then reboot with the patched kernel so as to be able to use Gnome or any other graphical environment that crashes with the unpatched kernels.

Both choices can be also deployed with Ubuntu 20.10 .

UPDATE 3 : Though the patched Ubuntu distribution kernels seem to be stable with Gnome, the 5.11 kernels cause glitches in Gnome and even crash it from time to time. The problem seems to arise from the Mutter compositor both on X and Wayland, other graphic environments with different compositors seem to be stable.


The solution for kernels before 5.11 is here Red Hat Bugzilla – Bug 1843274

The GUI system can become usable if you boot with your old kernel 5.4.0 . The terminal is still usable with 5.8.0 kernel, try CTRL+ALT+F3.

The solution is to patch the i915 module. Download the patch from here

To understand the patch have a look at Intel's Manual page 50, it has to do with the command MEDIA_VFE_STATE which has to be provided with the right number of threads according to the model of the GPU.

First method: Patch and recompile a new kernel

Quick guide

  1. The basic dependencies to build the kernel are sudo apt install libncurses-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf
  2. Download the kernel source of your choice from www.kernel.org and extract it.
  3. Go inside the kernel source directory.
  4. Clean the kernel with sudo make mrproper in the kernel's directory.
  5. Download the patch into the kernel's source code parent directory.
  6. Apply the patch with patch -p1 < ../drm-i915-gt-Limit-VFE-threads-based-on-GT.patch
  7. Configure the kernel or run sudo make localmodconfig to finish quickly, hold the Enter key until all the questions are answered
  8. Compile the kernel with sudo make -j (# of CPU threads) bindeb-pkg
  9. Install the linux-image and the linux-headers deb packages produced in the parent directory of the kernel source directory
  10. Reboot and if necessary choose the new kernel from the GRUB menu

Optimize the above procedure according to your preferences, your hardware etc

Second method: Patch and recompile the module only

It is also possible to rebuild the patched module for an already installed kernel so as to be able to use the official distribution kernels or any other precompiled kernels.

The official i915 compilation guide from Intel is here, if you download it as a PDF go to page 41.

You can follow the steps exactly as they are presented but notice the following.

  1. If you are going to recompile the module for another kernel version than the one you are running then you have to replace $(uname -r) with the version you are targeting, for example 5.8.0-29-generic .

  2. If you use the /tmp/kernel directory as in the guide then this directory will be lost after a reboot.

  3. After step 5 you have to patch the kernel with patch -p1 < ../drm-i915-gt-Limit-VFE-threads-based-on-GT.patch assuming the patch is located into the kernel's source code parent directory

  4. Step 9 can be skipped.

  5. After step 12 you may get an error concerning the cryptographic verification of the module, there is no problem, the module has been installed in /lib/modules/5.8.0-29-generic/extradrivers and the system knows that it is there and should be loaded through step 13.

  6. Step 14 should be performed stating the target kernel version, for 5.8.0-29-generic alter the commands like this sudo depmod -v 5.8.0-29-generic and sudo update-initramfs -k 5.8.0-29-generic -u .

After a reboot your system will be usable again.

This procedure should be performed for any new kernel until the problem is solved by Ubuntu.

3

I migrated from Kubuntu 20.04 to 20.10 and have the same "GPU Hang" bug with an Acer 720p. While waiting fro a fix I downgraded the kernel from 5.8 to 5.4 and it's now working well.

1

This is an existing bug with the i915 driver in recent Linux kernels.

See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1872001 and https://gitlab.freedesktop.org/drm/intel/-/issues/673

As yet, there is no solution or workaround. I have replaced Ubuntu 20.10 with Ubuntu 18.04.

UPDATE - I've accepted the other answer as judging by the upvotes it is correct, which should be more useful to anyone else having this problem.
(Disclaimer - I haven't tried it myself)

0

This issue is caused due to a bug in the kernel. You can easily get this resolved, by booting Ubuntu in previous kernels wherein the terminal is usable. You can do this by reaching the grub menu, and selecting 'advanced options' and then selecting any of the previous kernel for booting in.

Once you boot in and terminal is open, type in the following commands to upgrade your kernel to latest version available (5.10.13 and above will solve this issue)

  1. This command installs the wget utility that will be used for downloading a kernel upgrader script:

    sudo apt install wget
    
  2. This command will pull the script from github and store it in your home directory

    wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh 
    
  3. This command will install the script in your bin directory, so that its easier to execute in the terminal with the following command:

    sudo install ubuntu-mainline-kernel.sh /usr/local/bin/
    
  4. Install the latest mainline kernel:

    sudo ubuntu-mainline-kernel.sh -i 
    

Alternatively, you can even install a particular kernel version:

sudo ubuntu-mainline-kernel.sh -i 5.10.13 

After executing this command, it will take a few minutes to install the kernel headers and images, post which you need to reboot your system

sudo reboot

After reboot, confirm the kernel version by executing the following command:

uname -r 

You should see an output similar to:

5.10.13-051013-generic

Done. Bug resolved!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.