# [SOLVED] Boot issues on Asus Zenbook UX303U (Sky Lake)

## shimitar

Hi all!

i own this amazing piece of hardware, and i am going gentoo-only on it. But i am having some issues with booting.

Hardware background:

```

WillyPC ~ # lspci

00:00.0 Host bridge: Intel Corporation Sky Lake Host Bridge/DRAM Registers (rev 08)

00:02.0 VGA compatible controller: Intel Corporation Sky Lake Integrated Graphics (rev 07)

00:04.0 Signal processing controller: Intel Corporation Device 1903 (rev 08)

00:14.0 USB controller: Intel Corporation Device 9d2f (rev 21)

00:14.2 Signal processing controller: Intel Corporation Device 9d31 (rev 21)

00:16.0 Communication controller: Intel Corporation Device 9d3a (rev 21)

00:17.0 SATA controller: Intel Corporation Device 9d03 (rev 21)

00:1c.0 PCI bridge: Intel Corporation Device 9d10 (rev f1)

00:1c.5 PCI bridge: Intel Corporation Device 9d15 (rev f1)

00:1f.0 ISA bridge: Intel Corporation Device 9d48 (rev 21)

00:1f.2 Memory controller: Intel Corporation Device 9d21 (rev 21)

00:1f.3 Audio device: Intel Corporation Device 9d70 (rev 21)

00:1f.4 SMBus: Intel Corporation Device 9d23 (rev 21)

01:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940M] (rev a2)

02:00.0 Network controller: Intel Corporation Wireless 7265 (rev 59)

```

Of course, it's UEFI based. I have installed Grub2 and boot in pure UEFI mode with only grub and Gentoo Linux.

It has an Intel video card and the NVIDIA 3D adapter. I don't care for the NVIDIA adapter, the intel is more than what i need.

I have configured X with only the Intel card, no NVIDIA or NOUVEAU drivers.

Now, i have installed a fully blown Plasma environment which works great.... when it boots, it works great. 

But it does boot only once in five tries, more or less.

I tried a few kernels... with similar results. Using latest Genkernel, just a few manual tweaks (like ZRAM).

I am using gentoo-sources.

Kernel 4.4.6 (latest stable) usually takes up to five/six boots. Most of the boots it shows Grub2 (EFI), then load the kernel, then i can see some normal boot text output until the screen goes blank and a hard reset (4sec power button) is required. Sometimes, it get stuck on "waiting for uevents to be processed", still requiring a hard reset. Then suddenly it will properly boot my amazing Plasma Desktop.

Unstable kernels, i tested a few until 4.6.0, usually just get stuck a few times at "waiting for uevents to be processed" until they (around 3/4 reboots) just boot to the same amazing Plasma Desktop  :Smile: . With unstable kernels i never get the blank screen.

To get the Intel work at all i had to enable "CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT=y" (Enable preliminary support for prerelease Intel hardware by default).

Once it boots, it works great, i can play 3D games, play music, everything works. When it works, it does not matter much which kernel, they all work great.

What should i try? I tried to play with boot options like:

```

GRUB_CMDLINE_LINUX_DEFAULT="root=/dev/sda2 rootfstype=ext4 acpi_osi= pcie_aspm=force"

# acpi_osi= pcie_aspm=force drm.vblankoffdelay=1 i915.semaphores=1 nmi_watchdog=0"

# acpi_osi= acpi_backlight=intel"

# pcie_aspm=force acpi_osi=linux acpi_backlight=vendor"

# acpi_backlight=vendor acpi_osi=

```

But nothing really seems to change anything.

(on a side note, while screen dimming works, the keyboard dimming keys don't and also the keyboard backlight does NOT work)

Please give some advice... i am a fed up of never turning it off!

 :Smile: 

----------

## asturm

With hardware like that, you want nothing but the latest available (not stable in Gentoo) kernel, mesa and xf86-video-intel. Also, Skylake needs firmware to work properly, lack of which is probably the reason for your startup issues. => linux-firmware is the name of the package, again you want nothing but latest available in tree.

----------

## shimitar

Very well,

i am now emerging my updates with these accept_keywords:

```

sys-kernel/gentoo-sources ~amd64

sys-kernel/linux-firmware ~amd64

sys-kernel/genkernel ~amd64

x11-drivers/xf86-video-intel ~amd64

media-libs/mesa ~amd64

=x11-libs/libdrm-2.4.68 ~amd64

=sys-devel/llvm-3.8.0-r2 ~amd64

=x11-base/xorg-server-1.18.3 ~amd64

=x11-base/xorg-drivers-1.18-r1 ~amd64

x11-drivers/xf86-input-evdev ~amd64

```

Anything else i should be on bleeding edge? Is genkernel the way to go or should i try to manually configure the kernel (long and painful... i remember the good old days of the 2.4 serie!)

Let's see what happens...

----------

## shimitar

Well, after a bit of testing, i can say that with the unstable packages things are a bit better. Now it boots to a working X setup with a 1:2 ration: one successful boot every two failed. 

This is an improvement over the 1:4 or 1:5 ratio!

Still not perfect...

Would try a vanilla kernel help? What would i lose over a gentoo-sources kernel?

----------

## khayyam

shimitar ...

the "waiting for uevents" message is likely the result of firmware loading ... perhaps dmesg will show specifically what {e,}udev is having issues with.

As for the screen blanking at boot, it may not be hung, inteldrmfb (IME ... though not with skylake) can have issues when switching framebuffers (I assume you have simplefb, or efifb, also enabled), as KMS doesn't play nice with other framebuffers. If you pastebin your .config I can suggest some things to try (no guarentee it will work however).

best ... khay

----------

## shimitar

Sorry for the delay... just come back home.

Here it is:

http://pastebin.com/z3BSZyZt

Any suggestion is hghly appreciated!

... when waiting for uevents, the PC is just blocked. Only an hard reset (4sec power button) helps ...

----------

## khayyam

 *shimitar wrote:*   

> http://pastebin.com/z3BSZyZt

 

shimitar ... this is somewhat outside of my area, but the fact you have hybrid graphics probably suggests you should be using vga_switcheroo (which I see enabled in the above, but nothing enabled for nvidia), from the little I know vga_switcheroo is required to power-off the nvidia card.

As for i915/inteldrmfb it doesn't play well with other framebuffers so having FB_CIRRUS, FB_VESA, etc, enabled is probably the cause of the screen blanking.

Please try the following:

CONFIG_DRM_I915=y

CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT=y

CONFIG_DRM_I915_USERPTR=y

CONFIG_DRM_PANEL=y

CONFIG_DRM_BRIDGE=y

CONFIG_FB=y

CONFIG_FB_CIRRUS=n

CONFIG_FB_VGA16=n

CONFIG_FB_VESA=n

CONFIG_FB_EFI=n

Not sure about CONFIG_FB_VIRTUAL it may be enabled by VGA_SWITCHEROO, I'm not sure. If you can disable it then you probably should.

For firmware I'm assuming you have the linux-firmware package installed, and as the above i915 is builtin then you would need to provide whatever firmware skylake requires in CONFIG_EXTRA_FIRMWARE. Doing this should prevent {e,}udev from loading the driver, and so firmware.

 *shimitar wrote:*   

> ... when waiting for uevents, the PC is just blocked. Only an hard reset (4sec power button) helps ...

 

Not sure what you mean by "blocked", but udev is started at the sysinit stage, so the system isn't properly brought up yet.

HTH & best ... khay

----------

## shimitar

I applied the changes you where pointing out, and indeed it is starting now 100% of times... which is good. Thank you. I guess the FB issue was the real culprit here...

At this point, what i cannot get working properly is only the keyboard backlight... do you have any insight on it?

----------

## khayyam

 *shimitar wrote:*   

> I applied the changes you where pointing out, and indeed it is starting now 100% of times... which is good. Thank you. I guess the FB issue was the real culprit here...

 

shimitar ... ok, good & you're welcome.

 *shimitar wrote:*   

> At this point, what i cannot get working properly is only the keyboard backlight... do you have any insight on it?

 

If you are using > 3.13 you might try adding 'video.use_native_backlight=1' to your kernel parameters. Also, what are you doing to adjust the backlight? You probably need something like the following:

```
#!/bin/sh

backlight_sys_dir="/sys/class/backlight/intel_backlight"

read -r max_brightness < "${backlight_sys_dir}/max_brightness"

read -r curr_brightness < "${backlight_sys_dir}/brightness"

case "$1" in

      up) increment="+ 10" ;;

    down) increment="- 10" ;;

       *) exit 1 ;;

esac 

new_brightness=$(($curr_brightness $increment))

if $((new_brightness < 1)) || $((new_brightness > $max_brightness)); then

    exit 1

else

    echo "$new_brightness" > ${backlight_sys_dir}/brightness 

fi
```

```
case "$group" in

[...]

   video)

      case "$action" in 

         brightnessup)

            /etc/acpi/actions/backlight.sh up

            ;;

         brightnessdown) 

            /etc/acpi/actions/backlight.sh down

            ;;

         *)

            log_unhandled $*

            ;;

      esac

        ;;
```

... I say "probably" as I don't use anything other than acpid, if you are using a DE then there is probably some mechanism for this.

HTH & best ... khay

----------

## shimitar

This is for the screen brightness... That works... albeit the special keys do not work... i had remapped them to CTRL+F5 and F6. Having the special keys work would also be nice, but not essential.

Instead, i am talking of the KEYBOARD backlight... the light which illuminates the keys...

----------

## khayyam

 *shimitar wrote:*   

> This is for the screen brightness... That works... albeit the special keys do not work... i had remapped them to CTRL+F5 and F6. Having the special keys work would also be nice, but not essential.

 

shimitar ... couple of things, does your BIOS (or efi impilmentation) have an entry for 'fn' key? Does pressing 'fn' key along with media keys change the above behavior?

 *shimitar wrote:*   

> Instead, i am talking of the KEYBOARD backlight... the light which illuminates the keys...

 

I see ... no idea about that, but I would suspect there would also be a media key to toggle and/or increase/decrease ... again, try fn+key.

best ... khay

----------

## shimitar

The audio keys works (FN+ VolUP, DN, mute). Also sleep/hibernate works.

using xev, i can see that those keys do generate a keycode and an event. Instead, keyboard backlight and screen brightness do not generate any keycode or event, they are just dead (i mean, FN+key). 

I don't know in bios, i will check now

----------

## shimitar

After some research, it seems i need a kerneld river called "asus-nb-wmi", which seems to be present in the gentoo-sources 4.6.2 i am using, but i cannot find out HOW to build it!

The file is there (asus-nb-wmi.c), but i cannot find any way to make it appear in the menuconfig or in the config file at all!

do you have any idea?

----------

## fedeliallalinea

 *shimitar wrote:*   

> do you have any idea?

 

```
Device Drivers  ---> 

    [*]   X86 Platform Specific Device Drivers ---> 

        <M>   ASUS WMI Driver

        <M>     Asus Notebook WMI Driver (NEW)  

        < >     Eee PC WMI Driver (NEW)
```

----------

## shimitar

I do not have those options... my x86 driver page only have stuff on other brands, and a generic "asus laptop":

https://postimg.org/image/leijvg9kn/

Does it depend on some other option? How do i check kernel options dependencies?

----------

## fedeliallalinea

 *shimitar wrote:*   

> Does it depend on some other option? How do i check kernel options dependencies?

 

Dependecies of ASUS_WMI are

```
X86 [=y] && X86_PLATFORM_DEVICES [=y] && ACPI_WMI [=y] && INPUT [=y] && HWMON [=y] && BACKLIGHT_CLASS_DEVICE [=y] && (RFKILL [=y] || RFKILL [=y]=n) && HOTPLUG_PCI [=y] && (ACPI_VIDEO [=y] || ACPI_VIDEO [=y]=n)
```

----------

## shimitar

Thanks!!!

it was the hotplug missing... now i can see them.

Question: if the option is not available, how can i see it's dependencies??? They must be written somethwere in the kernel source files, but where?

I am recompiling now, will let you know if it works later on this night (i am remotely located at the moment).

----------

## fedeliallalinea

 *shimitar wrote:*   

> Question: if the option is not available, how can i see it's dependencies??? They must be written somethwere in the kernel source files, but where?

 

In menuconfig press '/' key and find, for example, ASUS_WMI you are able to see dependencies and location.

----------

## shimitar

Thank you!

yes, now it works great, and i can activate and dim the keyboard backlight too!

cool!

----------

