Taylorbyte.com

Documentation Wiki

UEFI GPT Arch Linux USB (bootx64.efi and bootia32.efi)

Overview

This tutorial is for creating an Archlinux UEFI bootable USB with a GPT partition table and 32bit GRUB efi bootloader. This tutorial will help people installing linux onto Class 3 UEFI machines, also if the machine only looks for bootia32.efi file for example (ASUS T100 and some MAC laptops)

What works with ASUS T100

  • [YES] Grub boot to x86_64 kernel
  • [YES] Backlight stays on when X is started, screen detected
  • [YES] Desktop Environment, native resolution, acceleration
  • [NO] Touchscreen
  • [NO] Wifi
  • [NO] Sound
  • [NO] Stop mmcblkrpmb errors
  • [NO] Backlight control via Fn keys

Prepare USB

Erase USB properly

dd if=/dev/zero of=/dev/sdx bs=1M

Partition USB

gdisk /dev/sdx

GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sde: 15384576 sectors, 7.3 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): D839F6A0-B5B0-49E5-80F8-38FB6CC37546
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 15384542
Partitions will be aligned on 2048-sector boundaries
Total free space is 4636605 sectors (2.2 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
  1            2048          264191   128.0 MiB   EF00  EFI System
  2          264192         2361343   1024.0 MiB  8300  Linux filesystem
  3         2361344        10749951   4.0 GiB     0700  Microsoft basic data

Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): Y

Command (? for help): n
Partition number (1-128, default 1):
First sector (34-15384542, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-15384542, default = 15384542) or {+-}size{KMGTP}: +128M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): ef00
Changed type of partition to 'EFI System'

Command (? for help): n
Partition number (2-128, default 2):
First sector (34-15384542, default = 264192) or {+-}size{KMGTP}:
Last sector (264192-15384542, default = 15384542) or {+-}size{KMGTP}: +2G
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'

Command (? for help): n
Partition number (3-128, default 3):
First sector (34-15384542, default = 4458496) or {+-}size{KMGTP}:
Last sector (4458496-15384542, default = 15384542) or {+-}size{KMGTP}: +4G
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 0700
Changed type of partition to 'Microsoft basic data'

Command (? for help): p
Disk /dev/sde: 15384576 sectors, 7.3 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 35263808-2425-403C-9453-A26F14332CF3
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 15384542
Partitions will be aligned on 2048-sector boundaries
Total free space is 2539453 sectors (1.2 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
  1            2048          264191   128.0 MiB   EF00  EFI System
  2          264192         4458495   2.0 GiB     8300  Linux filesystem
  3         4458496        12847103   4.0 GiB     0700  Microsoft basic data

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sde.
The operation has completed successfully.

Format partitions

mkfs.vfat -F32 /dev/sdx1
mkfs.ext4 /dev/sdx2
tune2fs -o discard /dev/sdx2
mkfs.ntfs -Q /dev/sdx3

Install packages to rootfs

mkdir /mnt/usb
mount /dev/sdx2 /mnt/usb/

mkdir -p /mnt/usb/var/cache/pacman/pkg/
mkdir -p /mnt/usb/var/lib/pacman/
pacman -r /mnt/usb/ -Sy
pacman -r /mnt/usb/ -S base{,-devel} rsync alsa-utils dhclient netctl wpa_actiond ifplugd acpi nfs-utils dosfstools arch-install-scripts gdisk sudo wget openssh openssl vim net-tools inetutils openntpd efibootmgr grub os-prober abs smartmontools
# r8168 package needed for machines with realtek r8168 nic

mkdir /mnt/usb/mnt/esp
mount /dev/sdd1 /mnt/usb/mnt/esp/

arch-chroot /mnt/usb/ /bin/bash

Configure pacman edit /etc/pacman.d/mirrorlist and choose a mirror then edit /etc/pacman.conf

[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch

edit /etc/makepkg.conf

MAKEFLAGS="-j4"

Initialise pacman on usb

pacman -Sy
pacman-key --init
pacman-key --populate archlinux
pacman -S linux yaourt

Grub

A Feature Request was filed at https://bugs.archlinux.org/task/40126 to enable bootia32.efi. And is no effective.

install grub

grub-install --target=x86_64-efi --efi-directory=/mnt/esp/ --boot-directory=/mnt/esp/ --bootloader-id=boot --modules=part_gpt
grub-install --target=i386-efi --efi-directory=/mnt/esp/ --boot-directory=/mnt/esp/ --bootloader-id=boot --modules=part_gpt
#grub-install /dev/sdd --boot-directory=/mnt/esp/ --bootloader-id=boot --modules=ntldr
mv /mnt/esp/EFI/boot/grubx64.efi /mnt/esp/EFI/boot/bootx64.efi
mv /mnt/esp/EFI/boot/grubia32.efi /mnt/esp/EFI/boot/bootia32.efi
grub-mkconfig -o /mnt/esp/grub/grub.cfg
rm -r /boot/grub/

for machines with usb ports that go to sleep all the time configure /etc/default/grub then run grub-mkconfig -o /mnt/esp/grub/grub.cfg again

GRUB_CMDLINE_LINUX_DEFAULT="quiet usbcore.autosuspend=-1"

Os-prober should look like this

menuentry 'Windows 8.1 Installation Environment' --class windows --class os $menuentry_id_option 'osprober-chain-724FDC0149E4414B' {
        insmod part_gpt
        insmod ntfs
        set root='hd3,gpt3'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd3,gpt3 --hint-efi=hd3,gpt3 --hint-baremetal=ahci3,gpt3  724FDC0149E4414B
        else
          search --no-floppy --fs-uuid --set=root 724FDC0149E4414B
        fi
        chainloader (${root})/efi/boot/bootx64.efi
}

Linux line modifications for ASUS T100 in grub.cfg

video=VGA-1:1368x768 reboot=p,f sdhci.debug_quirks=0x8000 nomodeset --

sdhci.debug_quirks=0x8000 is for wifi

fstab

find uuid of esp

ls -alh /dev/disk/by-uuid/

edit /etc/fstab/

UUID=XXXX-XXXX /mnt/esp/ vfat defaults,noatime,discard 0 1

Wraping up

Enable services

systemctl enable sshd
systemctl enable netctl

set root password

passwd

Add user

useradd [username]
mkdir /home/[username]
chown [username]:users /home/[username]
passwd [username]

Sudo

sudoedit /etc/sudoers

Uncomment

%sudo ALL=(ALL) ALL

Group

groupadd sudo
groupadd burning
groupadd wireshark
usermod -G disk,lp,games,video,audio,optical,storage,scanner,power,users,wireshark,burning,sudo -a [username]
usermod -G users -a http

Set hostname

echo "usb-arch" > /etc/hostname
#hostnamectl set-hostname usb-arch

Desktop Manager and Environment

Install packages

pacman -S xf86-video-intel xorg-server mesa-demos gnome gdm

edit /etc/X11/xorg.conf.d/20-intel.conf

Section "Device"
  Identifier  "Intel Graphics"
  Driver      "intel"
  Option      "AccelMethod"  "sna"
EndSection

For some reason at this point in time kerel 3.12+ doesn't like gdm so I installed kdm to get gnome to work

pacman -S kdebase-workspace phonon-vlc xf86-input-elographics
systemctl enable kdm

#yaourt -S xf86-input-evtouch  xf86-input-evdev-multitouch-git

Networking after first boot (externel USB NIC)

::
ip addr cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/ethernet

edit /etc/netctl/ethernet

Interface=enp0s20u4u4

Enable ethernet

netctl enable ethernet

Install kernel that has baclkight patches

Install linux-ak from AUR

yapurt -S linux-ak

Or from saved package

pacman -U linux-ak-3.12.10-1-x86_64.pkg.tar.xz