Skip to content

Instantly share code, notes, and snippets.

@xtrymind
Forked from miguelfrde/archinstall.md
Last active October 21, 2023 17:43
Show Gist options
  • Save xtrymind/b895c640231adde21598d5188c75d4b5 to your computer and use it in GitHub Desktop.
Save xtrymind/b895c640231adde21598d5188c75d4b5 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)

Before

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

Partitioning

Windows 10 Efi partitioning

Partition Location Size File system
Recovery sda1 500 MB ntfs
ESP sda2 100 MB vfat
Reserved sda3 16 MB ?
Windows 10 sda4 80 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

Install

# pacstrap /mnt base base-devel

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

$ pacman -S dosfstools grub efibootmgr intel-ucode
$ mkdir /boot/efi
$ mount /dev/sda1 /boot/efi

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

$ grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --recheck
$ 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

@gihyeonsung
Copy link

Nice job 👍

But, in my opinion, options root=/dev/sba6 rw should be changed to options root=/dev/sdb2 rw.

@GreasyPizzaToppings
Copy link

Very helpful but there are some errors.

  1. "tittle Arch" has 'title' misspelled
  2. Where you say to substitute '$hints_string' and '$fs_uuid' for outputs of grub-probe, you put fs_uuid for $hints_string and fs_uuid for $hints_string. The grub-probe command should be swapped for these variables so fs_uuid goes with $fs_uuid and hints_string goes with $hints_string.

@ShahinSha-dot
Copy link

You could have used os-prober to detect windows automatically

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