Install bbswitch-dkms by entering the following commands in the terminal:
sudo apt update sudo apt install bbswitch-dkms
Interface for toggling the power on NVIDIA Optimus video cards
bbswitch is a kernel module which automatically detects the required ACPI calls for two kinds of Optimus laptops. It has been verified to work with "real" Optimus and "legacy" Optimus laptops (at least, that is what the author Lekensteyn calls those). . This package uses DKMS to automatically build the bbswitch kernel module.