18.04 Nvidia graphics screen flickering

This appears to be a fairly common issue but the solutions I tried have not worked. Using nvidia-340.106

Solutions I tried:

  1. compizconfig-settings-manager Force full screen redraws (buffer swap) on repaint

  2. Updating /etc/X11/xorg.conf to add (Option "FlatPanelProperties" "Dithering=Disabled")

  3. Enable triple buffering in xorg.conf

  4. Using nvidia-settings to enable Sync to Vblank, Allow Flipping, Use Conformant Texture Clamping

  5. Use KDE and GNOME

lspci output:

03:00.0 VGA compatible controller: NVIDIA Corporation MCP7A [GeForce 9400] (rev b1) (prog-if 00 [VGA controller])
    Subsystem: Apple Inc. MCP7A [GeForce 9400]
    Flags: bus master, fast devsel, latency 0, IRQ 26
    Memory at d2000000 (32-bit, non-prefetchable) [size=16M]
    Memory at c0000000 (64-bit, prefetchable) [size=256M]
    Memory at d0000000 (64-bit, prefetchable) [size=32M]
    I/O ports at 1000 [size=128]
    [virtual] Expansion ROM at d3000000 [disabled] [size=128K]
    Capabilities: <access denied>
    Kernel driver in use: nvidia
    Kernel modules: nvidiafb, nouveau, nvidia

lshw output:

  *-display                 
   description: VGA compatible controller
   product: MCP7A [GeForce 9400]
   vendor: NVIDIA Corporation
   physical id: 0
   bus info: pci@0000:03:00.0
   version: b1
   width: 64 bits
   clock: 33MHz
   capabilities: pm msi vga_controller bus_master cap_list rom
   configuration: driver=nvidia latency=0
   resources: irq:26 memory:d2000000-d2ffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:1000(size=128) memory:d3000000-d301ffff

Solution 1:

I had the same issue and this is what worked for me I started following this article How to install the NVIDIA drivers on Ubuntu 18.04 Bionic Beaver Linux

In a nutshell I listed the recommended drivers using

$ ubuntu-drivers devices

then to install the recommended drivers

$ sudo ubuntu-drivers autoinstall

or you can use apt to install whicheve driver you prefer if it is not the recommended one

$ sudo apt install nvidia-390

once I rebooted my system I was good to go but if you still have problems a few other things are mentioned in the article one being disabling Noveau Nvidia driver How to disable Nouveau nvidia driver on Ubuntu 18.04 Bionic Beaver Linux To summarize you blacklist the Nvidia nouveau driver:

$ sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
$ sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"

and then you can confirm the content of the new modprobe config file:

$ cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf

you should see something like

blacklist nouveau
options nouveau modeset=0

Solution 2:

Basically among other things simply, read Post 5 for the none specific version.

Run this

sudo -H gedit /etc/modprobe.d/nvidia-drm-nomodeset.conf

Add this line

options nvidia-drm modeset=1

Link to Source