Skip to content

Instantly share code, notes, and snippets.

@DebXD
Created December 6, 2023 05:47
Show Gist options
  • Save DebXD/ff35bd02c365c11f2bfd94fbb9f8a56f to your computer and use it in GitHub Desktop.
Save DebXD/ff35bd02c365c11f2bfd94fbb9f8a56f to your computer and use it in GitHub Desktop.
How to Dual Boot Arch Linux with Windows

First Step:

Create a empty unallocated Empty partition in windows then boot into archiso via a USB drive,

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

setfont ter-132n

Setup WIFI connection on TTY:

check your internet connection using

ping archlinux.org

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

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

to learn more about iwctl

Partition Disk:

cfdisk

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
  • 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"
  • Format swap partition:
mkswap /dev/<swap_partition>

# for example my swap partition name is dev/sda2
# I will do "mkfs.swap /dev/sda2"

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"
  • Mount swap partition:
swapon /dev/<swap_partition>

# for example my swap partition name is dev/sda2
# I will do mount "swapon /dev/sda2"

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
  • Verify that mirrorlist.bak file is created by
ls /etc/pacman.d/
  • Setup fastest mirrors from your contry
reflector --verbose --country '<YourCountry>' -l 5 --sort rate --save /etc/pacman.d/mirrorlist

Install essential packages:

pacstrap /mnt base linux linux-firmware sof-firmware base-devel grub efibootmgr neovim vim networkmanager dhcpcd

Fstab:

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

Chroot:

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

Root password:

  • Enter your root password by typing
passwd

Standard User:

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

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

# %wheel ALL=(ALL) ALL

Localization:

nvim /etc/locale.gen

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

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

Hostname:

  • Create hostname
echo <hostname> > /etc/hostname
  • Update Hosts file
nvim /etc/hosts

put this in the file

127.0.0.1    localhost
::1          localhost
127.0.0.1    <hostname>.localdomain    localhost

Time:

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

then type this to sync current time

hwclock --systohc

Grub/Bootloader:

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

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

#GRUB_DISABLE_OS_PROBER=false
  • Finally install grub
grub-install --target=x86_64-efi --bootloader-id=grub-uefi --recheck
  • Generate grub config
grub-mkconfig -o /boot/grub/grub.cfg
  • 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
  • This is strictly necessary for autostart wifi on boot and connect to wifi
systemctl enable NetworkManager.service

Wrapping up:

  • Type exit to exit from chroot environment.
  • Then do this to unmount all of the partitions
umount -lR /mnt

NOW REBOOT!

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