How can I switch from intel integrated graphics to nvidia GeForce 940mx without breaking X?

10,176

First you need to install the driver by

sudo apt install nvidia-367

and reboot.

You can check the status and switch adapters in the Nvidia X Server Settings application (PRIME Profiles).

Also you can check the status in a terminal by

prime-select query

Switch to Nvidia by

sudo prime-select nvidia

Switch to Intel by

sudo prime-select intel

You need to log out and it to apply the setting.

Share:
10,176

Related videos on Youtube

Ethan McTague
Author by

Ethan McTague

Updated on September 18, 2022

Comments

  • Ethan McTague
    Ethan McTague over 1 year

    yesterday I bought a laptop which contains both a Nvidia 940mx graphics card and Intel Integrated Graphics. I have found that it uses the Intel integrated graphics by default, but I wish for it to use the Nvidia card instead.

    I have already tried switching while using Arch Linux and have switched to Ubuntu in hopes that it will work here, as when I made an attempt on Arch Linux, it resulted in the X Server being entirely unable to start, reporting that it is unable to locate the display, or something along those lines. Because I have already had this issue with switching, I am hesitant to try again without first ensuring that everything will work correctly.

    There seem to be several conflicting (and outdated) guides for switching to the nvidia card. Using vga_switcheroo did not work, as the /sys/kernel/debug/vgaswitcheroo/switch did not even exist. Any existing questions on stack exchange which describe utilizing the nvidia card are either outdated, inconsistent with all the others, or are not consistent with my situation.

    Some Hardware Information:

    $ lspci -nnk | grep -i vga -A3 | grep 'in use'
    Kernel driver in use: i915
    
    $ lshw -short | grep display
    /0/100/2                     display        Intel Corporation
    /0/100/1c/0                  display        NVIDIA Corporation
    
    $ lshw | grep -A10 "VGA\|3D"
             description: VGA compatible controller
             product: Intel Corporation
             vendor: Intel Corporation
             physical id: 2
             bus info: pci@0000:00:02.0
             version: 02
             width: 64 bits
             clock: 33MHz
             capabilities: vga_controller bus_master cap_list rom
             configuration: driver=i915 latency=0
             resources: irq:131 memory:b2000000-b2ffffff memory:c0000000-cfffffff ioport:5000(size=64) memory:c0000-dffff
    --
                description: 3D controller
                product: NVIDIA Corporation
                vendor: NVIDIA Corporation
                physical id: 0
                bus info: pci@0000:01:00.0
                version: a2
                width: 64 bits
                clock: 33MHz
                capabilities: cap_list
                configuration: latency=0
                resources: memory:b3000000-b3ffffff memory:a0000000-afffffff memory:b0000000-b1ffffff ioport:4000(size=128) memory:b4000000-b407ffff
    
    $ lspci -nnk | grep -i "VGA\|3D" -A3
    00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:5916] (rev 02)
        Subsystem: Acer Incorporated [ALI] Device [1025:111a]
        Kernel driver in use: i915
        Kernel modules: i915
    --
    01:00.0 3D controller [0302]: NVIDIA Corporation Device [10de:179c] (rev a2)
        Subsystem: Acer Incorporated [ALI] Device [1025:111a]
        Kernel modules: nvidiafb, nouveau
    03:00.0 Network controller [0280]: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter [168c:0042] (rev 31)
    
    $ sudo ubuntu-drivers devices                             
    == cpu-microcode.py ==
    driver   : intel-microcode - distro non-free
    
    == /sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0 ==
    vendor   : NVIDIA Corporation
    modalias : pci:v000010DEd0000179Csv00001025sd0000111Abc03sc02i00
    driver   : xserver-xorg-video-nouveau - distro free builtin
    driver   : nvidia-367 - distro non-free recommended
    
    $ arch
    x86_64
    

    Given this information, what is the safest way for me to switch from the intel device to the nvidia graphics card without a risk of breaking the X server? This system is running Ubuntu 16.10 Yakkety.

  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 7 years
    Is there a link you can reference on why sudo apt install nvidia-367 command instead of Settings->Software & Updates->Additional Drivers. Also why 367 when said screen reveals 340, 375, 367, 378 & 370 (open source) plus 304 (proprietary). I have 304 currently installed and not working for my Geforce GT650M so always use Intel Hybrid HD4000 instead. Just curious why terminal is recommended and not Ubuntu's GUI methodology. I know 367 is the long term stable release which I presume is why you picked that version? A link referencing your installation technique would be nice. Thanks :)
  • Pilot6
    Pilot6 over 7 years
    They all are proprietary. The 367 is the one that is in the Ubuntu repos. You see others because you have connected an unofficial PPA. The command does the same as the GUI prog.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 7 years
    Ahh.. thank you. It's true I added the nvidia PPA sometime last year for reasons given on other threads / websites I now forget. I will conform and use 367 like everyone else soon :D