Graphics and resolution problems (Nvidia) in Ubuntu 18.04 after update

I recently updated from Ubuntu 14.04 to 16.04 to 18.04 (i.e. I am now on 18.04 bionic, and started on 14). In 16.04 everything worked ok, but now I have some severe graphics problems:

Problem(s) description:

First I got the log in screen in correct resolution, but it froze with a black screen showing the mouse cursor (frozen) directly after logging in. I fixed this by installing new Nvidia drivers, following answers here.

After rebooting I got the log in screen with low resolution (640x480). Logging in works fine, but the resolution is still low, and as a result I cannot see the whole screen. Changing resolution does not work: When entering display settings, it says 'Unknown Display', and the Resolution field is just empty and grey (literally no text or figures at all apart from the word 'Resolution'), and clicking it results in a small grey empty speech bubble appearing, but nothing happens.

I tried looking for solutions in several places, such as:

Ubuntu 18.04.1 LTS unable to change resolution

Ubuntu 18 scale problem

and here, but it is for older versions, and perhaps does not seem to apply that well to my situation anyway.

What I have tried:

  • I have checked the zoom feature: It is off.
  • I looked for 'nomodeset' in /etc/default/grub ,but nothing.
  • I have run apt-get purge xserver-xorg-video-intel , and installed the recommended nvidia drivers via ubuntu-drivers autoinstall , these happens to be nvidia-driver-440
  • EDIT1: I have checked the current drivers in use via Software&Updated/Additional Drivers. The drivers I have tried are: nvidia-driver-440 (recommended), nvidia-driver-435, nvidia-driver-390, and xserver-xorg-video-nouveau. I have applied the changes, I have rebooted after each change, and I have checked that the drivers I've changed to are in use (via 'Software & Updates').
  • EDIT2: I have sucessfully run sudo apt-get purge nvidia-*;add-apt-repository ppa:graphics-drivers/ppa; sudo apt-get update; sudo apt-get install nvidia-driver-440.
  • EDIT2.1: Also, After purging nvidia-*, (not reinstalling anything) and rebooting (with xorg drivers) Ubuntu actually gives me a higher res login screen (at least 1920x1080), but it is now back to freezing on a black screen with frozen mouse pointer after login. Choosing 'recovery mode' in GRUB, and the option 'resume' then weirdly gives me a 1024x768 login screen with working login. Still no higher resolution though, but I can at least pick one (1024x768), xrandr still says the same except added highest resolution 1024x768.
  • EDIT3: About Secure Boot: My Bios says: Secure Boot State: Disabled; Platform Key State: Unloaded; OS Type: Other OS. This was described as the best setting for non Secure Boot compatible operating systems, so I understand it as being disabled.
  • EDIT4: lsmod | grep -i i915 returns the empty string (while running either nvidia-440 or xorg). nvidia-smi returns (running nvidia-440):

    NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

I still have the same problem, and get the same outputs below.

Outputs:

Here's the output of 'lspci | grep -i vga':

01:00.0 VGA compatible controller: NVIDIA Corporation GK106 [GeForce GTX 660] (rev a1)

And of 'xrandr':

xrandr: Failed to get size of gamma for output default
Screen 0: minimum 640 x 480, current 640 x 480, maximum    640 x 480
default connected primary 640x480+0+0 0mm x 0mm
640x480       73.00*

Hardinfo shows me: Graphics: 640x480 (Unknown) The X.Org Foundation

And lshw -c -video gives me:

*-display UNCLAIMED
   description: VGA compatible controller
   product: GK106 [GeForce GTX 660]
   vendor: NVIDIA Corporation
   physical id: 0
   bus info: pci@0000:01:00.0
   version: a1
   width: 64 bits
   clock: 33MHz
   capabilities: pm msi pciexpress vga_controller bus_master cap_list
   configuration: latency=0
   resources: memory:f6000000-f6ffffff memory:e8000000-efffffff memory:f0000000-f1ffffff ioport:e000(size=128) memory:f7000000-f707ffff

The xrandr output stays the same, no matter which of the above listed drivers I try.

Specs, Conclusion and Question:

Obviously there seems to be some problem reported by xrandr, but my knowledge here is very slim, and I don't really know what the problem means, or how to fix it. I'm guessing this is driver related, but I just don't know how to proceed.

Otherwise I'm on a Intel i7-3770 PC with a Samsung monitor connected via a Display Port connection to a Nvidia GTX 660. And, again, everything worked in both 14.04 and 16.04, and works fine in Windows 7.

Question: Do anyone have any further suggestions on how to resolve this problem? It would be highly appreciated. I've had other graphics related problems with Nvidia and Ubuntu 18.04 on other computers, but not like this.


Solution 1:

system: ubuntu 18.04
My solution was

$ sudo apt purge nvidia*
## if you reboot here , the computer will use Nouveau driver.
##check the recommended drivers
$ ubuntu-drivers device
## that show me 390 as recommended but didn't work , 340 works in my case
$ sudo apt install nvidia-340

Reboot the computer.

Solution 2:

Please note that the NVidia 435 and 440 drivers are not compatible with Linux kernel versions 4.xx.x.

The above answers are all partially correct. On Ubuntu 18.04, you should update to NVidia 435 or 440 drivers in order for the computer to boot properly. However, for some users (like OP) with outdated kernel versions, this will result in issues with the resolution settings & monitor inputs.

Please check your kernel version by running uname -r.

I had all of the issues on this thread. Tried every suggestion & they were not enough. I kept hunting down the errors, which brought me to this forum post.

Finally, the solution was to update the kernel to 5.3.0 with (source):

sudo apt-get install --install-recommends linux-generic-hwe-18.04 xserver-xorg-hwe-18.04

Solution 3:

Since I was unable to solve these issues, and as it was suggested in the comments above, I just did a fresh install.

I noted that even the gui installation was buggy though. It hung on me several times, and I saw weird checker patterns appearing. Around about the third time or so, the installation managed to get all the way through, I guess going without gui would have been better. Afterwards, ubuntu-drivers recommended nvidia-435 instead of 440 as earlier. I installed them using ubuntu-drivers autoinstall, and now everything works fine.

I never had such issues with any other linux dist on this computer, and I had similar issues with 18.04 + nvidia on a different computer. So, I really wonder what's up with 18.04 + nvidia (?).

Hopefully this question/answer can still serve as somewhat of an additional trouble shooting guide for people with similar problems; I know it would've for me.

Solution 4:

right solution just small correction on:

$ ubuntu-drivers devices # to check possible devices for nvidia card.

Driver 390 also showed by me did worked since install off 18.04 till this week sudden it does not work anymore. nvidia-340 works perfect by me. Nouveau drivers also but they give not full use of device possibility .

However since 18.04 did worked ok before with nvidia 390 drivers now anymore it looks to be a problem from one of the last updates. 390 self.

I always have a crash repport nvidia-dkms-390.0.crash into /var/crash. Suspect an error during config and or build of module due to ... I do have card GeForce GT 440 and it should be ok with driver version.

For the time working with 340 version thanks to christianbueno.1 That is a very good temporary solution.

Ok Finally it's ok. EUREKA SOLVED. PC is now running with nvidia-driver-390 like it should be. How to do :

(In the mean time I was with 340 as used driver version). When I analysed the build report of 390.116 driver version included in base ubuntu 18.04. Could be seen that build of nv modules failed. The real reason I could not find but suspected some error in source who I guess do not build anymore since last gcc version update and or some missing stuff.So I decided to use the last avbl source version on ubuntu using ppa:graphics-drivers.

$ sudo add-apt-repository ppa:graphics-drivers

$ sudo apt-get update

$ sudo apt-get upgrade

It updated 340 and installed a lot of extra graphic stuff. Reboot pc. It runned fine.

Then removed 340 (purged)

$ sudo apt remove --purge nvidia*

checked recomended drive with $ ubuntu-drivers. 390.129 version was preferred.

$ sudo ubuntu-drivers autoinstall.

Build of dkms modules went fine now installation ok. Reboot ok now running with last version avbl by ubuntu of nvidia-390 driver.