jump to navigation

Post-it: how to switch to the discrete nvidia card on Ubuntu 18.04 2018-05-03

Posted by claudio in Uncategorized.
Tags: , , , ,
add a comment

nvidiaAnother post-it note so I don’t forget (the first one is about how to purge the nvidia drivers and use the open source drivers).

The nvidia drivers are often problematic, and as long the open source drivers have decent performance, that’s OK. On laptops you can always switch to the Intel card with prime, using but in fact bypassing the nvidia drivers.This is also how the open source nouveau driver work.

However, since a few Ubuntu releases the Nvidia drivers seem more buggy, on one one of my system I see this out of the box behaviour:

  • With the open source nouveau drivers the performance on Xorg is terrible (choppy video, OK desktop). Xorg is the default graphical server on Ubuntu 18.04. On 17.10 the default was Wayland.
  • With the open source nouveau drivers the performance on Wayland is good (e.g. for 1080p HEVC video).
  • With the closed source nvidia driver set to use the intel driver the performance on Xorg and Wayland is terrible (choppy video, OK desktop).
  • With the closed source nvidia driver set to use the nvidia you’re stuck in a login manager loop, a black screen or terrible performance on Xorg and Wayland  (choppy video, OK desktop).

If you’re ok with using Wayland (I am on the machine in question, at work my machine has Intel video and I am using Xorg), stick with nouveau and Wayland. Your laptop will get less hot (fans!) and have better battery life. Virtual consoles (ctrl+alt+) will still be available.

If you need Xorg, using the closed source nvidia driver is the only way to get good performance, at least on my machine. If you want to use this driver, follow the instructions below. Be sure to know what you do, you won’t loose files, but you may make your system unbootable (recover with an usb disk) if not done correctly:

– Make sure nvidia is not blacklisted, remove bumblebee if installed. Have a look in /etc/modules and /etc/modprobe.d/*:

$ sudo apt-get remove --purge bumblebee
$ grep nvidia /etc/modules /etc/modprobe.d/*

“blacklist nvidia” is what’s mostly used, remove that.

– Add “nvidia-drm.modeset=1” to the GRUB_CMDLINE line in /etc/default/grub:
$ sudo vi /etc/default/grub
(or use nano instead of vi)

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
becomes
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nvidia-drm.modeset=1"

– Activate the changes:
$ sudo update-grub

– Install Nvidia drivers:
$ sudo ubuntu-drivers autoinstall

– Check if prime has nvidia selected, select nvidia otherwise:
$ prime-select query
$ sudo prime-select nvidia

5. Reboot
$ sudo init 6

Be warned that modeset=1 disables the virtual consoles (ctl+alt+<nr>).

That’s it.

Advertisements

Post-it: how to revive X on Ubuntu after nvidia kills it 2017-04-12

Posted by claudio in Uncategorized.
Tags: , , , ,
add a comment

20180503: Updated for Ubuntu 18.04

I am not a hug fan of the Linux Nvidia drivers*, but once in a while I try them to check the performance of the machine. More often than not, I end up in a console and no X/Wayland.

I have seen some Ubuntu users reinstalling their machine after this f* up, so here my notes to fix it (I always forget the initramfs step and end up wasting a lot of time):

$ sudo apt-get remove --purge nvidia-*

If /etc/X11/xorg.conf is present (often not the case in Ubuntu 18.04), backup it:

$ sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf_pre-nvidia

On recent releases, this step is not longer necessary because it’s automatically triggered by step 1:

$ sudo update-initramfs -u

Reboot the computer:
$ reboot

*: I am not a fan of the Windows drivers either now that Nvidia decided to harvest emails and track you if you want updates.