Tuesday, July 25, 2017

Fedora 26, High DPI Monitors, and nVidia Optimus

I spent most of yesterday attempting to upgrade my primary laptop, an MSI Stealth Pro GS63VR, from Fedora 25 to Fedora 26. This was my second attempt, as the first attempt ended in failure, due to my inability to get graphics working with any server beyond VESA/framebuffer mode.

First, I cleaned off the drive, and did a new initial installation of Fedora 26, and applied all updates. To get the installer to not freeze my laptop, I had to install in failback video mode. Once the laptop was installed and patched, I then proceeded to troubleshoot the issues that prevented me from getting either Nouveau or nVidia Xorg drivers working.  After quite a bit of trial and error, I determined that there are several main issues.  First, on Fedora 25, I had just ignored the Intel component of nVidia Optimus, and just installed the closed-source nVidia driver.  That seems to no longer be possible, on my hardware, with Fedora 26.  Second, there is an ACPI issue, with a number of laptops based on EFI versions of the AMI BIOS.  Third, the default for Bumblebee (the open source Optimus solution) is to disable kernel modesetting, but for me, this breaks EDID.

So, here is the solution that I came up with, to install Bumblebee:
  1. Set the default for systemd to multi-user instead of graphical
    1. # systemctl set-default multi-user.target 
  2. Update Fedora 26 to -current
    1. # dnf update
  3. Reboot
  4. Follow Bumblebee docs from https://fedoraproject.org/wiki/Bumblebee 
    1. Check laptop graphics hardware
      1. $ lspci | grep VGA
      2. 00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
      3. 01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] (rev ff)
    2. Add the main Bumblebee repo
      1. # dnf -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora$(rpm -E %fedora)/noarch/bumblebee-release-1.2-1.noarch.rpm
    3. Add the Bumblebee managed nVidia repo
      1. # dnf -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora$(rpm -E %fedora)/noarch/bumblebee-nonfree-release-1.2-1.noarch.rpm
    4. Install the required Bumblebee packages (note that libglvnd-devel is needed, even though the docs don't mention it) 
      1. # dnf install bumblebee-nvidia bbswitch-dkms VirtualGL.x86_64 VirtualGL.i686 primus.x86_64 primus.i686 kernel-devel libglvnd-devel
    5. Reboot
After the system came up, I started Xorg with 'startx', and my laptop froze. After some sleuthing, I figured out that my laptop has an AMI BIOS, with a compatibility issue with bbswitch and Optimus, from the Troubleshooting section, in the Fedora Bumblebee docs:

To fix this issue:
  1. Add "splash acpi_osi=! acpi_osi='Windows 2009'", after "quiet" to the /etc/sysconfig/grub GRUB_CMDLINE_LINUX entry
  2. Rebuild grub2 config
    1. # grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
After rebooting, I started Xorg successfully, but I noticed that my MSI GS63VR 4k was running Xorg @ 800x600, but 3D acceleration worked.

To fix the resolution problem:

  1. Remove "nomodeset", from the /etc/sysconfig/grub GRUB_CMDLINE_LINUX entry. I got the suggestion to remove "nomodeset" from https://forums.linuxmint.com/viewtopic.php?t=216235#p1131177
  2. Rebuild grub2 config
    1. # grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
  3. After this, everything worked in 4k, as espected, so I set the default target to graphical, again
    1. # systemctl set-default graphical.target
Comments and suggestions are welcome!