131
  • Kubuntu 20.04, 64 bit
  • GPU: Geforce GT610
  • nvidia-driver-390
  • Chrome Version 85.0.4183.83
  • Intel i5-4430, core 4, 4 thread , 3GHz
  • RAM: 16GB

Each time I go into suspend mode and then resume, Chrome browser displays the current tab as full of sand of colors, something like dithering in image processing.

screenshot

Other tabs display glitches too.

The current solution is to close and reopen the browser.

I tested nvidia-driver-418 but got a black screen problem and reinstalled nvidia-driver-390.

The problem is more evident in Chrome, but it sometimes appears in vscode in small areas. There, hovering the mouse over the affected place or resizing the window fixes the problem. In Kubuntu the avatar of the user in the application launcher also shows dithered.

screenshot

I tested in the same machine with fedora 32 workstation(gnome), nvidia driver, and had the same problems with Chrome browser.

ubuntu-drivers output

Could it be a GPU problem?

vvvvv
  • 608
christianbueno.1
  • 1,824
  • 2
  • 13
  • 20
  • Could you see if the solution from https://askubuntu.com/q/1270689 helps? – EraserPencil Sep 08 '20 at 00:31
  • 4
    Me too, I created a bookmark for chrome://restart so can click it whenever the machine wakes up. Had a new version of Chrome today but it still doing it. I am plain old 20.04 Ubuntu runing on a Dell XPS 17 2020 – ssherlock Sep 09 '20 at 16:21
  • Same issue on Ubuntu 20.04.01 on ThinkPad W530. The answer below solved it! – dharmatech Sep 12 '20 at 03:17
  • 1
    This has come in with a recent update, as I had no issues before. I am also seeing issues with kdiff3. Not noticed any issues with VSCode myself, but maybe they are too subtle from me to of noticed yet.

    Running a Dell XPS 15 with 20.04.

    – SimonAlfie Sep 17 '20 at 07:32
  • 1
    I just wanted to add that the reason that VSCode experiences issues is because it runs on ElectronJS which further runs on Chromium. As far as I know, FireFox does not experience these problems. Thus, it's an underlying problem in Chromium. I've only had success solving the problem by disabling hardware acceleration although this is not ideal. I think the best course of action is to wait for the problem to be patched at Chromium. – Matthew Miller Sep 25 '20 at 16:44
  • Happens on 19.10 as well. Chrome version: 85.0.4183.121 (Official Build) (64-bit). It started happening after upgrading chrome. – AlikElzin-kilaka Sep 25 '20 at 18:11
  • Related: https://askubuntu.com/questions/1270689/chrome-causing-weird-flickering-since-upgrade-to-85-0-4183-83 – AlikElzin-kilaka Sep 25 '20 at 18:24
  • 2
    I just upgraded from 20.04 to 20.10 and this issue began. Very annoying as I use the suspend and restore from suspend throughout the day. I have no idea what NVIDIA driver I had before the upgrade, but now it brought me up to Nvidia-driver-450. I manually upgraded to Nvidia-driver-455 hoping that would resolve the issue but no such luck. I'll try adding the Chrome flag. Probably should have stuck with the LTS release! – Daniel Rosehill Oct 21 '20 at 10:20
  • There is no problem in fedora 33 with Nouveau NVD9 open source drivers, it would be very important to test if the problem persist with nouveau in ubuntu. – christianbueno.1 Nov 03 '20 at 19:15
  • It seems so many people like me have the same problem. At the moment, the best solution is chrome://restart/ – kelalaka Nov 05 '20 at 15:14
  • The issue is fixed for me on nvidia-driver-455 and Chrome Version 87.0.4280.66 (Official Build) (64-bit) – Jared Chu Nov 23 '20 at 10:30
  • There is a similar issue in Chrome's bug tracker: https://bugs.chromium.org/p/chromium/issues/detail?id=1134981 – trusktr Mar 27 '21 at 19:28

12 Answers12

82

Same problem for me.

Enabling enable-vulkan in chrome://flags then restarting the browser fixed it. If that does not work, you can also try enabling ignore-gpu-blacklist as well.

Answer based on this old askubuntu answer

Mike
  • 693
Gurgeh
  • 937
  • 1
  • 5
  • 2
  • 2
    Works perfectly! Thank you!!! – dharmatech Sep 12 '20 at 03:17
  • 10
    This slows down dramatically chrome with 10+ open tabs... – Dark Templar Sep 15 '20 at 08:41
  • 7
    No need to enable ignore-gpu-blacklist. Just enabling Vulkan fixes the issue for me, although chrome does get slow down, especially when multiple windows are open :( – xx77aBs Sep 16 '20 at 08:31
  • 3
    Just enabling Vulkan fixed it for me. – Camilo Rada Sep 17 '20 at 13:51
  • 8
    It fixed the issue. but make chrome really slow when watching youtube. – Terminal User Sep 20 '20 at 08:50
  • 1
    Thanks a lot! It fixed the issue for me. My specs: Ubuntu 20.04, Ryzen 7, RTX 2060. – Jared Chu Oct 01 '20 at 16:07
  • Fixes the rendering issue, but now the CPU cooler goes full speed all the tiime. – Passiday Oct 06 '20 at 07:56
  • Fixed the issue for me but not sure about performance. Will edit comment later when I have a large amount of tabs open. – Daniel Rosehill Oct 21 '20 at 10:23
  • I had the same issue on my new machine with Ubuntu 20.10 and Chrome "86.0.4240.111 (Official Build) (64-bit)", but this still fixed it! – Rob Cranfill Oct 25 '20 at 22:21
  • 1
    Works. Ubuntu 20.04, Nvidia Vulkan β drivers, google-chrome-β. Hole feeling that it start work even faster! At lease is shows 42 fps now, vs 25 fps before on this page: https://www.shadertoy.com/view/ldB3Dt – Andrew Oct 27 '20 at 11:24
  • Enabling Vulkan made my Google Maps crawl like a snail. – Redu Nov 01 '20 at 07:17
  • Worked for me too! Ubuntu 20.04 with nVIDIA 480 (proprietary, tested) on a Dell laptop with nVIDIA GTX 1050 Ti Mobile had issue with Google Chrome. If I would take a tab and drag it to be a separate window, that window would be drawn with additive over everything and pretty much be either all white after few seconds. Enabling Vulkan extension fixed it! Thanks mate! – Siniša Oct 22 '21 at 05:16
  • this chrome bug also bothered my for a while and the enable-vulkan setting fixed it! I use Chrome on Xubuntu (20.04 upgraded to 22.04, NVIDIA 2060+Ryzen 4800H) everyday and did not have this issue until Fall 2023 after google-chrome-stable upgraded from 115 to 116 - I reported the issue to Chrome and tested every new release, but nothing changes. I had to revert to v115 to avoid such problem. My new laptop with Intel CPU+NVIDIA 4070 did not have this issue (same xubuntu 22.04). – FangQ Jan 03 '24 at 23:05
  • works on ubuntu 22 chrome 120.0.6099.199 as well – Geremy Jan 10 '24 at 03:00
60

I'm having more or less the same issue, on:

  • Ubuntu 18.04, 64 bit
  • GPU: GeForce GTX 1070
  • Driver: 440.100
  • Chrome Version: 86.0.4240.75 (Official Build) (64-bit)

I don't want to have to deactivate GPU usage for Chrome, and I don't want to have to restart the browser every time, losing all my tabs.

But I found a workaround that is good enough for me (at least for now):

You can kill just the browser's GPU process

  • Open the Task Manager:

    • Hit Shift+Esc (as pointed out by @NYCeyes in the comments).
    • Or alternatively, go to the Chrome main menu (3 dots on the top right corner) → More ToolsTask Manager.
  • Sort by process Task name.

  • Find the process called GPU Process.

  • Click on End process.

Chrome Task Manager - GPU Process - End process

That will "clean" all the glitchy image noise. And Chrome will immediately create a new GPU process automatically.

Note: You can automatize the process, check Andrew Bruce's answer putting these steps in a script that runs automatically.

I assume the problem is something like the GPU process using memory assuming it has the old state as before the sleep cycle, but it just has some default random noise from the default state. So I imagine Ubuntu doesn't save and restore GPU memory on a sleep cycle (I don't think it should) but the Chrome process doesn't detect that. And by killing the process it "frees" that GPU memory and then Chrome creates a new process that re-generates any needed GPU memory state (that's instant).

tiangolo
  • 856
  • 7
  • 6
  • 17
    \o/ This is an excellent answer and works without making performance compromises. I will note though, that because Chrome's hamburger menu may be obfuscated by the glitchy pixelation, simply pressing <Shift> + <Escape> will get you to Chrome's (and Chromium's) Task Manager directly, where you can then kill the GPU process that you mentioned. – NYCeyes Oct 17 '20 at 03:49
  • 5
    This is the best answer so far. – Ryan Hartman Oct 27 '20 at 13:39
  • 2
    This is also exactly why linux is currently not really suitable as a daily driver. I have this issue every time and it's soo annoying. Still, linux/unix is 100x better than windows when developing so I guess I'm stuck with this mess. – Elias Nov 02 '20 at 18:36
  • 2
    Thanks pal, very useful solution. think that the problem is with NVIDIA drivers and the kernel in Linux, because in fedora 33 with open source drivers nouveau there is no problems about it, but after install NVIDIA proprietary drivers from rpmfusion in fedora 33 the problems begin to appears. – christianbueno.1 Nov 04 '20 at 19:15
  • 1
    And the problems appears in vscode too, in kubuntu it affects to the user avatar. – christianbueno.1 Nov 04 '20 at 19:20
  • 1
    This answer, combined with Andrew Bruce's answer, is the best option to use Chromium-based browsers with hardware acceleration until the problem gets resolved. – BeastOfCaerbannog Nov 05 '20 at 09:41
  • This works, but has its own side effects. After a few rounds of suspend-restart-suspend-restart, Chrome detects the successive failures and reverts back to software emulation. Everything will work and the GPU process will even show up under Chrome Task Manager, but if you investigate with chrome://gpu/ you'll see that you're running in software emulation, which uses your CPU instead of GPU. Unfortunately the only real clean solution I found so far is to restart Chrome entirely (which is a pain). – Gui Ambros Nov 14 '20 at 17:51
  • Similar issue in Chrome's bug tracker: https://bugs.chromium.org/p/chromium/issues/detail?id=1134981 – trusktr Mar 27 '21 at 19:28
27

Using tiangolo's answer, you can automate the restart of the Chrome GPU process on wake. As root, I put this script in /lib/systemd/system-sleep/revive-chrome-gpu:

#!/bin/sh

set -e

if [ "$2" = "suspend" ] || [ "$2" = "hybrid-sleep" ] then case "$1" in pre) true ;; post) sleep 1 pkill -f 'chrome --type=gpu-process' ;; esac fi

Be sure to make the script executable with:

chmod +x /lib/systemd/system-sleep/revive-chrome-gpu
Andrew Bruce
  • 371
  • 2
  • 2
  • 3
    This works and is a handy addition to tiangolo's answer. Note that if you use another Chromium-based browser, for example Brave, you should properly change the pkill command. In Brave's case it would become pkill -f 'brave --type=gpu-process'. – BeastOfCaerbannog Nov 03 '20 at 17:58
  • Nice! I used it and it works perfectly. I just added a note to my original answer pointing to this answer. – tiangolo Nov 05 '20 at 12:12
  • 2
    Thanks a lot for this answer! Solves the problem also for Electron-based apps, e.g. my file now has 3 pkill commands like this:
    pkill -f 'chrome \-\-type=gpu-process'; pkill -f 'keycombiner \-\-type=gpu-process'; pkill -f 'spotify \-\-type=gpu-process'
    
    – Thomas Kainrad Nov 22 '20 at 19:02
  • You're welcome. You could get fancy and use a regexp instead of the three kills. An exercise for the reader! – Andrew Bruce Nov 23 '20 at 21:55
  • 1
    For me, I find that just a pkill -f type=gpu-process will work for Chrome and other Electron-based apps all in one go. That being said, I have switched Chrome to using Vulkan too. – Chris Watts Nov 27 '20 at 11:58
  • I found that this solution doesn't work nicely with xterm.js (VS Code terminal as well as Hyper terminal). It winds up causing most of the terminal to go blank. I wound up having to resize VS Code (Ctrl + then Ctrl - to solve my problems). With Hyper I have to restart completely. – Brandon Dec 12 '20 at 04:14
  • Yeah I still end up restarting my browser, because although the image is restored and usable, the scrolling etc. is severely degraded after the GPU process has been killed. Perhaps the processes using the old GPU process are kicked down to CPU? – Andrew Bruce Dec 14 '20 at 11:24
  • I had to use this plus https://askubuntu.com/a/1274056/384952 in my previous setup (Ubuntu 22.04 and using the Nouveau drivers for my RTX 3050). After upgrading to 23.10, I was able to use the proprietary Nvidia drivers (version 535) and this script was no longer needed, only enabling Vulkan as the other answer suggested. – Rafael Eyng Dec 30 '23 at 23:38
15

I have the same issues on Arch, and although enabling Vulkan does fix the glitches when resuming from sleep or hibernation, it also impacts performance a lot. Based on this bug report and this answer I've tried starting Chrome with the following flags: --use-cmd-decoder=validating --use-gl=desktop and this seems to fix my issue without any performance penalties.

I'm not sure if this applies to all distros, but on Arch you can put these arguments into ~/.config/chrome-flags.conf and then they will be used every time Chrome is started (or ~/.config/chromium-flags.conf if using Chromium):

~/.config/chrome-flags.conf
--use-cmd-decoder=validating --use-gl=desktop
xx77aBs
  • 251
  • 1
  • 3
  • 2
    This is an Arch-specific extension, and is not currently available in other Linux variants (that I know of). – Diego Rivera Sep 17 '20 at 14:59
  • Thanks pal, disabling hardware acceleration reduce the performance. That's flags works better. You can run chrome by terminal google-chrome-stable --use-cmd-decoder=validating --use-gl=desktop &, using & avoid blocking the terminal. – christianbueno.1 Sep 19 '20 at 01:18
  • 5
    Upvoted. Starting chrome with google-chrome --use-gl=desktop solved the issue. Saw it here as well: https://askubuntu.com/a/1270843/13330 – AlikElzin-kilaka Sep 25 '20 at 18:24
7

1st Solution (performance issues)

In my case a solution for the Chrome browser is disable in Settings: Use hardware acceleration when available.

chrome://settings/system

enter image description here

2nd Solution

Yes, the above solution comes with performance issues. If you don't like that, you can test this other option, Chrome will run flawlessly.

Run Chrome with some flags, run always Chrome by terminal.

google-chrome-stable --use-cmd-decoder=validating --use-gl=desktop &

The & avoid blocking the terminal.

christianbueno.1
  • 1,824
  • 2
  • 13
  • 20
5

I followed xx77aBs's solution but, since I'm using Chromium under Ubuntu, I added these options in /etc/chromium-browser/customizations, as mentioned here. I added a file named nvidia-fix under that directory with the following content:

CHROMIUM_FLAGS="${CHROMIUM_FLAGS} --use-cmd-decoder=validating --use-gl=desktop"
tetebueno
  • 163
  • 5
4

I had a very similar issue on my Arch system with both Chrome and Chromium where I had to restart it ever time after sleep (VS code and Steam also had minor artifact but simply switching tabs fixed it there)

Simply enabling Vulkan in chrome://flags seems to have finally resolved it.

I also wanted to mention that I did not suffer from this issue up until several weeks ago I am on nVidia 1060 with 450.66 driver

Artem
  • 41
3

xx77aBs's can be adapted for Chrome, not Chromium, on Ubuntu using this answer.

cp /usr/share/applications/google-chrome.desktop ~ # or wherever you want to keep that desktop launch file
sed -i 's/google-chrome-stable /google-chrome-stable --use-cmd-decoder=validating --use-gl=desktop /' ~/google-chrome.desktop
chmod +x ~/google-chrome.desktop

Then use that newly created and modified .desktop file to launch Chrome.

Christian Fritz
  • 363
  • 3
  • 15
2

For my setup (Ubuntu 20.04, Thinkpad P53) flag --use-gl=desktop was enough to avoid Chromium problems after resume. I didn't notice a visible slowdown of my machine.

I added the file ~/.chromium-browser.init with contents: CHROMIUM_FLAGS="--use-gl=desktop".

Danijel
  • 431
  • This seems to be the simplest solution and it works fine on my system for Chromium! (Also an Ubuntu 20.04 system with Intel i5, Nvidia GeForce graphics, recommended Nvidia driver.) However I do also use Chrome (the Google version), does anyone know how to apply this fix for Chrome? I tried ".chrome-browser.init" and "CHROME_FLAGS" but that does not work. – w-sky Feb 24 '22 at 09:43
2

Try this script (works for Ubuntu 20.04), then reboot

#!/bin/bash

Followed by this tutorial: https://download.nvidia.com/XFree86/Linux-x86_64/450.57/README/powermanagement.html

NVIDIA_DRIVER_VERSION=$(head -1 /proc/driver/nvidia/version | sed "s/.Kernel Module ([0-9]). .*/\1/g") NVIDIA_DIR=/usr/share/doc/nvidia-driver-${NVIDIA_DRIVER_VERSION}

if [[ ! -d ${NVIDIA_DIR} ]]; then echo ${NVIDIA_DIR} does not exist. Skipping. exit 0 fi

Installing

sudo install ${NVIDIA_DIR}/nvidia-suspend.service /etc/systemd/system sudo install ${NVIDIA_DIR}/nvidia-hibernate.service /etc/systemd/system sudo install ${NVIDIA_DIR}/nvidia-resume.service /etc/systemd/system sudo install ${NVIDIA_DIR}/nvidia /lib/systemd/system-sleep sudo install ${NVIDIA_DIR}/nvidia-sleep.sh /usr/bin

Enabling nvidia systemd

sudo systemctl enable nvidia-suspend.service sudo systemctl enable nvidia-hibernate.service sudo systemctl enable nvidia-resume.service

UPD1: for ones, who don't know how to make it as a script

  1. create file: install_nvidia_powermanagement.sh
  2. copy paste the content into install_nvidia_powermanagement.sh
  3. make it a executable: chmod +x install_nvidia_powermanagement.sh
  4. run it: ./install_nvidia_powermanagement.sh
RedEyed
  • 1,443
1

My problems with chrome after resume were reproducible by switching to vty and back to X or after sleep, lock etc. I finally ran with the --disable-extensions flag from the command line and the problem went away.

The issue was pretty strange. It would jumble contents from different tabs or block out portions of pages with large black block or leftover content from a previous tab. Scrolling caused issues too or popover etc.

Via trial and error I narrowed in on ....

Microsoft Office Extension

It apparently messes with the browsers use of gl. It was spitting out these errors when started from a console and triggering the bug. Disabling or removind the extension fixed it.

ERROR:angle_platform_impl.cc(43)] ClearErrors(2057): Preexisting GL error 0x00000506 as of ../../third_party/angle/src/libANGLE/renderer/gl/TextureGL.cpp, setImageHelper:256.

86.0.4240.75 Linux 5.4.0-48-generic nvidia 450 and libnvidia-gl-450.

Bug shown here

0

I was having the same problem. Here is the solution that I used.

Step 1: Copy the python code and make it into an executable file and place it on your home folder

#!/usr/bin/python3
import os,signal
import time
a=1
while (a==1):
    try:   
        #iterating through each instance of the proess 
        process=os.popen('ps aux | grep "brave.com/brave/brave --type=gpu-process" | 
        grep -v grep')
        str=(process.read())
        length=0
        length=len(str)
        if (length==0):
            print("Process Teminated..")
            a=2
        else:
            for line in os.popen('ps aux | grep "brave.com/brave/brave --type=gpu-process" | grep -v grep'):  
                fields = line.split() 
                #extracting Process ID from the output 
                pid = int(fields[1])  
                res=fields[3]
                res=float(res)/100*7.69*1024 #7.69 is the amount of ram i have.... yours might vary.
                # terminating process  
                if(res>100):
                    print(f"pid={pid} res={res}")
                    os.kill(int(pid), signal.SIGKILL)  
                    print("Process Successfully terminated") 
                time.sleep(6)
                length=0
except: 
    print(&quot;Error Encountered while running script&quot;) 
    time.sleep(10)

Step 2: Create a shell script to launch both the applications at the same time

cd /usr/bin/;brave-browser-stable & brave=$!
sleep 2
cd /home/<your-username-here>/;./kill-gpu-brave & kill=$! #I named my  python execulable file kill-gpu-brave
wait $brave
wait $kill

Step 3: Make this an executable file with chmod +x <filename> and launch brave through this file.

  • For chrome the command will change. Please check your task manager. It will come under "--type=gpu-process" – Kishalay Jan 24 '21 at 19:59