Debian buster vs GPU hybrid card

A simple solution but it works

The case

I was trying to record the screen and sound with a laptop Avell (Clevo in Brazil). This laptop has I5 processor, and a hybrid video card (intel and Nvidia 1050), with Pop!_OS Linux distro and Gnome. All was quite fine for while, but after install Kazam (it is a great Software) I could not run it. Why? Because the icon systray was removed from Gnome and the plugin Top icon did not work. Furthermore the shortcut did not work as well.

Pop!_OS (It is an amazing Distro) has no another official Desktop Environment, thus I decided to change to my preferred Distro: Debian. I tried Debian before but I had some issues (look here).

It was a rainy Saturday and a new opportunity to install Debian has been arrived. I had several issues, but in summary the problems were:

  1. Nouveau conflict;
  2. Nvidia driver;
  3. How to activate Nvidia GPU;
  4. How to return to Intel.

After 18 hours researching, reading, watching videos, trying, and 2 new installations, a solution was found. As a didactic content I will share the experience.

Solution

Almost all solution was on Debian Nvidia, Debian Optimus and Debian lightdm.

Nvidia Driver Installation

  1. Enable non-free repository /etc/apt/sources.list apt-get update
  • if after the login your system is freezing the problem is NOUVEAU, edit the files as follow:
  1. nano /etc/modprobe.d/blacklist.conf :
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
  1. nano /etc/default/grub and add the nouveau.modeset=0 part :
GRUB_CMDLINE_LINUX_DEFAULT="nouveau.modeset=0 quiet"
  1. nano /etc/modprobe.d/nouveau-kms.conf (if you have the file):
options nouveau modeset=0
GRUB_CMDLINE_LINUX_DEFAULT="nouveau.modeset=0 quiet"
  1. update grub and reboot
update-grub
reboot
  1. Install nvidia-detect utility by execution of the below command: apt -y install nvidia-detect
  2. Detect your Nvidia card model and suggested Nvidia driver. To do so execute the above installed nvidia-detect command: nvidia-detect
  3. As suggested install the recommended driver by the previous step: apt-get install nvidia-driver
  4. Reboot systemctl reboot

Configuration

Hybrid card: I tried Bumblebee, but NO SUCCESS!

Another attempt was xrandr, IT WORKS!.

  1. Ensure xrandr is installed and available: apt-get install x11-xserver-utils
  2. Modify or create (if one doesn’t exist) an xorg.conf under /etc/X11/xorg.conf; add the following:
Section "Module"
    Load "modesetting"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:X:Y:Z"
    Option "AllowEmptyInitialConfiguration"
EndSection

# Section "Device"
#     Identifier "intel"
#     Driver "modesetting"
#     BusID "PCI:X:Y:Z"
#     Option "AllowEmptyInitialConfiguration"
# EndSection

Where “BusID” X:Y:Z are the shortened/truncated numbers from the ID gathered above. For example, if the output of lspci -nnk | grep -i 'VGA|3d' displayed a PCI ID of 09:00.0, the BusID entry would read: BusID “09:00:0”

  1. Add/create a custom script, /usr/local/bin/switch_nvidia.sh:
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
xrandr --dpi 96
  1. Make the script executable: chmod +x /usr/local/bin/switch_nvidia.sh

  2. Configure your desired display manager to use a setup script during display setup. In my case was LightDM.

  3. Modify lightdm’s configuration and add (if one doesn’t already exist) a SeatDefaults section & script config. For Debian, lightdm config file is in /etc/lightdm/lightdm.conf

[SeatDefaults]
display-setup-script=/usr/local/bin/switch_nvidia.sh
  1. Update: systemctl restart lightdm.service

  2. Test: glxinfo | grep "OpenGL renderer" and glxgears and glxheads.

How to return to Intel Video Card

Go to step 2. and change the no comment lines Section "Device":

Section "Module"
    Load "modesetting"
EndSection

#Section "Device"
#    Identifier "nvidia"
#    Driver "nvidia"
#    BusID "PCI:X:Y:Z"
#    Option "AllowEmptyInitialConfiguration"
#EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "PCI:X:Y:Z"
    Option "AllowEmptyInitialConfiguration"
EndSection

After go to step 6. and comment the line with display-setup-script=/usr/local/bin/switch_nvidia.sh.

Repeat step 7.

References

 Share!

 
comments powered by Disqus