EDITED: 1/07/2018 Added fix to be able to use the laptop display+hdmi output ————————-
Bumblebee (optirun) works in most cases, including CUDA apps. However…. In Some rare cases software (including Autodesk Maya of course!) use direct Nvidia drivers calls that bumblebee currently has no bridge for (instead of the system libs), so Maya for ie: thinks the video card has 0MB of memory and crashes.
This setup uses xrandr (insteand of VirtualGL) to render the buffer on the nvidia gpu (set up as headless) and copying it to the intel one that has the screen. This setup works well with 3d software like The Foundry Nuke, Autodesk Maya, Autodesk Mudbox, etc, at the expense of the battery life.
Word of advice: After the clean install, get a partition cloning software like Acronis True Image or such. I found xrandr to be a little temperamental, and adding custom modes, wrong modes, modifying defaults one might leave your system without a gui for good (or at least i couldn’t figure out how to revert my changes) Make a partition clone before the process, and after if all works as expected.
NOTE: AllowEmptyInitialConfiguration, this is required so the nvidia drivers won’t use the HDMI output as default, leaving you with a headless system if the screen is not present!
init 3
from the command line Install Nvidia drivers, when asked to setup a xorg.conf for you, press no! we want to keep our own xorg.conf we just did
Reboot the system, it will go into the console
at this stage, xrandr wont see any devices! as the x server is not loaded, you wont be able to change any config in randr at this point except to add or remove modes
dmesg |grep nvidia, check the module is loaded
dmesg |grep nouveau, check the module is not loaded! if it is, try another method to blacklist it until it doesnt show here after booting
now do xinit, or startx
if everything worked correctly, run systemctl set-default graphical.target to boot into the gui
if you have any issue, check your /var/log/Xorg.0.log to see what happened
NEW: this is the xrandr command i run to setup my single screen
note: for some reason, i had to add the full hd mode to my 4k laptop screen, if you dont need this, just use the last xrandr line note2: check your own output names with xrandr –verbose
I can now connect the second screen to the hdmi and it will fire up instantly. but anyway here is the base command i would run to configure it further on gdm start up