Consegui instalar o driver da nvidia na página nvidia. Basta pegar o driver no arquivo .run e instalá-lo.
O comando é assim:
sudo stop service lightdm
chmod +x NVIDIA-Linux-x86_64-331.49.run
sudo ./NVIDIA-Linux-x86_64-331.49.run
No entanto, descobri que poderia desligar a nvidia e executar o cartão de intel. O cartão de intel é muito melhor que nvidia considerando que eu estou usando meu MBP principalmente para trabalho e estudo mas não jogo. A seguir, como eu fiz isso:
sudo vi /etc/grub.d/10_linux
+ Add following:
echo " outb 0x728 1" | sed "s/^/$submenu_indentation/"
echo " outb 0x710 2" | sed "s/^/$submenu_indentation/"
echo " outb 0x740 2" | sed "s/^/$submenu_indentation/"
echo " outb 0x750 0" | sed "s/^/$submenu_indentation/"
after these lines:
if [ x$type != xrecovery ] ; then
echo " gfxmode $linux_gfx_mode" | sed "s/^/$submenu_indentation/"
fi
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
+ Rebuild grub:
grub-mkconfig > /boot/grub/grub.cfg
+ Open Grub Customizer, add following options:
i915.lvds_channel_mode=2 i915.modeset=1 i915.lvds_use_ssc=0
+ Reboot and enjoy low power and low heat
+ To confirm Nvidia is off:
sudo cat /sys/kernel/debug/vgaswitcheroo/switch
+ Download mbp_power.c and compile it:
sudo gcc -O2 -o /usr/local/bin/mbp_power mbp_power.c
+ Make it run right after resuming from sleep
vim /etc/pm/sleep.d/10_disable_nvidia.sh
case "" in
hibernate|suspend)
# this is called when going to hibernate or to sleep
;;
resume|thaw)
# this is called when waking up
/usr/local/bin/mbp_power
;;
esac
+ Make sure every thing is executable
chmod +x /usr/local/bin/mbp_power
chmod +x /etc/pm/sleep.d/10_disable_nvidia.sh
mbp_power.c:
// compile:
// sudo gcc -O2 -o /usr/local/bin/mbp_power mbp_power.c
#include <stdio.h>
#include <sys/io.h>
#define PORT_SWITCH_DISPLAY 0x710
#define PORT_SWITCH_SELECT 0x728
#define PORT_SWITCH_DDC 0x740
#define PORT_DISCRETE_POWER 0x750
static int gmux_switch_to_igd()
{
outb(1, PORT_SWITCH_SELECT);
outb(2, PORT_SWITCH_DISPLAY);
outb(2, PORT_SWITCH_DDC);
return 0;
}
static void mbp_gpu_power(int state)
{
outb(state, PORT_DISCRETE_POWER);
}
static void mb_gpu_print()
{
printf("SELECT: %hhu\n", inb(PORT_SWITCH_SELECT));
printf("DISPLAY: %hhu\n", inb(PORT_SWITCH_DISPLAY));
printf("DDC: %hhu\n", inb(PORT_SWITCH_DDC));
printf("POWER: %hhu\n", inb(PORT_DISCRETE_POWER));
}
int main(int argc, char **argv)
{
if (iopl(3) < 0) {
perror ("No IO permissions");
return 1;
}
int state=0;
if (argc > 1) state = atoi(argv[1]);
printf("Before:\n");
mb_gpu_print();
mbp_gpu_power(state);
gmux_switch_to_igd();
printf("After:\n");
mb_gpu_print();
return 0;
}
Prova na seguinte foto: