Ubuntu – Ubuntu 20.04 Graphics freezes for 1-2 seconds every 5 seconds

20.04intel graphicsmesa

Since I recently installed Ubuntu 20.04 on my laptop, a few days after a reboot the graphics starts to freeze for about 1.5 seconds every 5 seconds. It goes away immediately after a reboot, but I have not yet noticed a pattern for what causes it to return a few days later.

I would be grateful if someone could point me at ways to get closer to diagnosing the problem, even if they don't have a solution.

It seems to be purely graphics-related (and not CPU, network or swap-related), because it even affects a lone system monitor process as can be seen in this screencast of the system monitor plots sticking every 5 seconds, where you can also see how idle the CPU and network are and how much free memory and swap there is (the CPU hike is the recording process for the 30s duration of the screencast).

It even affects a gnome-terminal session scrolling output from sudo find /, as shown in this screencast (it normally scrolls smoothly).

However, it does not affect the mouse pointer, which continues to respond normally while the rest of the graphics is stuck. And audio continues uninterrupted.

It makes interactive video or video playback (whether from disk or from network) unusable, as this screencast shows. Note that the graphics jumps rather than fast-forwards once it unsticks.

Next time it occurs, I will report any clues found from dmesg.

System details: Lenovo Yoga Pro 3 laptop, Mesa IntelĀ® HD Graphics 5300 (Intel BDW GT2 chipset)
Ubuntu 20.04 over Linux 5.4.0-40-generic amd64 architecture. Recent fresh install.

$ sudo lshw -c display
   description: VGA compatible controller
   product: HD Graphics 5300
   vendor: Intel Corporation
   physical id: 2
   bus info: pci@0000:00:02.0
   version: 09
   width: 64 bits
   clock: 33MHz
   capabilities: msi pm vga_controller bus_master cap_list rom
   configuration: driver=i915 latency=0
   resources: irq:64 memory:c0000000-c0ffffff memory:b0000000-bfffffff ioport:3000(size=64) memory:c0000-dffff

Top processes in CPU usage with no user-processes running except gnome-system-monitor:

~40%    gnome-shell
~20%    Xorg
~ 4%    gnome-system-monitor
<0.3%   <each other process>

Without system monitor (just top in a lone gnome-terminal):

~12%    gnome-shell
~ 5%    Xorg
<0.3%   <each other process>

I've found several other similar reports. For instance this one is with Ubuntu 18.04 and Intel HD graphics (gives few details and no solution) or this with 16.04 (but dual gpu) or this with 20.04 (but nVidia and not solved by reboot) or this with Radeon (but mouse froze – and solved at BIOS level by setting graphics to Discrete, which I don't have).

Numerous posts from 2015 era such as this are resolved by adding an acpi_rev_override=1 argument to splash in /etc/default/grub. However, unlike my case, the mouse pointer freezes and they all relate to nVidia.

Best Answer


Problem may be caused by the top bar. I solved the issue by installing gnome-tweaks.

$ sudo apt install gnome-tweaks

I was experiencing your problem until a few minutes ago. My experience was visually identical to your recorded screencasts - my computer regularly became unresponsive except for the mouse cursor.

I managed to entirely solve the problem by installing gnome-tweaks. I didn't even have to open the application.

I was unsure at first why this solved the problem, so I investigated further. Turns out that I can recreate the freezing problem by opening the gnome-tweaks app, navigating to "Top Bar", and then enabling Seconds under Clock. The issue is similar to experiences in this thread, where the top bar may freeze the OS when it updates.

I have a feeling my solution may not fix your issue, unfortunately. Your screencasts show a top bar clock without seconds already. However, I do notice that your top bar does include Skype in all of your recorded screencasts. The next time that you experience the problem, I would exit Skype to see if it's the cause of the issue.

Hopefully this helps.