CLI Ubuntu 16.04 - Specify which adapter to use as primary in Ubuntu?

I have a system with 2 Nvidia video cards in it, running Ubuntu CLI only - no GUI.

The GeForce GTX 1080 card is going to be used for CUDA calcs.

The Geforce GT 710 card is used for standard video output - there is no on-motherboard video output.

When the system is turned on, video output works fine out of the GT 710 for POST and for things like BIOS. When it reaches loading Ubuntu, the screen goes black and does not change.

I can shell in to the system remotely, and have verified that nouveau is blacklisted and not running:

root@ubuntu16:~# lsmod |grep -i nouv
root@ubuntu16:~# lsmod |grep -i nvi
nvidia_drm             45056  0
nvidia_modeset        765952  1 nvidia_drm
nvidia              11476992  1 nvidia_modeset
drm_kms_helper        147456  1 nvidia_drm
drm                   364544  3 drm_kms_helper,nvidia_drm
root@ubuntu16:~# modinfo nvidia
filename:       /lib/modules/4.4.0-34-generic/kernel/drivers/video/nvidia.ko
alias:          char-major-195-*
version:        367.44
supported:      external
license:        NVIDIA
srcversion:     62594DC43B355E37A82EB4C
alias:          pci:v000010DEd00000E00sv*sd*bc04sc80i00*
alias:          pci:v000010DEd*sv*sd*bc03sc02i00*
alias:          pci:v000010DEd*sv*sd*bc03sc00i00*
depends:
vermagic:       4.4.0-34-generic SMP mod_unload modversions
parm:           NVreg_Mobile:int
parm:           NVreg_ResmanDebugLevel:int
parm:           NVreg_RmLogonRC:int
parm:           NVreg_ModifyDeviceFiles:int
parm:           NVreg_DeviceFileUID:int
parm:           NVreg_DeviceFileGID:int
parm:           NVreg_DeviceFileMode:int
parm:           NVreg_UpdateMemoryTypes:int
parm:           NVreg_InitializeSystemMemoryAllocations:int
parm:           NVreg_UsePageAttributeTable:int
parm:           NVreg_MapRegistersEarly:int
parm:           NVreg_RegisterForACPIEvents:int
parm:           NVreg_CheckPCIConfigSpace:int
parm:           NVreg_EnablePCIeGen3:int
parm:           NVreg_EnableMSI:int
parm:           NVreg_TCEBypassMode:int
parm:           NVreg_UseThreadedInterrupts:int
parm:           NVreg_MemoryPoolSize:int
parm:           NVreg_RegistryDwords:charp
parm:           NVreg_RmMsg:charp
parm:           NVreg_AssignGpus:charp
root@ubuntu16:~#

root@ubuntu16:/var/log# nvidia-smi
Wed Aug 24 16:50:52 2016
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 367.44                 Driver Version: 367.44                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GT 710      Off  | 0000:02:00.0     N/A |                  N/A |
| 40%   29C    P0    N/A /  N/A |      0MiB /  2000MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 1080    Off  | 0000:81:00.0     Off |                  N/A |
|  0%   39C    P0    41W / 180W |      0MiB /  8113MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|    0                  Not Supported                                         |
+-----------------------------------------------------------------------------+
root@ubuntu16:/var/log#

Can anyone offer any insight in to how to do this? I’m frustrated that there’s no clear documentation on how to specify a primary adapter.

You’re talking about the Ubuntu console and not X, right? Does pressing the escape key make it display something?

Hey Aaron, thanks for the reply.

No, keys do not produce any reaction at all from the screen. The monitor is definitely getting signal, but the signal is black and nothing shows up.

I tried a variety of combinations, escape, ctrl+alt+f1,f2,f3 etc.

I’m looking for whatever config file I need to manually edit to guarantee that the 710 will be used over the 1080; moving the VGA monitor to the other card and vice versa has the same effect - no video.

Nobody knows how to do this?

I mean I feel like I should know, that it should be drop-dead easy, but that doesn’t appear to be the case?

Seriously - I just want the equivalent of selecting a primary adapter in Windows in Ubuntu. It’s got to be defined somewhere, I just don’t know how or where.

I never figured this out; I was able to get video back by forcing grub graphics to text mode:

#Place "set linux_gfx_mode=text" above "export linux_gfx_mode" in /boot/grub/grub.cfg:
sed -i 's/export linux_gfx_mode/set linux_gfx_mode=text\nexport linux_gfx_mode/g' /boot/grub/grub.cfg
#Now, (if you're in Ubuntu) update grub
update-grub

I have same problem when update driver. I have an old quadro fx580 for monitor and gtx560 for only cuda. The first one run with 304.xx driver, but if you updates lastest new drivers version supported, I have a black screen on unbuntu reboot. I think do you try do downgrade the drivers.

I’m still not sure about the configuration you’re trying to use. If you’re not running an X server, then the kernel should be inheriting the configuration set up by the BIOS, which it sounds like is on the GT 710.

If you’re running an X server, then what it does depends on xorg.conf. If there’s no xorg.conf, it tries to figure out which GPU is the “primary” one by looking at the kernel’s boot_vga flags. In theory, that should make it start on the GT 710 as well, but I’ve seen a lot of cases where that doesn’t work right. You should be able to force it by running “nvidia-xconfig” to generate an xorg.conf and then adding a BusID line to tell it explicitly to use the GT 710.

There’s some information about how to specify a BusID in the README:
http://us.download.nvidia.com/XFree86/Linux-x86/370.28/README/faq.html#busid
http://us.download.nvidia.com/XFree86/Linux-x86/370.28/README/configmultxscreens.html
http://us.download.nvidia.com/XFree86/Linux-x86/370.28/README/gpunames.html