109
  • 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?

Thanks in advance for any directions in how to fix the problem or information on what is causing it.

  • Could you see if the solution from askubuntu.com/q/1270689 helps? – EraserPencil Sep 8 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 – user3352133 Sep 9 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 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. – Matthew Miller Sep 25 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! – Daniel Rosehill Oct 21 at 10:20

11 Answers 11

46

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).

| improve this answer | |
  • 11
    \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 at 3:49
  • 4
    This is the best answer so far. – Ryan Hartman Oct 27 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 at 18:36
  • 1
    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 4 at 19:15
  • 1
    And the problems appears in vscode too, in kubuntu it affects to the user avatar. – christianbueno.1 Nov 4 at 19:20
66

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

| improve this answer | |
  • 1
    Works perfectly! Thank you!!! – dharmatech Sep 12 at 3:17
  • 9
    This slows down dramatically chrome with 10+ open tabs... – Dark Templar Sep 15 at 8:41
  • 6
    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 at 8:31
  • 3
    Just enabling Vulkan fixed it for me. – Camilo Rada Sep 17 at 13:51
  • 8
    It fixed the issue. but make chrome really slow when watching youtube. – Terminal User Sep 20 at 8:50
14

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
| improve this answer | |
  • 2
    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 3 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 at 12:12
  • 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' – Thomas Kainrad 2 days ago
  • You're welcome. You could get fancy and use a regexp instead of the three kills. An exercise for the reader! – Andrew Bruce yesterday
13

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
| improve this answer | |
  • 2
    This is an Arch-specific extension, and is not currently available in other Linux variants (that I know of). – Diego Rivera Sep 17 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 at 1:18
  • 3
    Upvoted. Starting chrome with google-chrome --use-gl=desktop solved the issue. Saw it here as well: askubuntu.com/a/1270843/13330 – AlikElzin-kilaka Sep 25 at 18:24
6

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.

| improve this answer | |
  • 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 at 8:36
  • Has anyone tested the second solution? Can you explain what exactly those flags are doing? – Homero Esmeraldo Oct 5 at 18:27
  • The second solution worked for me .. Thanks :) – mr_azad Oct 6 at 10:09
  • Disabling hardware acceleration worked for me. – Daniel Rosehill Oct 21 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 at 12:23
3

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"
| improve this answer | |
3

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

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

| improve this answer | |
  • Thanks pal, now in the future when we don't need those flags, how can we revert that? – christianbueno.1 Sep 25 at 16:39
  • 1
    You can just stop using the modified .desktop file and use the one installed by the package instead when that happens. – Christian Fritz Sep 25 at 16:41
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

| improve this answer | |
1

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
| improve this answer | |
  • Do we run with sudo? – kelalaka Nov 5 at 13:15
  • No, as you can see: sudo is inside the script – RedEyed Nov 5 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 at 13:32
  • Updated the script to get the right version – RedEyed Nov 5 at 13:45
  • 1
    Although I've upvoted, this not solved the issue. The best is chrome://restart/ – kelalaka Nov 5 at 15:13
0

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".

| improve this answer | |

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.