Skip to content

Set up Arch Linux with Bumblebee, X11, Wayland and Kernel Parameters on the ASUS UX501VW

Note: Wayland has solved most of the issues in this blog post by now. I now use Wayland as my daily driver, and suggest you do too. Still I will leave this up as a reference to whoever may need it.

Intro

In this article, we will be setting up an ASUS UX501VW as a daily driver running Arch Linux and attempting to take full advantage of all the fancy new (as of Sept 2016) hardware and get optimal system stability and performance.

Prologue

The ASUS UX501VW Zenbook is a great little notebook that comes with a 15.6″ 3840×2160 IPS UHD monitor, an Intel Skylake i7-6700HQ 2.6GHz processor, a GTX 960M graphics card with 2GB GDDR5 VRAM, 16GB DDR4 2133 MHz SDRAM, and a fast 512GB NVMe SSD HD.

Getting all that to work under Arch Linux requires a bit of config. I assume you’ve already installed the base system using 2016.09 or newer with GDM and GNOME 3. Arch now uses the Wayland backend for GNOME by default, but you can also log in to Gnome using the Xorg backend by clicking the gear icon next to the login button and selecting the X11 Gnome shell.

While I understand that Wayland is the future, unfortunately it is still missing some key features, which makes it necessary to switch back to X11 for a couple of important use cases:

Thus, in order to get maximum functionality out of our install, we can’t forget about Xorg just yet.

Install video drivers and bumblebee

This laptop comes with two video cards: the integrated Intel graphics, and the standalone NVIDIA card. In order to conserve power, it’s ideal to use the Intel graphics for everyday use and only whip out the NVIDIA when we need 3D heavy-lifting. On Windows, we can use NVIDIA Optimus technology to handle that. For Linux, there is Bumblebee. Installing it on Arch is relatively simple:

pacman -Syu bumblebee primus lib32-primus bbswitch mesa mesa-libgl nvidia lib32-virtualgl lib32-nvidia-utils lib32-mesa-libgl nvdock-bumblebee

Also, make sure xf86-video-intel and lib32-nvidia-libgl are not installed.

  • The linux-headers package will be needed by the KMS system.
  • nvdock-bumblebee[AUR] package gives you a dockable NVIDIA control panel that works through Bumblebee.

Next make sure your user is added to the bumblebee group:

gpasswd -a user bumblebee

Edit the /etc/bumblebee/bumblebee.conf file and make sure these lines are present:

VirtualDisplay=:8
Driver=nvidia
Bridge=primus
KernelDriver=nvidia
PMMethod=bbswitch

Finally, enable the bumblebeed.service.

Intel Config

As I mentioned above, make sure the xf86-video-intel package is not installed. The reasoning behind this is that the package is really on its last limb, and you can get all its functionality and more out of the xf86-video-modesetting subpackage of Xorg. You can see more here at this reddit post.

In order to get this to work, you need to make sure to rename or remove any /etc/X11/xorg.conf or /etc/X11/xorg.conf.d/20-intel.conf files. Having these files present may prevent Xorg from loading (but not Wayland). Intel graphics autoconfigure under Xorg, so there is no need for those config files.

Kernel Config

The next thing to do is set up your initramfs and configure your bootloader. Your /boot/loader/entries/arch.conf file should look like this:

title           Arch Linux
linux           /vmlinuz-linux
initrd          /intel-ucode.img
initrd          /initramfs-linux.img
options         acpi_osi=! acpi_osi="Windows 2009" acpi_backlight=native cryptdevice=UUID=e71f0dee-d09e-4832-af71-1d0e0562bd30:lvm i915.enable_execlists=0 intel_iommu=on resume=/dev/mapper/vg-cryptswap root=/dev/mapper/vg-cryptroot quiet rw

A couple notes about this:

I load Intel microcode updates using this line. Note that you must install the intel-ucode package as described above for this to work.

initrd          /intel-ucode.img

Going through the options in order, these kernel parameters:

acpi_osi=! acpi_osi="Windows 2009" acpi_backlight=native

are critical for preventing Xorg from randomly locking up. Note: if you put acpi_osi=, your computer will crash on boot.

These kernel parameters:

cryptdevice=UUID=e71f0dee-d09e-4832-af71-1d0e0562bd30:lvm (...) resume=/dev/mapper/vg-cryptswap root=/dev/mapper/vg-cryptroot quiet rw

Are necessary for my whole-drive encryption. If you are using LVM-on-LUKS drive encryption, you should have similar settings in your loader. Otherwise you can safely ignore them.

i915.enable_execlists=0 is critical for preventing Xorg lockups on startup.

intel_iommu=on turns on IOMMU capability for PCI passthough. It is not necessary for this tutorial and can be ignored.

Initramfs Config

Your /etc/mkinitcpio.conf file should contain the following lines:

MODULES="i915 nvidia nvidia_modeset nvidia_uvm nvidia_drm"

HOOKS="base udev autodetect modconf block encrypt lvm2 resume filesystems keyboard fsck"

Once those lines are in place, you can now create your new initramfs with the command (assuming you are using the default linux kernel):

sudo mkinitcpio -p linux

Now reboot. When you log in, you will have a fully functional Bumblebee setup on Gnome using either Xorg or Wayland backends. If you want to use your NVIDIA card to run a graphics-intensive application or a game, just run

optirun $application_name

replacing $application_name with the name of the executable. Thanks to Bumblebee, the remainder of the time the NVIDIA card will be switched off and your laptop will use the integrated Intel graphics to save power.

Have fun! If you have any questions, please leave them in the comments.

Published inTutorials