Setting up Ubuntu 19.04 with Nvidia Optimus on my Asus ZenBook Flip UX562FSeptember 11th, 2019
Nowadays, Ubuntu is usually relatively straightforward to install. However, on this device, I ran into some issues: Firstly with getting it to boot, and secondly with fully utilizing the GPU. It's absolutely worth it though, and with this guide you should be able to get it running quickly!
Note that this does not cover the basics of installing a GNU/Linux system on a computer, possibly alongside Windows. There are already a number of great tutorials for that.
You can access the boot menu by holding ESC during the Asus logo. When trying to boot into my USB drive with Ubuntu, I initially got stuck at a black screen. Booting with the 'Safe Graphics' option works about 50% of the time though. Optionally, press 'E' in the Grub selection screen and replace 'quiet splash' with
nomodeset. Then hit F10 to boot. (Source)
On the freshly installed system, you will need safe graphics or
nomodeset again. In addition, an issue with intel microcode prevented me from successfully booting. This was fixed by adding
When you have finally booted into Ubuntu, make the intel microcode fix permanent by editing
/etc/default/grub. Replace the
GRUB_CMDLINE_LINUX_DEFAULT line with this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash dis_ucode_ldr"
Yes, we're keeping the quiet splash - this is because
nomodeset won't be required anymore once we have Nvidia drivers.
There are many tutorials for this, but I'll try to repeat the steps again in a concise way.
Note that you'll be installing proprietary Nvidia drivers from an alternative source. Unfortunately, the open source drivers aren't even close yet, in part due to Nvidia's unwillingness to be very helpful.
First add the alternative source (PPA) and update your available packages:
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update
Now, check what's the most recent available driver:
apt-cache search nvidia-driver
At the time of writing this, 430 is the most recent version. Install it like this:
sudo apt-get install nvidia-driver-430
You can also use Ubuntu's 'Software & Updates' GUI. In the 'Additional Drivers' tab, you should see the most recent Nvidia drivers after adding the PPA.
Now, after rebooting, things should be relatively functional. However, there's one more step:
This laptop has both integrated Intel graphics and a dedicated Nvidia GPU. After installing the drivers, you can switch which of these you want to use for everything in the 'PRIME Profiles' tab of the 'NVIDIA X Server Settings' GUI.
To save battery life and keep the GPU free for tasks which require it, it's best to use the integrated graphics for most things, and only take the GPU for certain graphics-intensive applications. I also had a very strange issue where I was running out of VRAM very quickly with this configuration (you can use
watch nvidia-smi for checking the VRAM usage).
Nvidia Optimus is the technology which allows for this. Again, Nvidia was very unhelpful with getting this to work on Linux, but the free Bumblebee project did it (to some extent).
You can install Bumblebee and Primus like this:
sudo apt-get install bumblebee primus
With Bumblebee, you can now run programs with your GPU like this:
However, this didn't properly work for me until I made some more changes. It started with the error
Cannot access secondary GPU. For this, I had to make sure to select the Nvidia card in the PRIME profile, and in
/etc/bumblebee/bumblebee.conf, change these paths as follows:
You might have to replace '430' by the number of your version, if it's different.
At this point, I was getting other errors like
Cannot open or write pidfile /var/run/bumblebeed.pid or
Failed to retrieve LibraryPath setting. It might also simply not do anything when trying to
optirun something, and just be stuck at a blinking cursor.
I had to set this environment variable:
__GLVND_DISALLOW_PATCHING=1 You can make it permanent by adding this at the bottom of
It might work now. If you get an error like
Failed to load modules at startup: Could not find module by name 'off', you need to do one more thing: In
alias nvidia off or comment it out.
You can use
glxgears, a simple 3D application, to test your setup:
As mentioned before,
nvidia-smi can be used for seeing your GPU utilization and sensor values:
If something doesn't work, askubuntu is a great place to search and ask. For Bumblebee, this launchpad thread was my main source. You can also contact me at email@example.com, even if you already solved the issue, so that I can expand this guide.
Good luck and have fun!