Setting up linux with graphics on MSI laptops

What if I don’t have an MSI laptop? This guide is specifically about the MSI laptops I’ve had to deal with before, but you may find that the first part also applies somewhat in general to dealing with any machine who seems to crash when graphics come into the question. If you’re using a graphical installer like Ubuntu, this is usually easy to see as the kernel loading splash screen freezing at some point and refusing to progress. You can treat some parts of this as general advice, but some of it is more particular to MSI laptops.

I own an MSI GE62 QD. I started using Linux for most computing stuff about four years ago and keeping it running on this thing has been a federal goddamn issue. I’ve I’ve made a list of a few of the MSI specific bugs I had, although the first thing I’m going to talk about will actually apply to many different laptops.

If you’re reading this and you haven’t bought your laptop yet, don’t. MSI laptops do not play particularly well with Linux and you’d be much better off giving your money to someone else, ideally a linux-first manufacturer like System76 (their gaming laptops are pretty good) or at least someone like Dell or Lenovo who have moderately good track records with their machines. MSI provides zero support for machines without Windows so if you get the chance, don’t let that become a problem.

However, should you be in the situation of having already owned an MSI laptop and just wanting to run Linux on it, here’s some tips. You may not necessarily encounter all of these bugs, but you might encounter some. If you see some I haven’t got, let me know and I’ll add it in.

(This guide is written at something of a high level, in order to be usable across multiple distributions and machines.)

You can’t even run the installer.

This varies wildly from device to device and some people I know have had no issues here at all, but the most common issue is that the graphics cards used in MSI laptops just don’t play nice with Nouveau drivers. Since you’ve already bought an Intel/NVidia Power Couple laptop I’m assuming that you aren’t too strict on your “free software only” policy because that’s the only way I’ve ever solved this:

  1. Grab a no-GUI installer for your OS of choice, something like Ubuntu Server, the main Arch installer, or the Debian command line install option. This is crucial, because the moment the OS tries to load nouveau drivers on your system it will crash and you’ll be stuck. If your distribution’s primary way of being supplied is as a command line installer, then you’re in luck.

  2. Get a hold of a wired internet connection, unless you’re comfortable manually doing a wpa supplicant setup. Managing the very skittish Wi-Fi hardware built in to most MSI laptops sucks.

  3. Run through the installation process as normal, making sure that you establish some kind of internet connection at some point to ensure that you at least have the ability to get an IP address from your router once the install process is over. Work through the install as normal and reboot at the end.

  4. At this point you’ll have access to a plain TTY. If it’s throwing a bunch of annoying errors at you when you try to log in, go to the next section and come back here when you’ve fixed it.

  5. Once installation is finished, you’ll have a plain TTY available as your login. From here you need to very carefully ensure that you don’t accidentally install the wrong grahics drivers: Go on the Nvidia Drivers Site and look up your driver for linux. Note the version number listed. Check if your distro’s repositories carry the NVidia proprietary drivers. They’re in the Arch AUR under a handful of names such as nvidia-340xx, with nvidia being the most up to date one available, as well as in an Ubuntu PPA. Make sure you install the number that matches the listing from the NVidia driver download page, e.g. if you need to install 340.76, install from the nvidia-340xx package. If you can’t find it in your package manager, get the one from the NVidia site.

  6. Congratulations, you now have a graphics driver, and the worst of the storm is over. If you want to set up fancy switching graphics, I’ll write a second guide that covers the options available to you in that space. If you just want a basic running system with the power of your GPU at your disposal, continue here. If you set this up now you can always add switching graphics later, so don’t worry about it too much.

  7. You’ll now want to install some kind of graphics system. In my personal experience, KDE breaks the hell out of some MSI laptops and leaves others totally intact, so be wary. In any case, I’m going to use XFCE as the example here, substitute with your own favourite window manager/desktop environment/graphics wonderland experience. Go ahead and grab a display manager like lightdm or gdm from your package manager, and then install Xorg or Wayland or whatver and the desktop of your choice, e.g. sudo pacman -S xfce4-session. If you’re on something like Ubuntu, this may also pull in the “recommended” software. If you want this, leave it be, but you can pass apt the --no-install-recommends flag if you just want your package and the dependencies. If you reboot now, you’ll be greeted by a graphical login page of the display manager you chose, and you’ll be able to jump right in to your chosen desktop as normal. Huzzah.

  8. Oh no, where’s all my stuff. If you haven’t installed a terminal emulator or something, you may now be stuck. Press Ctrl-Alt-F1 to open a plain tty, login and install some applications via the command line before you continue, maybe. From here you’re basically back onto a normal graphical linux.

From here you have an always-on NVidia graphics card that will work just fine most of the time, and if you used your package manager, you’ll be get updates for drivers as they arrive. You can now install the network manager of your choice, or maybe use the one provided by your desktop, and you should be able to get Wi-Fi working. This is how I used my laptop for, uh, about a year, back when I was using Ubuntu. I’ll list a few other bugs and how to fix them below.

A bunch of garbage printed into the TTY when you’re trying to use it.

Sometimes the PCI cards with spit kernel errors into the TTY when you’re using it, which is rude. To disable it, you want to set the pci=nomsi flag in GRUB, because ~you wish this wasn’t an msi laptop~ it blanks out PCI errors that aren’t fatal from the screen. In order to fix it long enough to fix it forever, when the GRUB screen comes up on boot, press e to edit the boot parameters before booting, and add pci=nomsi to the line starting with linux in the boot commands. Log in, and then, using sudo, edit the /etc/default/grub file and append pci=nomsi to the GRUB_CMDLINE_LINUX_DEFAULT=... line. Save the file, run sudo update-grub and reboot, with the command line parameters now baked in to grub.

I cannot set the screen brightness at all what the hell

There’s all sorts of weird broken stuff to do with MSI’s display setup, and this is no exception. I recommend the wonderful and robust backlight program, light. Building it is simple and there are also binaries and packages available. Once it’s installed, use your window manager’s keybindings settings to tie brightness up/down to light -A 10 and light -U 10 as needed to step up/down in 10% increments

I paid for all these keyboard lights and they’re the most godawful red ever.

Fortunately for you, some kind souls have written configuration tools. I personally recommend Sayrus’s msi-keyboard, but there’s also a popular one by stevelacy with a nicer interface, although it will require installing node js. For some reason the keylights brightness bindings seem to work just fine, so uh. Yeah.

Once that’s all done, you’re basically back up to zero as far as setting up nvidia graphics goes. Sometimes the graphics gets a little screwed up because the graphics drivers for Linux are not the most stable things, but in general I’ve been working just fine on this. Like I said before, there is a way to get working siwtching graphics, but it’s, uh, a littl complicated, because there are several ways to handle it and none of them are good. I’ll write that soon, hopefully.