Doc /

Boot with UEFI - install Leap on an IT Works TW891

UEFI is the firmware one is most probably to find on new computers as of 2016 (and before), BIOS is dead as standalone. All the notes here are simplified for understanding question, you will easily find more detailed docs everywhere.

What is UEFI

"UEFI" is what we used to name "BIOS", or better "computer firmware", it's the part of the computer that exists on the mother board, made by the mother board maker. Users have very little capability to fix or modify this part, even if for now many years it's written on flash (rewritable) hardware. There are some efforts for free bios/uefi (I may not always capitalize these words), but not very advanced for what I know.

BIOS computers can't boot UEFI removable devices and vice-versa... but this is not always true. UEFI should always be 64 bits, but this is obviously wrong, as of 2016, many small tablet computers use 32 bits UEFI and 32 bits Windows (8, 8.1 or 10).

Any UEFI bootable medium have to have a special partition, formatted FAT 12/16/32, preferably 32, where reside some loaders, and assigned the partition number 1 in GPT and "ef" in msdos type partition. This partition may be named "ESP", that is EFI system partition.

Some UEFI firmware do not boot EFI partition if it's not the first one on the disk (/dev/sdX1). It's not in the standard, but there are as many UEFI version as computers...

Secure boot

UEFI is most of the time companion of "secureboot". Secure boot capable loader needs a "shim" file, signed by Microsoft. This is not free, but the fee is one time, the same file is used for every install, so if Windows have obviously a shim file, Ubuntu, Fedora, openSUSE have one, but Debian do not want one and many others don't care. So far any computer I have seen could disable secureboot and this is invisible for any pre-installed system. The added security is nearly none, so better deactivate this feature anyway.

How UEFI boots?

UEFI system boots normally, but the choice of the system to boot can be done at UEFI level (this is new, it was not possible with BIOS). So, it is possible than after installing a dual boot the next reboot be in the old system. Change this in UEFI.

UEFI can only boot UEFI capable mass media. BIOS or compatible UEFI system can only boot a BIOS capable mass media. Some mass media can boot the two of them, but it's not current, as of Feb 2016 I know only of the Debian hybrid dvd who can do this.

In fact, the boot entries are not created by UEFI, at the notable exception of the plugin devices. These entries are written to a persistent ram called "NVRAM". This is the works of YaST, easyefi or the command line linux utility efibootmgr.

How to boot IN UEFI?

Some systems are said to be able to boot in UEFI (that is show UEFI options and allow modifications) only from a Windows menu (see next paragraph), so do not remove Windows before having checked that you can boot... UEFI should be able to boot any external device, given the internal one is faulty, but some security options can disable any special boot, so be prudent.

You can do this in Windows by holding shift when pressing “restart” (this go to an emergency mode), then touching Troubleshoot, Advanced Options, UEFI Firmware Settings, Restart.

On "normal" computer any key from Esc, F1 to F12, Del, or even other can be used to boot in UEFI. Many options to test, I read than sometime it needs the Control key pressed before.

A trick that worked every time I needed it is to run the finger across the keyboard during early boot. This can led to a keyboard fault and open the BIOS/UEFI. Time ago we had the message "Keyboard fault, press F1 to continue" :-).

One key sequence opens UEFI, an other open a "boot menu", that lists all the UEFI registered entries and, most of the time, allow to enter setup. If you can start Windows, the free version of "esyefi" allows you to register unrecognized loader.

Most UEFI have an option to access UEFI console (or terminal), from where you can makes things with a dos like system. I don't At The Moment know how to use it.

64 bits system with 64 bits UEFI

UEFI can be 32 or 64 bits. Each can only boot the corresponding loader that, in time, can boot any 32 or 64 bits system.

If you have a 64 bits UEFI you have obviously a 64 bits processor (no 128 bits right now?) and have no problem to boot and install a 64 bits system.

32 bits UEFI with 64 bits processor

If you can boot (Debian hybrid, home made...), you can install a 32 bits system. You probably already have a 32 bits Windows (mine is "10").

32 bits systems use a bit less Ram memory than 64 bits ones.

So, if you don't already trick a computer, try first Debian...

Installing a 32 bits system

Installing a 32 bits UEFI system works normally, booting from usb with UEFI firmware menu. USB pen have to be plugged in before booting. Fn F7 to get the boot menu.

Manually installing...

openSUSE Leap 42.1 on a 32 bits UEFI / 64 bits processor IT WORKS TW891 Windows Tablet

Prepare yourself

You can add an external keyboard, but you may need to use the two usb keyboard plugs and keep the device AC power on the third so better use the mechanical keyboard on board. Problem is the system boots with the long side vertical and the keyboard connects to the left. Using keyboard is not easy, using the touchpad unfriendly. It looks like text is written bottom to up, turned 90° counterclockwise. It boots already like this for the UEFI copyright.

You need also a comparison chart of AZERTY versus QWERTY if you are french or else any equivalent.

On the TW891 keyboard, Esc if really blue "Fn ²" (Esc is in blue), on the top row, upper right characters you get with first pressing Alt (this Alt key is, in fact, Alt Gr, and there is no Alt). F1 - F12 are blue Fn 1 to 0, then ) =.

You enter UEFI typing Fn ² (Esc) or simply Del (next to the space bar). The boot menu is Fn 7 (F7).

You can power off the tablet pressing a very long time (10s?) the upper left tablet key (the on button). To power on you have to press the button 2s, no less, no more. As soon (2s delay) as you see the "AMI" copyright, boot begins, press the appropriate key or let the boot continue.

Get The grub-efi 32 bits package on Tumbleweed. It's now grub2-i386-efi-2.02~beta2-55.1.i586.rpm but any package should work if "i386 and efi". Depending when, you will need grub.efi or the full content of usr/lib/grub2/i386-efi/, so extract this from the rpm (do not try to ''install' it. Of course, you need also some linux computer, mine is with openSUSE Leap 42.1. The rpm is between 2 and 3 Mb. If you download only some kb, it's not the right file.

Get a Debian hybrid dvd and copy it to a 8 Gb usb stick.

Get a Leap 42.1 dvd and copy it to a 8 Gb usb stick.

Start windows on your device. Get easyuefi and install it. Free version is enough for us here.

Go to Windows disk manager (ask the search system) and shrink the Windows partition to accommodate Linux. You need around 10 Gb free, more if possible.

May be get some course on grub2 console mode. Don't forget you can use the TAB completion (extremely useful) and up/down arrow history.

Registering UEFI

Power off your computer before plugging the usb stick. You should be able to boot Debian usb stick with hybrid dvd simply choosing "USB stick" in the boot menu, but in case you don't see it, start windows, start easyuefi and create a new entry pointing to Debian EFI "grub.efi" - navigate the disk until you find it (do not unplug the stick after that). Power off then on (do not reboot).

Getting rid of secure boot

Reboot to the firmware (UEFI).

Go to security tab and disable secureboot. Do not touch any other option, you may kill your computer!!!. Save your config and immediately check if Windows still boot. If yes, go on, if no you are on your own, try to use the comments here to build a Leap 32 bits boot stick.

Installing Leap with Debian's help

You can skip this step if you can build right now your own UEFI boot stick (see below).

Plug Debian on one usb port, Leap on the other.

Boot Debian. If when you boot it's Windows that starts, you chooses the wrong boot entry... power off and redo.

When you see the debian logo and menu, immediately type "c" to get the grub prompt. You are now on grub editor. Notice the screen position? On my TW891 it's vertical (rotated 90° counter clock wise). Not friendly.

 ls

will give you the list of disk and partitions. The disk with many partition is the hard disk, the other ones are usb sticks. ls may give you the disk name, but may be you will have to key in

 ls (hdX)

with X to choose in the disk list to see the name. You will have to use the openSUSE stick from now on, Debian was only to boot.

Now, you can navigate from the grub console to the openSUSE Leap dvd, you don't need to mount it, simply use "ls".

You search for the linux kernel. On installed system it's name is usually "vmlinuz", but here it's simply linux, it's not on the EFI partition but on the other one, on /boot/x86_64/loader/. You'll have to type something like:

 Linux (hdX,msdosY)/@/boot/x86_64/loader/linux nomodeset

But do not type this as it is!

type linu then the TAB key, grub should complete itself "linux ", then type ( and TAB, grub should complete with hd and ask for the hd number, give the one you ls'ed. Same for the content after the period, it's the partition which name depends of the iso structure, then add the partition number, then /.

Debian grub added @/, no idea why, openSUSE one don't, but here it's necessary.

Continue until grub find linux. If grub fails to find something it's not there, you probably mistype something.

nomodeset is mandatory for me, but may not be for you, but it should be safer at this step (video default to frame buffer).

Do the same for initrd

 initrd (hdX,msdosY)/@/boot/x86_64/loader/initrd

then

 boot 

should start the install

Choose defaults and the install should go well. If you can, do not use BTRFS, it's not necessary on so small disk and Debian grub do not read it without modules that may not be available.

Leap reboot

Of course didn't boot (64 bits grub.efi). I used BTRFS and so couldn't start it with the Debian dvd, because Debian do not read BTRFS :-(.

Building an openSUSE 32 bits usb stick.

You can begin with this if you want, to avoid the Debian step. If you can write the grub.efi 32 bits directly on the Leap usb stick, nice (but you may have to remove the 64 bits one to get room, do not forget your stick wont work normally after this).

To have a bootable UEFI stick, you need:

  • any stick, small is good
  • on it the first partition (/dev/sdX1) must be FAT32, have the EFI flag (1 or ef, I don't know if any works, try it, for me I had 1). I read somewhere that is must be smaller than 300 Mb, elsewhere 512 Mb (not tested) but in fact it seems it have to be larger than 260 Mo im some hard disk (4k sectors, big disks) See here.
  • on it a EFI folder
  • in the EFI folder any folder (mine is "32")
  • in it the grub.efi file you got from Tumbleweed on the beginning. You may copy also all the grub modules, I don't know if it's necessary, but it's probaly not negative.

The UEFI should boot this stick if the computer is powered off then on after inserting the stick. If it don't works, register it with easyuefi.

Notice you don't have any kernel on this stick, you have only the grub binary, so the boot will stop on grub prompt.

To install with it follow the same steps as for Debian, use the grub TAB completion to have the right names/syntax. For booting after the install, remove the Leap stick and do like for the install, find the kernel, now in /boot/vmlinuz and the initrd on /boot/initrd. The disk/partition depends of your install. Something like this, the root part is mandatory, the @/ only if grub completion gives it:

set root=(hd1,gpt6)/@/ linux (hd1,gpt6)/@/boot/vmlinuz nomodeset initrd (hd1,gpt6)/@/boot/initrd boot

Making the install boot

You can from the beginning copy the usr/lib/grub2/i386-efi/ folder from the Tumbleweed rpm to the usb stick, then to the same folder in the Leap install. In /usr/lib/grub2/, there is a folder "i386-pc" that is for BIOS PC's, create the i386-efi next to, it.

from the started Leap, type:

 grub2-install --target i386-efi

this installs the grub.efi 32 bits on EFI/opensuse and register to the NVRAM, so you get a new entry in the boot menu that should work. Do not forget to add "nomodeset" in the kernel linux line (on grub.cfg or manually at grub prompt) if your computer freeze at boot. openSUSE will probably be the default boot option, this may not be the desired feature, given the tablet computers needs many setting before working friendly with openSUSE.

After that you don't use at all the Leap boot system, better disable it else any grub update will kill your boot. I, /etc/sysconfig/bootloader set the boot loader to "", or use YaST and set "no boot loader".

Result

Leap runs pretty well on this machine, with the problem (same on debian) than the screen is rotated 90°, that is in tablet format, when the keyboard and the touchpad are connected on the long side, so the screen is left turned, very unfriendly.

But as long as I have to use framebuffer, I don't think there is a X solution (rotating works with console only).

Next work on this is to have RTL 8732BS wifi/bluetooth/whatever work, but not that obvious. Right now to have any network one need an usb/ethernet plugin.

Needs also i891 Intel working.

Curiously, the touch screen don't works (when it works on my main computer).

but mouse, external keyboard works.

Links

https://bugzilla.opensuse.org/show_bug.cgi?id=963496

https://sturmflut.github.io/linux/ubuntu/2015/01/21/installing-ubuntu-15.04-on-baytrail-tablets/

http://www.rodsbooks.com/refind/getting.html

http://askubuntu.com/questions/392719/32-bit-uefi-boot-support

https://github.com/jfwells/linux-asus-t100ta/tree/master/boot

http://www.jfwhome.com/2014/03/07/perfect-ubuntu-or-other-linux-on-the-asus-transformer-book-t100/

Editing NVRAM

Tests done on an Asus 64 bits computer with 64 bits UEFI.

By hand (command line)

efibootmgr have many defaults (simply looks at the man page), and by the way yast do not seems to use the mounted partition, I also tried that - or not exactly, see below.

efibootmgr do not look at all at the EFI folder if not instructed to do so. It only looks at the nvram variables of the uefi system.

To be able to add an entry in the nvram, you have first to get yast to build the boot system, then copy it if necessary in a subfolder of /boot/efi/EFI in the wanted disk.

Then issue the command line as root (parenthesis are comments, do not write them) - all on the same line:

efibootmgr -c                   (-c to "create")
-p 1                            (number of the EFI partition on the disk, beginning with 1, which is the default)
-d /dev/sdb                     (default is sda, if you use sda better not write the option at all)
-L "jdd"                        (name of the option in the efi menu)
- l "\EFI\opensuse\grubx64.efi" (opensuse is the name of the folder, it's a windows thing, so the backslash, the root of the system is the efi partition for us mounted on /boot/efi)

As far as I know, this command just add the entry and return the new nvram list, after that you will find it in the efi boot menu and in the UEFI options.

It's not necessary to mount anything for this command to work, nothing is verified at this moment, so why testing is so long, any test needs reboot...

You can add several entries, with different syntax, for make testing easy.

The relevant command for my config booted, but with no grub menu (may be because there is only one config on this disk). If you want a grub menu, you can write a grub.cfg file next to the grub.efi.

Manually (UEFI menu)

Making all this led me to understand what the UFI asked me to enter in the menu options "add en entry" of my Asus s400c laptop. This may change from computer to computer.

I had to enter a name (no need to quote), choose the disk (very obscure list of two elements, I think some sort of UUID), give a "path". This one was what I could understand after the efibootmgr syntax: the "EFI\opensuse\grubx64.efi" part.

And this option gives the same result as the other.

On Dell computer (at least Vostro 3360)

At boot time, the firmware don't seems to be able to see Leap 15 usb stick (at least it was my present problem). So one needs to build his own nvram entry for the usb stick.

Switch the computer off. Plug the usb stick and boot to the firmware (F2). Go to boot option then "add entry". You get three lines, one for the name (better use any short name, but you can't edit it afterward), one for the device, that should be found (have "USB" in it), then for the "file". On Leap 15.0 usb stick, "file" is: \EFI\BOOT\bootx64.efi

Type F10 to save the config and reboot, type "F12" (boot menu) and choose your new entry, the usb stick should boot.

As an alternative you can use efibootmgr as instructed here to build the nvram with same syntax. efibootmgr -v allows you to see what's the other entries looks like.

With YaST

YaST is not always easy to manage, because it uses in the third tab (choosing the default menu entry) the previous osprober result, and osprober is only executed after the config is validated, so you have to make a "blank run" to update the boot entry list (the one of the grub menu), before being able to choose one...

AFAIK Yast knows only about the EFI/opensuse folder and NVRAM. I'm not sure how it manage EFI/opensuse, don't know if manual changes there are preserved upon updates, but any other /EFI folder is ignored.

YaST write the boot files (*.efi) to /boot/efi and complain if nothing is mounted there (good) - have to be the EFI partition, with it's first folder "EFI"...

I could test all that moving all the opensuse folder (under EFI) to a backup place then making YaST write them again.

I found here:

https://www.suse.com/documentation/sles-12/book_sle_admin/data/sec_grub2_yast2_config.html

than for YaST to write every bit of info about boot system, one have to force it, changing the bootloader in the menu to anything else (no need to validate, reloading the menu do the trick) then back to grub2-efi. Changing any other option *is not enough*.

I think there should be an option "reload" of "force writing", because this trick is specially naked.