HOWTO : Intel and nVidia GPUs on Ubuntu 18.04.1 LTS
The version of nVidia driver for Ubuntu 18.04.1 is 390 at the time of this writing. You have 3 methods to switch between Intel GPU and nVidia GPU. However, these require your box to reboot or relogin to make the change effect.
(A) nVidia Driver Install
sudo apt install bbswitch-dkms nvidia-dkms-390 nvidia-driver-390 nvidia-headless-390 nvidia-kernel-common-390 nvidia-prime nvidia-settings nvidia-utils-390 xserver-xorg-video-nvidia-390 nvidia-cuda-toolkit
Method 1 - Reboot is required
Select nVidia GPU or Intel GPU from "Prime" on the menu. After that, reboot your box.
This method is working only when nVidia driver is loaded. You need to reboot your box to make the change effect.
To confirm the change :
Method 2 - Reboot is required
To change to Intel GPU :
You need to reboot your box to make the change effect.
To change to nVidia GPU :
You need to reboot your box to make the change effect.
To check the settings :
Method 3 - Relogin is required
To install modified version of prime-select :
The "prime-select" binary is located at /usr/local/bin.
Rename the original "prime-select" :
Change to lightdm :
Select lightdm and then reboot the box.
Prime sync for tear free laptop panel
Add the following lines :
Then run the following command and then reboot your box :
To change to Intel GPU :
The box will force you to logout and awaiting for your re-login.
To change to nVidia GPU :
The box will force you to logout and awaiting for your re-login.
To check the settings :
(B) Optional
To check what nVidia driver version is installed :
To auto install the nVidia driver :
(C) Conclusion
To set to Intel GPU for power saving while nVidia GPU for performance. For Kali Linux or Parrot Security OS users, I recommended to use Method 2 after installed the nVidia driver. The package name of nVidia driver for Kali Linux and Parrot Security OS are different from Ubuntu 18.04.1 LTS. When using Method 3, the Intel display card cannot be video properly. However,, Method 2 has no such problem.
That's all! See you.
(A) nVidia Driver Install
sudo apt install bbswitch-dkms nvidia-dkms-390 nvidia-driver-390 nvidia-headless-390 nvidia-kernel-common-390 nvidia-prime nvidia-settings nvidia-utils-390 xserver-xorg-video-nvidia-390 nvidia-cuda-toolkit
Method 1 - Reboot is required
nvidia-settings
Select nVidia GPU or Intel GPU from "Prime" on the menu. After that, reboot your box.
This method is working only when nVidia driver is loaded. You need to reboot your box to make the change effect.
To confirm the change :
prime-select query
Method 2 - Reboot is required
To change to Intel GPU :
You need to reboot your box to make the change effect.
sudo prime-select intel
To change to nVidia GPU :
sudo prime-select nvidia
You need to reboot your box to make the change effect.
To check the settings :
prime-select query
Method 3 - Relogin is required
To install modified version of prime-select :
sudo apt install git rustc cargo lightdm
git clone https://github.com/matthieugras/Prime-Ubuntu-18.04
cd Prime-Ubuntu-18.04
cd prime_socket/src
sudo make install
The "prime-select" binary is located at /usr/local/bin.
Rename the original "prime-select" :
sudo mv /usr/bin/prime-select /usr/bin/prime-select-original
Change to lightdm :
sudo dpkg-reconfigure gdm3
Select lightdm and then reboot the box.
Prime sync for tear free laptop panel
sudo nano /etc/modprobe.d/zz-nvidia-modeset.conf
Add the following lines :
# enable prime-sync
options nvidia-drm modeset=1
Then run the following command and then reboot your box :
sudo update-initramfs -u
To change to Intel GPU :
sudo prime-select intel
The box will force you to logout and awaiting for your re-login.
To change to nVidia GPU :
sudo prime-select nvidia
The box will force you to logout and awaiting for your re-login.
To check the settings :
prime-select query
(B) Optional
To check what nVidia driver version is installed :
ubuntu-drivers devices
To auto install the nVidia driver :
sudo ubuntu-drivers autoinstall
(C) Conclusion
To set to Intel GPU for power saving while nVidia GPU for performance. For Kali Linux or Parrot Security OS users, I recommended to use Method 2 after installed the nVidia driver. The package name of nVidia driver for Kali Linux and Parrot Security OS are different from Ubuntu 18.04.1 LTS. When using Method 3, the Intel display card cannot be video properly. However,, Method 2 has no such problem.
That's all! See you.