DEV Community

Cover image for How to Dual Boot Arch Linux With Windows
Debiprasad Das
Debiprasad Das

Posted on • Edited on

How to Dual Boot Arch Linux With Windows

First Step:

Create an empty unallocated Empty partition in windows then boot into archiso via a USB drive after flashing it via balenaEtcher,

after entering in TTY change the font if you want a bigger font.

setfont ter-132n 
Enter fullscreen mode Exit fullscreen mode

Setup WIFI connection on TTY:

check your internet connection using

ping archlinux.org 
Enter fullscreen mode Exit fullscreen mode

if you don't have internet connection then connnect it using iwctl

  • First get your WIFI interface name
iwctl # Get WIFI interface name: device list # Scan WIFI networks: station <interface_name> scan station <interface_name> get-networks # Finally, to connect to a network: station <interface_name> connect <SSID> 
Enter fullscreen mode Exit fullscreen mode

to learn more about iwctl

Partition Disk:

cfdisk 
Enter fullscreen mode Exit fullscreen mode

NOTE : If it's does not show correct partition
then select your drive. you can get drive list by typing lsblk

# example cfdisk /dev/nvme0n1 
Enter fullscreen mode Exit fullscreen mode
  • Then select gpt, after entering in GUI.
  • Select "Free space" and select "New" then press Enter.
  • and then Enter the storage space you want to give it to your root and press Enter.
  • and you will see a partition is being created and make sure this partition type is "Linux filesystem".

  • Next select the remaining "Free space" and press Enter, we will give this space to swap partition.

  • Do same as before and then select the swap partition and select "Type" press enter to see all the types available.

  • Select "Linux swap" from them.

  • We don't need to create boot partition as we already has boot efi partition running windows,

  • we just need to mount linux boot partition along side of windows, will do it later.

  • Then select "Write" and confirm it.

  • You will see "parition table has been altered" blue color text.

  • Then select "Quit"

  • type lsblk to see your partitions name.

Format Created Partitions:

  • Format root partition:
mkfs.ext4 /dev/<root_partition> # for example my root partition name is dev/sda1 # I will do "mkfs.ext4 /dev/sda1" 
Enter fullscreen mode Exit fullscreen mode
  • Format swap partition:
mkswap /dev/<swap_partition> # for example my swap partition name is dev/sda2 # I will do "mkfs.swap /dev/sda2" 
Enter fullscreen mode Exit fullscreen mode

Mount Partitions:

  • Mount root partition:
mount /dev/<root_partition> /mnt # for example my root partition name is dev/sda1 # I will do mount "mount /dev/sda1 /mnt" 
Enter fullscreen mode Exit fullscreen mode
  • Mount swap partition:
swapon /dev/<swap_partition> # for example my swap partition name is dev/sda2 # I will do mount "swapon /dev/sda2" 
Enter fullscreen mode Exit fullscreen mode

Now type lsblk and see that both partition has given proper MOUNTPOINTS

Setup Fastest Mirrors:

cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak 
Enter fullscreen mode Exit fullscreen mode
  • Verify that mirrorlist.bak file is created by
ls /etc/pacman.d/ 
Enter fullscreen mode Exit fullscreen mode
  • Setup fastest mirrors from your contry
reflector --verbose --country '<YourCountry>' -l 5 --sort rate --save /etc/pacman.d/mirrorlist 
Enter fullscreen mode Exit fullscreen mode

Install essential packages:

pacstrap /mnt base linux linux-firmware sof-firmware base-devel grub efibootmgr neovim vim networkmanager dhcpcd 
Enter fullscreen mode Exit fullscreen mode

Fstab:

  • Generate Fstab file and copy it to "etc" folder of arch linux system
genfstab -U /mnt >> /mnt/etc/fstab 
Enter fullscreen mode Exit fullscreen mode
  • check if it's correctly copied by typing
cat /mnt/etc/fstab 
Enter fullscreen mode Exit fullscreen mode

Chroot:

  • Let's Chroot into linux system
arch-chroot /mnt 
Enter fullscreen mode Exit fullscreen mode
  • Check your parititions again by typing lsblk.

Root password:

  • Enter your root password by typing
passwd 
Enter fullscreen mode Exit fullscreen mode

Standard User:

  • Create Standard User
useradd -m <username> 
Enter fullscreen mode Exit fullscreen mode
  • Create user password
passwd <username> 
Enter fullscreen mode Exit fullscreen mode
  • Setup user privilages
usermod -aG wheel,storage,power <username> 
Enter fullscreen mode Exit fullscreen mode
  • Edit Sudoers file
EDITOR=nvim visudo 
Enter fullscreen mode Exit fullscreen mode

then remove "#" in this line(Uncomment this line in programming words)

# %wheel ALL=(ALL) ALL 
Enter fullscreen mode Exit fullscreen mode

Localization:

nvim /etc/locale.gen 
Enter fullscreen mode Exit fullscreen mode

then remove "#" in this line(Uncomment this line in programming words)

# en_US.UTF-8 UTF-8 
Enter fullscreen mode Exit fullscreen mode
  • Generate locale
locale-gen 
Enter fullscreen mode Exit fullscreen mode
  • Create locale config file
echo LANG=en_US.UTF-8 > /etc/locale.conf 
Enter fullscreen mode Exit fullscreen mode
  • Export system language
export LANG=en_US.UTF-8 
Enter fullscreen mode Exit fullscreen mode

Hostname:

  • Create hostname
echo <hostname> > /etc/hostname 
Enter fullscreen mode Exit fullscreen mode
  • Update Hosts file
nvim /etc/hosts 
Enter fullscreen mode Exit fullscreen mode

put this in the file

127.0.0.1 localhost ::1 localhost 127.0.0.1 <hostname>.localdomain localhost 
Enter fullscreen mode Exit fullscreen mode

Time:

  • Setup time
ln -sf /usr/share/zoneinfo/<Region>/<City> /etc/localtime # You can use <tab> key to provide you region and city suggestions 
Enter fullscreen mode Exit fullscreen mode

then type this to sync current time

hwclock --systohc 
Enter fullscreen mode Exit fullscreen mode

Grub/Bootloader:

  • First Deletermine your EFI partition using lsblk, mostly it will be first one in your primary drive
mkdir /boot/efi 
Enter fullscreen mode Exit fullscreen mode
  • Mount EFI partition to your grub boot partition
mount /dev/<efi_partition> /boot/efi/ 
Enter fullscreen mode Exit fullscreen mode
  • Install os-prober
pacman -S os-prober 
Enter fullscreen mode Exit fullscreen mode
  • Do this so grub can detect windows
nvim /etc/default/grub 
Enter fullscreen mode Exit fullscreen mode

then remove "#" in this line(Uncomment this line in programming words)

#GRUB_DISABLE_OS_PROBER=false 
Enter fullscreen mode Exit fullscreen mode
  • Finally install grub
grub-install --target=x86_64-efi --bootloader-id=grub-uefi --recheck 
Enter fullscreen mode Exit fullscreen mode
  • Generate grub config
grub-mkconfig -o /boot/grub/grub.cfg 
Enter fullscreen mode Exit fullscreen mode
  • NOTE: It should detect Windows Boot Manager

  • If it's does not shows "Found Windows Boot Manager" follow this

Network Services:

  • Obtain IP addresss of wifi network
systemctl enable dhcpcd.service 
Enter fullscreen mode Exit fullscreen mode
  • This is strictly necessary for autostart wifi on boot and connect to wifi
systemctl enable NetworkManager.service 
Enter fullscreen mode Exit fullscreen mode

Wrapping up:

  • Exit from Chroot.
exit 
Enter fullscreen mode Exit fullscreen mode
  • Then do this to unmount all of the partitions.
umount -lR /mnt 
Enter fullscreen mode Exit fullscreen mode

NOW REBOOT AND REMOVE THE USB DRIVE WHEN SCREEN TURNS BLACK.

Top comments (0)