Zenbook UX501VW-FJ024T and xubuntu 15.10 (attempt 2)

2016-09-02

This is continued from http://qfox.nl/notes/176.

State of affairs:

Trying to properly setup xubuntu on a Zenbook UX501VW-FJ024T (2016 model). The zenbook has an intel and nvidia vga, 512gb ssd, 16g ram, and a QHD (4k) touch screen. It is a dual boot with win10. EUFI has been disabled, thanks to installing nvidia drivers in attempt 1 and I guess that doesn't re-enable UEFI. I'm not too bothered with that right now.

(TLDR: for conclusion on how to do this read this post. Below are notes from a failed attempt.)

Install


Regular default installation. No drive encryption. Note that secure boot is off because nvidia disabled it in the previous attempt. And apparently it doesn't re-enable itself (in fact, I've not found an obvious way to re-enable it... weird).

Set the screen resolution to HD (1920x1080) so you don't squint your eyes too much.

First install all pending updates, like the good computer owner we are. Reboot.

Nvidia


We've learned some lessons so let's first install nvidia properly.

Go to settings - additional drivers. First go to the left-most tab ("ubuntu software"). Select "main server" instead of "server for <your country here>". Then back to additional drivers and set nvidia. I picked the tested version ("352.63 from nvidia-352 proprietary, tested"). And it doesn't work. Wat...?

When I close the modal it tells me the update list needs to be updated. Okay that makes sense since I changed the source to main. So when I reopen the additional drivers and select nvidia, it now does work. You'll know it works when you see a progress bar for more than one second. Actually more like a minute. And of course the selected driver won't pop back to nouveau.

Resisting the temptation to select the microcode thing at the same time and just reboot first. Let's not jinx the two messing each other up.

After reboot the main difference to notice is on the login screen; before you would see the xfce mouse briefly before a flash appears and it would disappear (show a "blank" background, no image). Now it keeps the mouse and it looks like a fade-in effect. Okay, that's something at least.

And ermahgerd... There's actually an nvidia setting in settings now! And it lists my gpu! This. Is. Progress!

I can switch between the two gpu's (intel/nvidia) and whatever from the nvidia panel.

Note that nvidia-detector (with and without sudo) still won't detect the card from cli. A little surprising but I guess I'm not too bothered with that right now.

When I do lspci -nnk I can see that the 3d controller uses the nvidia kernel driver. The vga controller still uses i915, though. A mystical beast that seems to spur some troubles for me but I can't seem to do much about it at the moment. In case you're in doubt, the "i951" refers to the intel card in this machine.

Kernel 4.6


I still want to try and upgrade the kernel. Having seen nvidia complain about 4.7 in attemp 1, I'm going to try and install 4.6. The difference now is that I'm going to try to add this line (i915.preliminary_hw_support=1) in its grub.

So download the right files from this repo:

Code:
linux-headers-4.6.0-040600_4.6.0-040600.201606100558_all.deb
linux-headers-4.6.0-040600-generic_4.6.0-040600.201606100558_amd64.deb
linux-image-4.6.0-040600-generic_4.6.0-040600.201606100558_amd64.deb

And then running sudo dpkg -i *.deb on them. Reboot. ... And no. Even less than before. I just get two lines:

Code:
[sda] No caching mode page found
[sda] Assuming drive cache: write through
... (waits 30s or so)
Gave up waiting for root device. Comon problems:
- Boot args (cat /proc/cmdline)
- check rootdelay= (did the system wait long enough?)
- Check root= (did the system wait for the right device?)
- Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/disk/by-uuid/xxxUUID does not exist. Dropping to a shell!

(initramfs)

Crap.

Is it trying to boot from the windows drive? Remember; this is dual boot. GRmbl I don't know. Let's try to remove the line and see if we get different errors. If so, we can at least rule out the intel vga for now. Well it's no guarantee but baby steps. Ah wait it still had quite splash so let's remove that too. Reboot.

Right now we see way more. I'm still dropped to a shell but that's no surprise now. But even without the line I see no problems in the log for as far as I can see it (but it's cut off so who knows).

16.04 with boot modifier


So then I had a brain fart. What about booting the 16.04.1 installer and modifying the grub before booting into it? You can press e to edit grub before it starts and adjust parameters that way. If we add i915.preliminary_hw_support=1 there, we may be able to progress!

And we did. It now proceeds beyond the problem where it usually gets stuck. But then before the UI popups up it gets stuck on two things. After waiting for it for three minutes, it times out and puts me in a regular shell. The login credentials for this are xubuntu for user and no password.

Okay... at least that's _some_ progress. It was stuck on two things; one was looking for the boot cd (... usb) and the other was something with the gpu. But the messages are cut off (somewhat ironically, on a 4k resolution) so I'm not sure how I can fix this, if at all.

So just to confirm this is indeed what I was looking for; start without modifying the line .... and indeed it won't boot. Okay, great! That's more progress. Maybe this way I can install 16.04 and get better compatibility! He says somewhat ironically.

Okay. Now to figure out how to start the installer with the special grub update. Because before I think it was just booting the "try me" thing. .. Actually, now that I'm editing the grub menu again I see it says setparams 'Install Xubuntu', so perhaps it was trying to load the installer anyways? Ah you first select the entry you'd like to load, then press e to edit that entry's grub params. Okay. Let's properly log whatever it was stuck on and google for a way through;

Code:
- A job is running for Detect the available GPUs and deal with any system changes (no limit)
- A job is running for Ubuntu live CD installer (2min30)

Turns out we can disable the gpumanager by simply adding nogpumanager to the grub line. LOW AND BEHOLD IT LOADS. Effin A.

Just to clarify; To get the installer to load I go into grub, move to the installer menu item, press e to edit the grub params, edit the linux boot params (that's the one with splash quiet). I remove the splash quiet bits and add i951.preliminary_support_hw=1 nogpumanager instead. Just as is, within the quotes. Press f10 to boot (ctrl+x doesn't work for me) and BOOM, we get the installer. The fans will kick in 100% but that's alright for the brief moment. Let's install 16.04 and see what happens! :D

AND THE TRACKPAD WORKS TOO. Victory upon victory woohoo.

Installing 16.04


After making it to the actual installer, see (final) steps above. I go through the regular steps. Download updates while installing, install third party drivers, ignore the secure boot part since that's already (permanently?) disabled anyways.

So what I've been doing so far is just delete the linux partitions when starting a new install. That way I can skip the annoying alternative partition steps which you get if it detects a previous xubuntu installation. Instead it'll just give you the default dual boot option, which is exactly what I want. So in windows, search for "disk". Select the "create and format disk partitions" thing (why can't you just call it by its name... sigh). Delete the right-most two partitions (for me that's 270G and 15G with no name or description) and reboot. Pray it didn't manage to install any updates, or get some coffee otherwise. Yeah I'll wait. You should now have four partitions; 260MB EFI, 190G NTFS (OS), 500MB recovery. Reboot back into the xubuntu installer.

Again, select the installer option and press e. Remove quite splash (although it's not relevant right now) and add i951.preliminary_support_hw=1 nogpumanager in its place. F10 to boot like that.

Shit. Now I get the live CD installer job waiting thing again. Well I certainly jinxed that but that must mean it's a bit of a fluke. So we can probably fluke it again. If only I could just store the grub settings to the usb easily. Oh well, typing it out over and over again is how you remember it best.

Hm, that's 5 times. According to this page, you can set the boot options permanently to the usb boot but when I tried to update-grub it just threw an error.

So getting a little tired of this game I decided to try the acpi_osi="Linux" approach. Just append this after the others (no need to escape here, we're not inside another string, that's only when editing /etc/default/grub!). And that worked. Maybe it was just a fluke but whatever, we back in! Quad copter mode activated!

- English
- Connect wifi
- download updates while installing, install third party, ignore secure boot
- Install alongside windows (first option)
- Amsterdam
- English (US) keyboard, NOT THE FRIGIN INTERNATIONAL ONE OMG
- require password, encrypt home folder
- get a beverage of your choice
- remember the time when installing your OS took at least an hour and you had no plethora of other devices to keep you busy in the mean time?
- about five minutes later, press enter to reboot
- press enter again to skip the "unplug your usb" message (doesn't affect my case)
- press enter a third time for the same reason

after reboot

- press escape to pick boot. you have to because the bios will have put windows back on number one (presumably because you just replaced the old linux boot thing). kind of annoying but it only happens once. in the blue menu, "enter setup" (or in grub, pick the last option) to go to bios. fix the boot order to linux first. save and exit.

Ok let's let it run, see what happens..... black screen. Okay, no biggie. Reboot, update grub temporarily with e. Initially I'm trying with just the i951 fix. That works but bumps me to a tty shell... shit :/

At least we can update the grub from cli now. Reboot after that to hopefully see what went wrong. Nope.

Update again, add the nogpumanager bit. Then I noticed that when doing sudo reboot -f that nmi watchdog complained about cpu being stuck for gpu-manager. Okay, that's clear then. Does that mean adding the nogpumanager bit should work? No. Gah. Wait a minute. It's trying to stop lightdm. Wtf... am I bumped to tty1 while X is loading in tty7? Reboot again. Ok no.

Looking at top I can see lightdm running. But there's no UI. What's going on there...

Let's update stuff first. Network stuff is loaded so I can do all the usual stuff. Pity the terminal is so small though.

Code:
sudo apt-get update
sudo apt-get upgrade

Still getting "possibly missing firmware /lib/firmware/i915/* for module i915_bpo" :/ That seems to be related to cpu. Great? Ignore.

Reboot.

Nope. I can see I've got a slightly newer kernel, but that's where it ends. Let's google for this problem, because it's kind of weird to be dropped to a shell without any obvious warning signs.

This old post suggests starting x startx, which just seems to crash teh system. Can't jump between terminals or anything.

Mehhh. Screw this. Start over.

Installing 16.04, again


I got the start job running crap again so the acpi_osi param did not fix anything. I just fluked it again. So we gotta try. Now I really want to try and setup grub on the boot usb so I don't have to change the params over and over and over again.

Took me about 10 attempts but it finally proceeded to the installer UI. I don't know what that startup job bullshit is all about but it's freaking annoying to have to type the long i951.prelimSADSARAEGADSa over and over again. I think there are ways to update grub on the usb to have that permanently, but they don't seem that trivial or straightforward. Why not, anyways. Oh linux.

This time I'm taking no chances and also doing the secure boot steps as well. It's not like it can be disabled further than off. I can't help but hope that skipping those steps were the reason I booted into tty1 instead of a DM.

Don't forget to update the grub settings at boot time to include the parameters or the system won't boot (splash screen will freeze).

At this point I'm thinking the nogpumanager is responsible for my boot into tty1. At the same time the boot will freeze if you leave it out. Damned if you do, damned if you don't. Okay, let's install some nvidia drivers through cli and hope for the best.

First we apt upgrade everything and reboot.

Edit grub to enable i951 and disable the gpu manager, for now. I'm going to try and install nvidia, and I'm going to install some the 4.6, 4.7, and 4.8 kernels and check whether they'll play nice. Annoying since I'll have to download everything through cli (lot's of typing) but I see no other way.

Actually, no, screw that. I have tools for that.

Code:
wget http://js.gd/32o
wget http://js.gd/32p
wget http://js.gd/32q
sudo dpkg -i linux-*.deb

These are the three 4.6 kernel images you'll need (but hey, don't take my word for it). Oh and yes, the js.gd domain is mine.

Oh that's marvelous. The network just crapped out and I'm getting cpu stuck messages. Well I've been getting those since the beginning and have been ignoring them. They are annoying though. What happened to the network :/ Rebooting to try again.

Black screen. Booting again. ... Booted into xubuntu! wtf. Each time with, I think, the same grub changes. Okay so at least gpu manager was not relevant. Now to make this stable...

Set resolution to HD (4k is getting old quickly). Open additional drivers. Set "download from" to "Main server". Close dialog to refresh list. Reopen additional drivers. I now only have one option for nvidia: 361.42 from nvidia-361 (proprietary, tested). And heck, let's install those microcode drivers as well and hope that ends the whole cpu stalling thing (microcode is special intel drivers for cpu).

Reboot, this time remove the nogpumanager thing because I think this is the one time where it's needed (that's just a guess though).

It worked! glxgears runs at 16,156 fps, that's not a typo (on my end); that's 16k fps. That probably maybe means that the gpu manager can be left alone now. I'm pretty sure I'll still need the i951 param so I'll leave that in for all eternity. What a train wreck.

I gotta be honest; it doesn't feel safe to reboot yet. I don't understand why it suddenly went ahead to boot into linux. But it seems to be stable now in this regard.

Note that after some testing, kernel 4.5.7 seems to be the latest which you can use with "stock" nvidia drivers. In that, glxgears runs at 16k fps. Beyond that I only get 60 fps (screen freq) which indicates nvidia isn't running. You'll also get warnings and errors if you try to compile newer kernels, anyways.

Further setup


It's complaining about a missing theme. Xfce is quite limited in this regard. I normally don't care much about that but in this case the default themes are a little crappy. In fact, installing new themes can easily be dubbed a quite archaic task.

Actually, turns out the ~/.cache is owned by root. Kind of weird because I'm pretty sure it's supposed to be the main user, but whatever. That's where the theme error is coming from; permission denied. So we can fix that easily;

Code:
sudo chown -R myuser .cache
sudo chgrp -R myuser .cache

I think I could also just delete ~/.cache but I don't think that's necessary. No more theme error after the reboot. No artifacts. Okay!

What works


Let's make a new overview of what works and what doesn't work.

The trackpad works. Becoming annoyed by it already. The trackpad toggle button still doesn't work. So I'll have to figure out a different route of toggling that thing. I've seen many complaints about multi-touch support and indeed, it's ignoring multi-touch as gestures.

Suspend (f1) still works, still with a slight delay.
Airplane mode (f2) doesn't appear to work.
Keyboard backlight (f3 f4) works.
Screen backlight (f5 f6) doesn't work. The buttons, that is.
Screen off/on (f7) doesn't work.
Screen config (f8) works, pops up display settings.
Trackpad toggle (f9) doesn't work.
Mute, sound up/down (f10 f11 f12) work.
Calc (keypad enter) works.
I'm assuming the other not-that-special keys work too.

Nvidia works, now that I know how to properly install the drivers.

Due to setting the resolution to HD the mouse is super big. This can be magically fixed by clicking on the theme configurator (in settings) and pressing apply. I think that fixes it but it's popped back to super size at least once. There's no explicit cursor size to configure either.

grub resolution


Heh, a bit late to the party. But you can set the resolution used by grub. Well, a bit anyways. We can't use 4k but until the drivers are loaded we can at least use 1280x1024. It seems that is the biggest resolution standardly supported. There are ways to detect actual supported grub resolutions but they don't work for me. I can't run video-info in grub console because it complains about secure boot (ugh) and the hwinfo --framebuffer thing returns nothing for me. So I just set it to 1280x1024. That works but only until the drivers are loaded after which we go back to 4k tiny vision. At this point I don't even want to spend more time on that part, actually.

lightdm resolution


While not a huge problem, I also tried to set the lightdm (that's the login bit) resolution, since that's still 4k. Only after logging in will it apply your, apparently user level, resolution. Kind of sucks, and to make matters worse there's no easy way of setting it up for the login screen because lightdm simply doesn't have the option. There are hacks with xrander, like putting this in /etc/lightdm/lightdm.conf

Code:
[SeatDefaults]
session-setup-script=xrandr --output eDP1 --mode 1920x1080

but I couldn't get them to work (error code 1 when xrandr executed it). I'm putting it on some driver loading race condition. That or my assumption is flawed and it's not actually sending parameters as I'm expecting it to. It's not super important, anyways. Just a bit ugly and annoying to have the resolution flip-flop all the time.

Multitouch


The touchpad works now but only for one finger stuff (so point, click, drag, but not scroll). This is a common issue and I believe it's fixable. Some people reported it fixed, but at least on 4.5.7 (currently the last kernel that's still supported by nvidia drivers) the multi-touch doesn't work.STek Co

Note that the touchpad identifies as FTE1001:00 0B05:0101 for me when running xinput.

There appears to be a magical fix but when running it it crapped out because I'm not on kernel 4.6 so I can't confirm whether it works. Of course. This both for the v6 at the top and v7 at the bottom of this post. I'm guessing kernel mismatch but I'm not sure.

There are config-only instructions for the elan tech touchpad but they don't work. This also isn't a FocalTech, nor a FrontLine. It appears to just be an Asus, but that is still yet to be confirmed at the time of writing. I tried putting them in /usr/share/X11/xorg.conf.d/50-vmmouse.conf since that's the new way of doing xorg.conf but I'm not sure where to put the ServerLayout part. Not in that file at least because when I do I boot straight into tty1. So this solution didn't work for me either (but it was intended for a Samsung anyways).

This solution of setting i8042.reset in grub also didn't work.

Same for this one; setting i8042.nopnp in grub. But perhaps i8042 is something I should dig deeper into. Maybe there is a grub mode that bumps it to work? That's be sweet...

We can see in the source file (at least some of) the options for i8042. However, it says "i8042 keyboard and mouse controller driver for Linux" which may mean it's not what I'm looking for. Moving on.

This fix adding options psmouse proto=exps to /etc/modprobe.d/psmouse.conf (then sudo modprobe psmouse or reboot) also didn't work. And I don't have a touchpad tab nor any of the mentioned options to set.

This fix of doing echo 1 > /sys/devices/platform/i8042/serio4/reg_07 (as root; sudo -i) was impossible as serio4 didn't exist. And even root wasn't allowed to echo to serio0/reg_07 (because who knows) so I bailed.

Backlight fn keys


Short hiatus!

While reading through the comments on this (great) resource I noticed somebody saying the backlight was fixed by acpi_osi= acpi_backlight=native to grub. So I tried this AND IT WORKED. Wow... Further testing showed that the backlight part wasn't required for this.

So hold on, what does actually do. Well this led to "Linux Kernel Boot Parameters" which explains that it's to report OS support to the bios; "Modify list of supported OS interface strings". We basically set that list to empty. Can we perhaps exclude something from this list instead, such that it still works but we don't completely clobber the value?

As an aside, that list also explains that acpi_backlight can be "vendor" or "video". So I tried doing those on their own first. Neither seemed to work for this, either. Such sadness.

I tried with acpi_osi="Linux" but that doesn't work. I tried acpi_osi="!Windows 2000" and acpi_osi="!Windows 2012", which was also suggested somewhere else, but that (still) doesn't work either. I couldn't get the keys to function with any value.

I can't say yet if anything breaks by forcing this mode... but I can tell you this doesn't fix the brightness itself. The keys function but for some reason the brightness doesn't change. One step forward... Turns out THAT is why you need acpi_backlight=native! With those enabled the backlight works! :D Note that, for me at least, they only work once I log in

Okay, to recap. To make the backlight keys work, and the rest, properly update /etc/default/grub (needs root) and add this to the GRUB_CMDLINE_LINUX_DEFAULT line:

Code:
GRUB_CMDLINE_LINUX_DEFAULT="i951.preliminary_hw_support=1 acpi_osi= acpi_backlight=native"

(I don't use quiet/splash...) I did not need to quote native there. Then save and run sudo update-grub (that's important!) and reboot. I'm starting to think these boot params have the key to unlock all the things to run linux on this zenbook. Anyways. Let's continue with multi-touch on the touchpad!

Since those keys now worked (without anything in particular to backlights) I tried the other keys. The only "dead" fn keys without this fix were airplane mode, disable screen, and trackpad toggle. Turns out that the airplane mode toggle (f2) also works. But then later it turns out that it worked regardless of this setting so maybe I did something else to fix this. Wish I know what but I don't. But it works now... The screen toggle (f7) and trackpad toggle (f9) still don't work. Maybe screen toggle also requires an acpi param...?

For fn+f7: there's a tool called xev to debug various inputs.

Multi-touch, continued



Actually I'm coming to the conclusion that there's little to continue with, for now. It's simply unsupported right now. There's an active, current, bug about this. There are current as-in-yesterday replies of people reporting multi-touch problems. I just don't think I can wiggle my way through here.

That is kind of annoying, but I don't want to waste more time on this than I already need to. So I'm going to monitor that bug report, track the comments, and hope that a fix surfaces soon...