Skip to content

Instantly share code, notes, and snippets.

@L-P
Last active September 1, 2016 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save L-P/50720e9166ac08408b15 to your computer and use it in GitHub Desktop.
Save L-P/50720e9166ac08408b15 to your computer and use it in GitHub Desktop.
Installing lubuntu 15.10 on an Asus K501UX laptop with UEFI/SecureBoot enabled.

Installing lubuntu 15.10 on an Asus K501UX laptop with UEFI/SecureBoot enabled.

When you first try to install lubuntu on an Asus K501UX, you will have a black screen and no clue about what is happening.
This is the situation I faced and this guide is the result of 5 hours of hair-pulling and cursing at various corporations including Asus, nvidia, Microsoft and even Canonical.

This guide will hold you hand until you can boot to the desktop. How to install the nvidia drivers is not included in this guide.

Following this guide will remove Windows entirely and install GNU/Linux instead. Don't follow this if you plan to dual-boot.

1. Booting on the liveUSB image

  1. Boot to the BIOS by pressing Escape after pressing power.
  2. Remove the Windows boot option.
  3. Disable FastBoot/SecureBoot.
  4. Enable CSM.
  5. Boot to the non-UEFI version of a lubuntu liveUSB for amd64.
    See the available downloads.

2. Installing lubuntu

  1. sudo swapoff -a
    Because of a blocking bug of "medium" importance dating back from 2013, see #1205397.
    This may not be needed if you don't create an encrypted swap partition. Better safe than sorry.

  2. Format /dev/sdb using gksudo gparted with a GPT partition table. This step will get rid of Windows.

  3. ubiquity --no-bootloader gtk_ui & disown
    ubiquity does not understand that we want to install the OS and its bootloader on the same disk (which happen to not be /dev/sda) so we have to skip this step entirely.

    It would not be able to setup UEFI/SecureBoot because we were not able to boot with it anyway.

    Funny thing, when ubiquity fails to install the bootloader it gives you the choice to skip the bootloader installation, install it another disk, or cancel the installation. Whatever you choose, pressing Ok does not do anything.

  4. When prompted for a custom disk configuration, create a 256 MiB biosgrub partition, a 512 MiB ext4 for /boot and an encrypted LUKS+ext4 partition for /.

  5. End the installation.

  6. Do not reboot.

3. Getting UEFI to work

  1. Using gksudo gparted set the boot flag for /dev/sdb1 and label it EFI.

    In GNU Parted, boot flag (not to be confused with legacy_boot flag) has different effect in MBR and GPT disk. In MBR disk, it marks the partition as active. In GPT disk, it changes the type code of the partition to EFI System Partition type. Parted has no flag to mark a partition as ESP in MBR disk (this can be done using fdisk though).

    See the arch wiki for more details.

  2. Install GRUB.

    sudo -s
    apt-get install grub-efi-amd64
    
    # /target should still be here as an installation leftover, if its not the
    # case just create it with mkdir.
    mount /dev/mapper/sdb3_crypt /target
    mount /dev/sdb2 /target/boot
    mkdir /target/boot/efi
    mount /dev/sdb1 /target/boot/efi
    
    grub-install --target=x86_64-efi --efi-directory=/target/boot/efi --root-directory=/target /dev/sdb
    
  3. Reboot to BIOS.

  4. Disable CSM.

  5. Enable FastBoot/SecureBoot.

  6. Add boot option with path set to \EFI\ubuntu\grubx64.efi and name to GRUB.

4. Booting to desktop

Here we disable the nouveau driver so we can actually boot to something.

  1. Boot into single user (or "recovery") mode.
    You might have to crash the boot a first time to access the GRUB menu. If you leave the shift key pressed when booting you might get lucky and get to GRUB first.
  2. mount -o remount,rw /dev/dm-0 /
  3. Add nouveau.nomodeset=0 to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub using your favorite editor (meaning, vim).
  4. echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
  5. echo "options nouveau modeset=0" > /etc/modprobe.d/nouveau-kms.conf
  6. update-initramfs -u && update-grub.
  7. Reboot to lubuntu, get a hoppy beverage and go on with your day.

5. Appendix: what works, what doesn't

What doesn't work:

  • Wifi switch (fn+F2). The laptop boots with the Wifi disabled by default. To enable it you have to put the laptop to sleep with fn+F1.
  • Headphone detection.
  • Touchpad. Waiting for #1521410 to be fixed.
    The mainline kernel 4.4.1-wily can be used in the meantime.
  • Screen brightness keys. Keyboard brightness keys work fine.

What works:

  • Wifi: 03:00.0 Network controller: Intel Corporation Wireless 7265 (rev 59) showing as wlp3s0.
  • Ethernet: 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 10) showing as enp2s0.
  • OpenGL/WebGL with a blacklisted nouveau. I don't know who's in charge of the rendering but it seems to work.
  • Sound: 00:1f.3 Audio device: Intel Corporation Device 9d70 (rev 21).
  • Touchpad: only left/right click. Edge and two-fingers scrolling do not work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment