NVIDIA Geforce 840m Driver Issue
Solution 1:
In order to get your nvidia GPU to work, you need to install "bumblebee", just like it is mentioned on the wiki:
sudo apt-get install bumblebee bumblebee-nvidia primus linux-headers-generic
However, your card is not supported by the default drivers, since it is too recent, and thus, you will need to take additional steps.
First of all, you must install the latest drivers sudo apt-get install nvidia 346
(at the time of writing).
Afterwards, you must edit the file /etc/bumblebee/bumblebee.conf
and replace all instances of "nvidia-current" with "nvidia-346" (It has to be replaced on 4 places in that file).
This, however, will still make the machine boot into a black screen. The problem is that the nvidia module is being loaded before the intel one. Bumblebee creates a file /etc/modules/modprobe.d/bumblebee.conf
that blacklists nvidia-modules. This file, however, hasn't been updated in a while. Therefore, you must add the following to the end of this file:
# 346
blacklist nvidia-346
blacklist nvidia-346-updates
blacklist nvidia-experimental-346
After a reboot, you should be good to go. Of course, don't forget to change "346" to the number on the driver version you have installed.