Friday 22 May 2015

Linux graphics on Gigabyte Brix i7 5500

I've been installing and running Linux on sooooo many computers for years and it hasn't been a problem for sooooo many years. I thought it was easy now :-(. The Gigabyte Brix GB-BXi7H-5500 has got me. (But in the end I won). The problem is crazy graphics display when trying to use any of the desktop live installs, making Linux apparently un-installable.

It only has HDMI output and mini DisplayPort. I started with Ubuntu 14.04. Ho hum, the HDMI driver didn't work and I just got garbage on the screen DURING THE INSTALL PROCESS. Same with some other distros: if they wanted to use graphics with the HDMI card then I couldn't get going. And most distros want graphics. Don't confuse this with GUI options once you have a distro installed: all distros will allow a runtime non-GUI interface. I needed one at the INSTALL stage!

So, a server only distro might give that. I tried copying servers to a USB stick using unetbootin which previously has worked great. But I tried Ubuntu server and Fedora server and bizarrely neither of them worked: they kept failing to find necessary pkg files from the download servers. Eventually I got Ubuntu server to install - I guess the crappy Australian internet caused timeouts previously.

Booting off a USB stick wasn't fun. You have to turn off UEFI security in the BIOS boot menu (keep bashing the Del key on bootup to get to it). Even then, in the Boot Selection menu it only showed the USB stick as a UEFI boot, and that wouldn't boot. But in the Save and Exit menu it does show as both UEFI and non-UEFI boot. Choose the non-UEFI option.

For partitioning the hard disk, the default do-it-all-for-you only gives 8Gb for the root partition. That includes /var and /tmp so is ridiculously small. I prefer to set the disk partitions myself, giving 30Gb to root.

Then you can install the server - almost. Eventually you get to the Install Grub to a Disk. If you try it, it will fail trying to write to your USB stick on /dev/sda instead of your hard disk /dev/sdb :-(. If you don't try it, the grub packages won't be installed which will cause problems later. Either way, you have to end up selecting Don't install a boot loader.

Without a boot loader, the new server won't boot of course! Instead, using the USB again you need to get into Rescue mode. That sets keyboards and locations, downloads a base system, etc. Eventually you will get asked to drop into a shell prompt. Choose one for your hard disk's root partition. If you tried and failed to install grub to your boot sector then at least the grub package will be there. Otherwise you have to download and install the grub package - see next para.

apt-get is what you use to download packages. It requires networking to be okay. In rescue mode the resolve file /etc/resolv.conf is empty. It links to a non-existent file, so remove it first. Then you can edit it to add
(Google's nameserver) or similar. Then you can run
    apt-get install grub

Once the grub package is there, install it by
   grub-install /dev/sdb
(assuming your target hard disk is currently mounted as /dev/sdb).

So now I have a server system installed. To see if X worked, I ran
   sudo apt-get install xinit
and yes, it did. You can start X by
and it will run a single xterm. I then installed Tom's Window Manager twm. It's really basic but that's okay. I can run that from within my xterm to give me some control. i had to edit my .xinitrc to include
   xterm &
   twm    # synchronous!
Note that the display is still broken, but doing something really simple like this works (just).

So I got more ambitious and ran
   sudo apt-get install gnome-shell
That took over the login process and trashed my screen again, just like the install process. So there is my problem showing up.

By ctl-alt-F4 I can get into a terminal screen and check things out. I can run basic X, and it looks odd but something works. I installed Firefox but when I ran it, just a mess again - too complex for the problem case.

Maybe an up-to-date kernel. I downloaded kernel sources for 4.0.2 to another machine (no working browser on this one!) and copied it across. Built and installed it
   make install
   make modules_install
and it wouldn't boot as it couldn't find my hard disk. Also needed
   update-initramfs -u
So it booted, but the problem with the display didn't go away. Kernel 4.0.2 wasn't the answer. Was it the monitor? No, worked okay with another computer (well, sort of okay - the mouse left tracks across the screen, but I've seen that problem elsewhere with the HDMI driver. Kernel 4.0.2 was not the solution.

With a working command-line Linux at least I can now find out things about the Gigabyte. The cpu is an Intel i7-5500U @ 2.4 Ghz (but I knew that already from the specs). The framebuffer is an inteldrmfb. The graphics driver is the Intel i915.

The site
seems to be all about Intel graphics drivers. From there I found the Graphics Installer 1.0.8 for Ubuntu* 14.10, 64-bit
The fun starts here again. It requires Ubuntu 14.10. The defaults on the Ubuntu site are 14.04 and 15.04 so you need Google to find the server 14.10. Then it installs just as described above. The graphics installer has to run under X and apart from a few glitchy effects is navigable. But once it gets going, lots of flashing lights, stray bolts of lightning, etc from the graphics card. I switched to another virtual terminal until it finished. But it made no difference - no usable X. Not a solution.

Time to look for bug reports. I found the bug "Graphics unstable on Ubuntu 14.04 and 14.10 using Intel HD Graphics 5500" at
Fix #36 starts the X server in UXA mode instead of the preferred SNA mode (no, I don't know what they are)

    try to create the following folder:
    sudo mkdir /etc/X11/xorg.conf.d/

    Then create inside the new folder a file named for example "20-intel.conf" with the following content:
      Section "Device"
         Identifier "Card0"
         Driver "Intel"
         Option "AccelMethod" "uxa"

    Then reboot and voila."

This works! Most of the time.  Fix #100 didn't work on Ubuntu 14.10 (unresolved packages) although reports were that it worked for 14.04. But the moderator for that bug said that my bug wasn't his bug and I should log a new one.

In the meantime I had logged bug 90401 at Comment #5 pointed me to the development site for the xf86 intel video driver

   Please test the Xorg ddx driver from [1] and report back.


I downloaded 2.99.917commit baec802b21... and so far that one is okay. To build it required installing packages autoconf, autogen, autoreconf, xutils-dev xorg-x11-server-devel, libtool, pkg-config. Then run
    make install
in the xf86-video-intel directory

This removes /usr/lib/xorg/modules.drivers/ and installs /usr/local/lib/xorg/modules.drivers/ So far I can run Big Buck Bunny, the test suite glmark2 (test result only scores 119) (I got info about this test from Benchmark graphics card (GPU) performance on Linux with glmark by Silver Moon), browsers with YouTube movies etc.

So finally X is working, but I only have the server install. Get the GUI desktop by
  sudo apt-get update
  sudo apt-get install ubuntu-desktop

This  gives the Unity desktop. I'm not a fan of Unity, so I usually install old-style gnome by
  sudo apt-get install gnome-session-fallback
and Compiz (for wobbly windows) by
  sudo apt-get install compiz

1) install Linux using a server package with a command-line install. 
2) Get the latest source version of xf86-video-intel, build and install it
3) X should now work if you want to test it by downloading e.g. xinit and twm
4) Install the desktop package ubuntu-desktop


1 comment:

  1. Win7 on my mother's Brix is about to end, so I was contemplating I could give Linux a shot again... Your article has spared me few gray hairs, not gonna play with that, Win10 it shall be.