NVIDIA X Server Settings for Nvidia Optimus

Post your tutorials and howtos here.
User avatar
just
Posts: 297
Joined: 07 Nov 2013 08:06
Location: Rovaniemi, Finland

NVIDIA X Server Settings for Nvidia Optimus

Postby just » 21 Feb 2015 17:32

Content
  1. nvidia-settings and nvidia-xconfig
  2. breaking bumblebee
  3. repairing bumblebee
  4. correct use of nvidia-settings

1. nvidia-settings and nvidia-xconfig

The howto applies only to Nvidia Optimus computers. These are computers with two GPUs - Intel and Nvidia. It doesn't apply to computers with pure, simple Nvidia cards. These computers have only one GPU - Nvidia. Nvidia Optimus and pure Nvidia should be seen as two different types of cards. What works on pure Nvidia, doesn't always work on Nvidia Optimus.

Proprietary Nvidia video drivers with nvidia-optimus support (bumblebee) may be installed either by hand or by DDM. Both methods automatically create and configure all files and settings needed for correct bumblebee's work. No further manual intervention required.

Besides the drivers itself, two new utilities are added to the system:
  1. nvidia-settings
  2. nvidia-xconfig
Both have the corresponding packages, with the same name. The packages may be found in Synaptic Package Manager.

The first one, nvidia-settings, has the corresponding "NVIDIA X Server Settings" menu entry. The menu option simply launches nvidia-settings program, nothing more. It may be used to fine-tune various settings of Nvidia GPU. It's a GUI program.

nvidia-settings works on both pure and Optimus Nvidia cards. However, it can't automatically detect Optimus cards, and launched from menu as is, erroneously suggests to run nvidia-xconfig. Don't do it! nvidia-settings itself doesn't cause any damage to bumblebee.

The second one, nvidia-xconfig, has no menu entry, no graphical, no command line interface. It may be launched only by hand. It runs silently, takes one nanosecond to finish, doesn't return any message.

nvidia-xconfig works correctly for pure Nvidia cards only, on computers with one GPU. It can't detect Optimus cards. The utility is perfect bumblebee killer. On every run it immediately destroys bumblebee.

Never run nvidia-xconfig on Optimus computers.

Unfortunately, nvidia-xconfig package is always installed (by dependencies) during bumblebee installation. If you install by hand, purge (uninstall) nvidia-xconfig immediately after the installation. If you install using Device Driver Manager, then DDM takes care of it. Once the core Nvidia drivers are installed, it transparently purges nvida-xconfig for you.

DDM is the preferred way to install bumblebee for less experienced Nvidia Optimus users.

nvidia-xconfig ruins bumblebee by creating /etc/X11/xorg.conf file. It does not needed on correctly configured Optimus computers. It is needed on single GPU computers only. If exists, it prevents a graphical DE from loading. The boot sequence stops after the startup Plymouth theme, and drops to text-only console. There's no way to start X-server until the broken bumblebee is repaired.

As you know, the xorg.conf file is a fundamental part of X-server. How Optimus computers can run without it? They do so by using xorg.conf analogs, even more than only one. But these analogs have other names and is found in other places (directories). If /etc/X11/xorg.conf exists, it fools X-server with bumblebee and doesn't permit it to start.

Though this document uses KDE, it fully applies to any other DE.


2. Breaking bumblebee

Using Nvidia Optimus for years and following bumblebee project from its early development stages, when it even wasn't a part of any distro, don't remember any breakage in recent years. Except those in my own crazy experiments. With time, bumblebee became an extremely stable software.

Bumblebee doesn't break on its own. It is caused by using the software in a wrong way.

What follows is an example of incorrect use of nvidia-settings. The utility makes wrong and potentially dangerous suggestion on Optimus computers. Never follow it.

First, let's check that /etc/X11/xorg.conf really doesn't exist on Optimus computer with working bumblebee:

Code: Select all

$ date +"%Y-%m-%d %H:%M:%S" && ls /etc/X11/xorg* -lha
2015-02-20 05:00:48
ls: cannot access /etc/X11/xorg*: No such file or directory
$ 
Now, we select "NVIDIA X Server Settings" from menu and launch it. It suggests to run nvidia-xconfig:

Image

(full image is here)

If we decide to follow it and run nvidia-xconfig as root:
Image

then a) wrong and b) unneeded /etc/X11/xorg.conf file is created:

Code: Select all

$ date +"%Y-%m-%d %H:%M:%S" && ls /etc/X11/xorg* -lha
2015-02-20 05:01:12
-rw-r--r-- 1 root root 1.3K Feb 20 04:53 /etc/X11/xorg.conf
-rw-r--r-- 1 root root    0 Feb 20 04:53 /etc/X11/xorg.conf.nvidia-xconfig-original
$ 
On the next boot a graphical DE will not load. After the startup Plymouth we will be dropped to the text-only console tty1:

Code: Select all

SolydK 64-bit alexsos.net tty1
alexsos login: 
X-server and graphical DE can not be started from here.


3. Repairing bumblebee

After you have been dropped to text console, make a normal login with the standard user, to enter the bash shell:

Code: Select all

SolydK 64-bit alexsos.net tty1
alexsos login: just
Password:
just@alexsos ~ $ 
Damaged bumblebee may be repaired either with DDM or by hand. DDM is the preferred way to repair broken bumblebee. It has the -fixbumblebee option, specifically developed to cure the problem.
  1. Recovery with DDM

    At bash prompt, run the command

    Code: Select all

    ddm -fixbumblebee
    That's all. After reboot, the system will load up to the standard graphical DE, and bumblebee will turn back to work normally.

    Reboot the computer

    Code: Select all

    sudo shutdown -r now
    Done.
  2. Recovery by hand

    At bash prompt, remove /etc/X11/xorg.conf

    Code: Select all

    sudo rm /etc/X11/xorg.conf
    Then, purge nvidia-xconfig package

    Code: Select all

    sudo apt-get purge -y --force-yes nvidia-xconfig
    Finally, reboot the system

    Code: Select all

    sudo shutdown -r now
    The system will reboot in a graphical DE now, bumblebee will work normally.

    Done.

4. Correct use of nvidia-settings

edit 2015-02-23
  • DDM 2.0.6 (and newer) sets up the system-wide KDE menu so that NVIDIA X Server Settings runs correctly from it now. There's no need to edit menu by hand anymore, like described in this section.
There's only one way to correctly execute nvidia-settings utility on Optimus computers. It is done with the following command, which we may run in terminal:

Code: Select all

optirun -b none nvidia-settings -c :8
Or, we may run the same command with KRunner

Image

But the best way is to modify the command, corresponding to "NVIDIA X Server Settings" menu entry. It is found in Settings --> NVIDIA X Server Settings and contains the wrong default command:

Image

(full image is here)

Change the Command: field content with the correct one:

Image

(full image is here)

From now on, whenever we select NVIDIA X Server Settings from the menu, it will launch the utility for Nvidia Optimus card correctly:

Image

(full image is here)


Conclusion
  • right after the installation, bumblebee is configured and ready to work. no manual intervention required.
  • use DDM to install Nvidia Optimus software
  • if you install it by hand, purge nvidia-xconfig asap
  • if bumblebee gets broken, use DDM to repair it
  • to work on Optimus, nvidia-settings must be launched with the special command
  • the same command may be used to launch NVIDIA X Server Settings from the menu

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 5 guests