(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-settingsSelect 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 queryMethod 2 - Reboot is required
To change to Intel GPU :
You need to reboot your box to make the change effect.
sudo prime-select intelTo change to nVidia GPU :
sudo prime-select nvidiaYou need to reboot your box to make the change effect.
To check the settings :
prime-select queryMethod 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 installThe "prime-select" binary is located at /usr/local/bin.
Rename the original "prime-select" :
sudo mv /usr/bin/prime-select /usr/bin/prime-select-originalChange to lightdm :
sudo dpkg-reconfigure gdm3Select lightdm and then reboot the box.
Prime sync for tear free laptop panel
sudo nano /etc/modprobe.d/zz-nvidia-modeset.confAdd the following lines :
# enable prime-sync
options nvidia-drm modeset=1Then run the following command and then reboot your box :
sudo update-initramfs -uTo change to Intel GPU :
sudo prime-select intelThe box will force you to logout and awaiting for your re-login.
To change to nVidia GPU :
sudo prime-select nvidiaThe 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 devicesTo 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.
