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?

13
  • Could you see if the solution from askubuntu.com/q/1270689 helps? Sep 8, 2020 at 0: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 9, 2020 at 16:21
  • 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, 2020 at 7: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. Sep 25, 2020 at 16:44
  • 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! Oct 21, 2020 at 10:20

12 Answers 12

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

14
  • 2
    Works perfectly! Thank you!!!
    – dharmatech
    Sep 12, 2020 at 3:17
  • 10
    This slows down dramatically chrome with 10+ open tabs... Sep 15, 2020 at 8: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, 2020 at 8:31
  • 3
    Just enabling Vulkan fixed it for me. Sep 17, 2020 at 13:51
  • 8
    It fixed the issue. but make chrome really slow when watching youtube. Sep 20, 2020 at 8:50
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).

8
  • 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, 2020 at 3:49
  • 5
    This is the best answer so far. Oct 27, 2020 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 2, 2020 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. Nov 4, 2020 at 19:15
  • 1
    And the problems appears in vscode too, in kubuntu it affects to the user avatar. Nov 4, 2020 at 19:20
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
8
  • 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'. Nov 3, 2020 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 5, 2020 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: sh pkill -f 'chrome \-\-type=gpu-process'; pkill -f 'keycombiner \-\-type=gpu-process'; pkill -f 'spotify \-\-type=gpu-process' Nov 22, 2020 at 19:02
  • You're welcome. You could get fancy and use a regexp instead of the three kills. An exercise for the reader! Nov 23, 2020 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. Nov 27, 2020 at 11:58
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
3
  • 2
    This is an Arch-specific extension, and is not currently available in other Linux variants (that I know of). Sep 17, 2020 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. Sep 19, 2020 at 1:18
  • 5
    Upvoted. Starting chrome with google-chrome --use-gl=desktop solved the issue. Saw it here as well: askubuntu.com/a/1270843/13330 Sep 25, 2020 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.

5
  • 2
    This comes with huge performance penalty, especially when watching videos. If you're on laptop, your batter life will get shortened a lot.
    – xx77aBs
    Sep 16, 2020 at 8:36
  • Has anyone tested the second solution? Can you explain what exactly those flags are doing? Oct 5, 2020 at 18:27
  • The second solution worked for me .. Thanks :)
    – raz
    Oct 6, 2020 at 10:09
  • Disabling hardware acceleration worked for me. Oct 21, 2020 at 15:40
  • You can change the shortcut for Chrome to include these parameters, thus you don't need to run it from a terminal.
    – raj
    Nov 5, 2020 at 12:23
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"
0
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

2
  • this works for Brave on my Kubuntu 20.04 system, using brave://flags, thanks! Oct 8, 2020 at 23:46
  • Worked for met too: GTX 1060, driver 455
    – Youw
    Oct 23, 2020 at 8:02
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.

2
  • Thanks pal, now in the future when we don't need those flags, how can we revert that? Sep 25, 2020 at 16:39
  • 2
    You can just stop using the modified .desktop file and use the one installed by the package instead when that happens. Sep 25, 2020 at 16:41
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
7
  • Do we run with sudo?
    – kelalaka
    Nov 5, 2020 at 13:15
  • No, as you can see: sudo is inside the script
    – RedEyed
    Nov 5, 2020 at 13:27
  • Oh, then u have several drivers. IDK, just change the NVIDIA_DIR to the driver path u have installed
    – RedEyed
    Nov 5, 2020 at 13:32
  • Updated the script to get the right version
    – RedEyed
    Nov 5, 2020 at 13:45
  • 1
    Although I've upvoted, this not solved the issue. The best is chrome://restart/
    – kelalaka
    Nov 5, 2020 at 15:13
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".

1
  • 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, 2022 at 9:43
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("Error Encountered while running script") 
        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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .