Skip to content

Instantly share code, notes, and snippets.

@Pamblam
Created June 24, 2018 11:05
Show Gist options
  • Save Pamblam/99ef7b1f3c4f0f1526692ee4ea07d957 to your computer and use it in GitHub Desktop.
Save Pamblam/99ef7b1f3c4f0f1526692ee4ea07d957 to your computer and use it in GitHub Desktop.
Installing And Setting Up Arch Linux to Dual Boot Alongside Window 10

Newb's Guide to installing Arch Next to Pre-installed Windows 10

The steps I took to dual boot Arch Linux alongside the preinstalled Windows 10 that came with my new Lenovo Ideapad. I used Ubuntu exclusively for the last 6 years so I'm Window's illiterate. I don't know a whole lot about the inner workings of Linux either.

Pre-Instllation Steps

Prepare the preinstalled Windows to share the system.

Verify the boot mode...

  • Boot into Windows
  • Press Win key and 'R' to start the Run dialog
  • In the Run dialog type "msinfo32" and press Enter
  • In the System Information windows, select System Summary on the left and check the value of BIOS mode item on the right.
  • Make sure the value is UEFI, which means Windows boots in UEFI/GPT mode

Disable secure boot

  • Open Settings (The gear icon in the start menu)
  • Click "Updates & Security"
  • In the "Recovery" menu, click "Restart now" under the "Advanced startup" header
  • After restart, choose the "Troubleshoot" option.
  • Choose "Advanced Options"
  • Choose "UEFI Firmware Settings"
  • Press the restart button to load the UEFI firmware
  • In the Security settings find and disable Secure Boot
  • In the Boot settings also find and disable Fast Boot

Disable Fast Startup

  • Open Control Panel (Press Windows key, Type "Control Panel" and press enter)
  • In the "View by" menu, choose "Small Icons" and click on "Power Options".
  • Open "Choose what power buttons do" on the left side menu.
  • Click "Change settings that are currently unavailable"
  • Uncheck "Turn on Fast Startup" and save changes.

Shrink the Windows partition

  • Press Windows Key + R and type diskmgmt.msc - hit enter
  • Right click the C drive and choose "Shrink Volume"
  • Enter the amount of space to shrink the partition (I shrunk mine by 200000mb - 200 gigs)
  • Click "Shrink"

Make a bootable USB

  • Choose a mirror from www.archlinux.org/download - I used the American pair.com mirror because it's the first reputable domain I recognised.
  • Download the .iso file.
  • Download Rufus from https://rufus.akeo.ie/
  • Plug in a new USB stick and open Rufus
  • Select the USB drive and the downloaded Linux iso.
  • Choose the GPT partition scheme, FAT32 file system
  • Press start

Install Arch

We're ready to boot and install Arch.

Boot the USB

  • Plug in the USB
  • Hold down the shift key while clicking Restart
  • Choose "Troubleshoot" then "Advanced Options" then "UEFI Firmware Settings" then restart.
  • In the Boot menu, find your bootable USB and move it up above the Windows boot manager so it will boot the USB first.
  • Save and exit

Load keyboard layout & locale

  • Type loadkeys us at the command line and press enter
  • Type locale-gen at the command line and press enter

Hookup them internets

  • At the command line type rfkill unblock wifi and press enter
  • Type iw dev and press enter. It will tell you the name of the Wifi interface.
  • Type wifi-menu <wifi_interface_name> (using your actual interface name) and press enter.
  • A UI will show allowing you to choose a network and log into it.
  • After logging in, ping google.com to verify the internets work. After a few packets are sent, CTRL+C to stop pinging - if it says no packets were lost then we're good.

Partitioning

  • First type free -m, hit enter. Take note of the amount of total memory available.
  • Type gdisk /dev/sda and hit enter to start the GPT partitioning program
  • Create SWAP partition
    • At the prompt, type n, press enter to create a new partition
    • It will prompt for a partition number. Just hit enter to use the default.
    • It asks where to start the first sector. Press enter to accept the default which is automatically the start of unallocated space.
    • It asks for the last sector. Type +12GB (I have 12 gigs of memory - if you have more or less you should adjust accordingly) and press enter.
    • If it says anything other than "Linux Filesystem" type 8200 at the next prompt. Hit enter.
  • Create Root partition
    • At the prompt, type n, press enter to create a new partition
    • It will prompt for a partition number. Just hit enter to use the default.
    • It asks where to start the first sector. Press enter to accept the default which is automatically the start of unallocated space.
    • It asks for the last sector. Press Enter to accept the default and use all of remaining unallocated space.
    • If it says anything other than "Linux Filesystem" type 8300 at the next prompt. Hit enter.
  • At the prompt, type W, press enter to write changes to the drive. When prompted, type Y and press enter to confirm.

Create SWAP space

  • Type gdisk -l /dev/sda, press enter and take note of the partition number of the Swap part.
  • Type mkswap -L "Linux Swap" /dev/sda7 (My swap partition was number 7 - if yours is 5 use /dev/sda5 instead). Hit enter.
  • Type swapon /dev/sda7 (again, using the apprpriate swap partition number). Hit enter.
  • Verify status of swap space by typing free -m and press enter. If the last line starts with "Swap:" we're good.

Format and mount the root partition

  • Type gdisk -l /dev/sda, press enter and take note of the partition number of the Root part.
  • Type mkfs.ext4 -L /dev/sda8 (My root partition was number 7 - if yours is 6 use /dev/sda6 instead). Hit enter.
  • Type mount /dev/sda8 /mnt (again, using the apprpriate swap partition number). Hit enter.

Start the installation

  • Type pacstrap /mnt base, hit enter.

Mount the EFI partition

  • Type gdisk -l /dev/sda, press enter and take note of the partition number of the EFI part.
  • Type mount /dev/sda1 /mnt/boot/efi (My efi partition was number 1 - if yours is 2 use /dev/sda2 instead). Hit enter.

Configure the system

  • Type genfstab -U /mnt >> /mnt/etc/fstab. Hit enter.
  • Type cat /mnt/etc/fstab, press enter, to verify the file was created correctly.
  • Change root into the new installation: type arch-chroot /mnt and press enter.

Set the timezone

  • Type cd /usr/share/zoneinfo && ls press enter. Take note of the appropriate region and use it as follows...
  • Type cd <region> && ls (replacing <region> with the most appropriate region.) press enter. Take note of the most appropraite city.
  • Type ln -sf /usr/share/zoneinfo/<region>/<city> /etc/localtime (replacing <region> and <city> with the most appropriate region and city.)
  • Type hwclock --systohc. Hit enter.

Set the host

  • Create the file /etc/hostname and write your hostnme in it with nano or vim
  • Create the file etc/hosts and populate it like this (replacing myhostname with whatever you put in your hostname file.)
127.0.0.1	localhost
::1		localhost
127.0.1.1	myhostname.localdomain	myhostname

Create the root user's password

  • Type passwd and press enter
  • Enter a new root password and press enter. verify it and press enter.

Create new initramfs image

  • Type mkinitcpio -p linux. Hit enter.

Install Grub bootloader

  • Type pacman -Syu grub efibootmgr and hit enter.
  • Type pacman -Syu efibootmgr and hit enter.
  • Type grub-mkconfig -o /boot/grub/grub.cfg. Hit enter.
  • Type grub-install /dev/sda. Hit enter.
  • Verify the install... Type ls -l /boot/efi/EFI/arch/. Hit Enter. If you see a file called grubx64.efi then all is well.

Create new user

  • Type useradd -s /bin/bash -m username (replace "username" with the new user's name). Hit enter.
  • Type passwd username (replace "username" with the new user's name). Hit enter.
  • Enter and verify the password.

Install a desktop environment and some important packages

  • Type pacman -Syu gnome-desktop. Hit enter.
  • Type pacman -Syu gdm. Hit enter.
  • Type systemctl enable gdm. Hit enter.
  • Type pacman -Syu xterm. Hit enter.
  • Type pacman -Syu iw. Hit enter.
  • Type pacman -Syu dialog. Hit enter.
  • Type pacman -Syu vim. Hit enter.
  • Type pacman -Syu wpa_supplicant. Hit enter.
  • Type pacman -Syu os-prober. Hit enter.
  • Type grub-mkconfig -o /boot/grub/grub.cfg. Hit enter.

Unmount and reboot

  • Remove USB
  • Type exit. Hit enter.
  • Type umount -R /mnt. Hit enter.
  • Type reboot. Hit enter.
  • After a moment it will load back into Arch, this time with a desktop GUI.
@ilosrim
Copy link

ilosrim commented Aug 13, 2024

mount /dev/sda1 /mnt/boot/efi in this line, do we need to create the boot/efi folder first or not?

@dipeshsingh253
Copy link

mount /dev/sda1 /mnt/boot/efi in this line, do we need to create the boot/efi folder first or not?

Yes you will need to create the folder first.

@majva2137
Copy link

can i enable secure boot after installation?

probally not

@Vladislav-code254
Copy link

mount /dev/sda1 /mnt/boot/efi in this line, do we need to create the boot/efi folder first or not?

Yes you will need to create the folder first.

How can I do it?( I am completely newbie) cd /dev/sda1 /mnt/boot/efi?

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