Skip to content

Instantly share code, notes, and snippets.

@alecgerona
Last active March 21, 2024 11:46
Show Gist options
  • Save alecgerona/09ba790960c45ba609ec7a466394fb0e to your computer and use it in GitHub Desktop.
Save alecgerona/09ba790960c45ba609ec7a466394fb0e to your computer and use it in GitHub Desktop.
Dual Boot install Arch Linux in a Windows 10 preinstalled laptop

Notes: This install was done on MSI GL62M 7REX, ASUS FX503v, and Lenovo Y540 laptops and doesn't implement a secured partition for simplicity and ease of use. Use at your own discretion.

Since the laptop has an SSD, I'd like to install Arch Linux on the SSD as well. Unfortunately, Windows' installation has the whole drive occupied so it needs to be shrunk

  1. Boot into Windows and go into "Create and format hard disk partitions" in Control Panel.
  2. Free up some space in the SSD.

At this point we now have an unallocated disk space. We need to make this space usable by making it of file system type RAW

  1. While still in the Disk Management window, select the unallocated space and create a simple volume in it. Don't assign a path/letter to it, use the whole space, and don't format the drive.
  2. You can now restart and boot into the Arch Linux installation media. Note: Remember to change your SATA mode to AHCI so arch can detect your whole disk! If the display is messed up, try pressing 'e' on the boot window and adding nomodeset at the end. This is due to the ArchISO lacking support for discrete grahpics (nvidia).

Readying the partition where Arch Linux will be installed

  1. Create a partition on the space you just left blank back in Windows. Use fdisk -l to view your partitions. Use defaults on all the values since we won't be using a swap or boot partitions.
gdisk /dev/{{partition}}
  1. Format the parition into ext4
mkfs.ext4 /dev/{{partiton}}
  1. Mount the partition
mount /dev/{{partition}} /mnt

Actually installing Arch Linux 0. Make sure you're downloading from the nearest mirror server.

vim /etc/pacman.d/mirrorlist # Put the nearest mirrors to the top.
wifi-menu # Access wifi
# If you have issues with wifi-menu due to rf-kill, do this.
# echo "blacklist hp_wmi" > /etc/modprobe.d/hp.conf
# rfkill unblock all
  1. Install base packages
pacstrap /mnt base linux linux-firmware
  1. Generate an fstab file. This tells the OS which partition to mount on boot.
genfstab -U /mnt >> /mnt/etc/fstab
  1. Change into root.
arch-chroot /mnt
  1. Update the timezone
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
  1. Run hwclock(8) to generate /etc/adjtime
hwclock --systohc
  1. Edit /etc/locale.gen file and uncomment en_US.UTF-8 UTF-8 and generate it
vi /etc/locale.gen # edit file
locale-gen # execute
  1. Create file /etc/locale.conf and add LANG=en_US.UTF-8
echo "LANG=en_US.UTF-8" > /etc/locale.conf
  1. Set your hostname by creating /etc/hostname and adding your preferred hostname as the first line
echo "(hostname)" > /etc/hostname
  1. Set your hosts by editing /etc/hosts
echo "127.0.0.1 localhost" >> /etc/hosts
  1. Change your root password with
passwd
  1. Install a way to connect to the internet
pacman -S dialog wireless_tools dhclient wpa_supplicant networkmanager
  1. Make sure nvidia plays nice.
pacman -S nvidia
  1. Install a boot loader, you know, to actually boot into Arch Linux
pacman -S refind-efi efibootmgr
  1. Install a prober to find our Windows installation and be able to boot into it.
pacman -S os-prober ntfs-3g
  1. Configure the boot loader
mkdir /boot/efi
mount /dev/{{efi-partition (look for this in fdisk -l}} /boot/efi
refind-install
sh -c "$(curl -fsSL https://raw.githubusercontent.com/bobafetthotmail/refind-theme-regular/master/install.sh)" # Install rEFInd theme

At this point of the installation progress, you may now stop. And breathe. You have achieved something this day. And it is no small feat. But we are just getting started.

  1. Reboot and now you should be able to choose a boot loader either for Arch Linux or for Windows. If you don't see this, then just go into BIOS and choose to boot into arch.
  2. Upon booting into Arch, it should ask you to login as the user you specified in your hostname above. Since you haven't specified a password for this user yet (or logged in with it for that matter) you should log in via root instead. Just type root and press enter.

Installing your preferred GUI experience

  1. Since I personally prefer i3 without any display managers, the rest of the tutorial would focus on installing this. Numerous tutorials exist for other DEs/WMs.
  2. Create a superuser and add a password for it.
useradd -m <username>
passwd <username>
usermod -G wheel -a <username>
  1. Connect to WiFi. This will be your primary method of connecting to the internet.
systemctl enable NetworkManager
systemctl start NetworkManager
nmtui
  1. Install LARBS (larbs.xyz). This is a heavily configured i3-gaps setup by Luke Smith.
curl -LO larbs.xyz/larbs.sh
bash larbs.sh  # You can edit this file to input your own custom dotfiles
  1. Reboot and rejoice, the first menu you see should ask you which OS to boot into.
  2. Correct software time.
sudo pacman -S ntp
sudo systemctl enable ntpd
sudo systemctl start ntpd
sudo ntpdate 129.6.15.28 # Sync with https://tf.nist.gov/tf-cgi/servers.cgi
sudo hwclock --systohc # Sync hardware clock with software

Congrats! You now have installed Arch Linux alongside Windows! Now, to install other essetial stuff!

  1. Make sure our printer works
pacman -S cups
systemctl start cups-browsed.service # Start the service
systemctl enable cups-browsed.service # Start
@miyagui
Copy link

miyagui commented Jan 19, 2021

Excellent guide. Only thing that I noticed is that when you install refind as chroot, refind will use the arch installer medium to generate it's config. Make sure you check the config before you reboot.

Personally all I had to do is mount the efi partition again and manually change the disks UUID.

Thanks.

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