Skip to content

Instantly share code, notes, and snippets.

@afidegnum
Forked from lynx570/archinstall.md
Last active January 3, 2021 13:11
Show Gist options
  • Save afidegnum/eb196d5b2adb5275c18bc9564ebab6bb to your computer and use it in GitHub Desktop.
Save afidegnum/eb196d5b2adb5275c18bc9564ebab6bb to your computer and use it in GitHub Desktop.
Windows 10 and Arch Linux dual boot with UEFI

Arch Linux installation (Windows 10 dual boot)

Convert Partition from MBR to GPT

Before starting, make sure you have a backup, and make sure to have a linux live boot ready to rescue your system. It's easy to mess this up!

Use gdisk to convert the partition table to GPT.c
```
    gdisk /dev/sda
```        

Create the "BIOS boot" partition that GRUB needs.
n to create a new partition. Needs to be about 1MB. You can probably squeeze this in from sectors 34-2047. Use L or l to look up the code for "BIOS boot" (ef02).
Write the new partition table.
        w
Reload the partition table.
        partprobe /dev/sda

Before

  1. Disable Windows Fast-Startup
  2. Disable Secure Boot

Partitioning

For Both Windows and Linux

Partition Location Size File system
ESP sda1 100 MB vfat
Root sda2 50 GB ext4
Home sda3 500 GB ext4
Windows 10 sda4 500 GB ntfs

Connect to the internet (Wi-Fi)

# wifi-menu
# ping  -c 3 www.google.com

Format and mount disks

# mkfs.ext4 /dev/sdb1
# mkfs.ext4 /dev/sdb2
# mount /dev/sdb2 /mnt
# mkdir /mnt/boot
# mkdir /mnt/home
# mount /dev/sdb1 /mnt/boot
# mount /dev/sdb3 /mnt/home

$ mkdir /boot/efi
$ mount /dev/sda1 /boot/efi

Install

/etc/pacman.conf file.

[multilib] Include = /etc/pacman.d/mirrorlist

# pacstrap /mnt base base-devel linux linux-firmware vim git networkmanager grub efibootmgr 

Generate fstab

# genfstab -U /mnt >> /mnt/etc/fstab

Chroot and configure base system

# arch-chroot /mnt

Timezone

# ln -sf /usr/share/zoneinfo/Asia/Jakarta /etc/localtime

Hardware clock

# hwclock --systohc

Locale

# nano /etc/locale.gen

uncomment en_US.UTF-8

# locale-gen
# echo LANG=en_US.UTF-8 > /etc/locale.conf
# export LANG=en_US.UTF-8

Hostname

# echo arch >> /etc/hostname
# nano /etc/hosts

/etc/hosts should look like:

127.0.0.1   localhost.localdomain   localhost 
::1         localhost.localdomain   localhost
127.0.1.1   arch.localdomain        arch 

Root password

# passwd

Initial ramdisk environment

$ mkinitcpio -p linux

Systemd-Boot

# bootctl --path=/boot install

Then add following content to /boot/loader/entries/arch.conf

tittle    Arch
linux     /vmlinuz-linux
initrd    /initramfs-linux.img
initrd    /intel-ucode.img
options   root=/dev/sda6 rw

and following content to /boot/loader/loader.conf

timeout 5
default arch

GRUB

Edit /etc/default/grub, set DEFAULT_TIMEOUT=30.

$ grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --recheck
$ pacman -S os-prober
$ os-prober
$ grub-mkconfig -o /boot/grub/grub.cfg

Now, let's add Windows to the GRUB menu. Edit /boot/grub/grub.cfg and add the following menuentry after the Arch Linux menuentries:

menuentry "Windows 10" --class windows --class os {
    insmod part_gpt
    insmod fat
    insmod search_fs_uuid
    insmod chain
    search --fs-uuid --set=root $hints_string $fs_uuid
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

Now change:

  • $hints_string by the output of $ grub-probe --target=fs_uuid /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi

  • $fs_uuid by the output of $ grub-probe --target=hints_string /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi

Network configuration (Wi-Fi)

# pacman -S iw wpa_supplicant dialog networkmanager

Other

# pacman -S zsh reflector ntfs-3g

Unmount and reboot

$ exit      # If still on arch-chroot mode
$ umount -R /mnt
$ reboot

References

Installation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment