Dual booting Arch and Windows 11

Prerequisites

Before installing arch we need to do the following things

Disk partition

We’ll need to make a disk partition in windows 11 before proceeding to make sure both the OS run isolated, this can be done by the following steps

  1. Right-click on the Start menu and select Disk Management. Alternatively, you can press Win + X and choose Disk Management from the list.
  2. In the Disk Management window, locate the drive you want to partition (usually the C: drive). In my case I’ve installed in D drive on a separate disk
  3. Right-click on the drive and select Shrink Volume
  4. In the dialog that appears, enter the amount of space to shrink (in MB). This will be the size of the new partition for Arch Linux. Make sure to leave enough space for Windows. In my case I’ve allocated 100 gigs for Arch.
  5. Click Shrink. The unallocated space will appear in the Disk Management window. Disk configuration windows

Bios settings

Bios can be accessed by pressing Esc, F10, F2, F12 key on your keyboard while booting, please check your motherboard manufacturer or laptop to check it.

  1. Disable Fast Startup Fast startup
  2. Disable secure boot Disable secure boot

Arch ISO setup

  1. Download arch ISO from the official site.
  2. Install a tool such as Rufus or Etcher and burn the ISO onto a USB drive.

Booting onto Arch

  1. Insert the drive into the computer
  2. Restart the computer into the BIOS/UEFI/Bootloader menu
  3. Select the boot option as the USB drive Arch boot screen

Installing Arch

If you reached this step, it’s likely that you’ve done the following

  1. Reserved free storage in one of your windows disks
  2. Downloaded archlinux iso
  3. Made a bootable flash drive via Rufus, Balenaetcher, Raspberry Pi imager or any other software
  4. Rebooted the PC and selected the drive in the BIOS/UEFI
  5. You can see the arch terminal

Configuring the storage

  • Provided you’ve set up free storage in Windows disk manager you have to set up the following

The drives are not set up inially despite allocating free space in the windows disk manager, to do this you have to let the linux filesystem aware of the availablity of the free storage available. To do this follow the following steps

  1. Type in lsblk: After running this command you may see the avalable spaces. In the windows disk manager we had cleared out 97GB of storage, however we wont see it directly.

  2. Type in cfdisk/dev/<your-drive-name: In my case it was /dev/nvme1n1p1, drive letters will be different for each Free space

  3. Type in new and create two seperate partitions out of your reserved space. The partitions can be editing by using edit in the terminal utility

    • Partition 1
      • Type: EFI System
      • Size: 1GB
    • Partition 2
      • Type: Linux filesystem
      • Size: The rest of your reserved space

    Click on Write after doing this setup.
    WARNING: Be careful when using write, all the data within this volume will be deleted.
    Here is how it’ll look
    File system Type in lsblk to verify the new partitions lsblk after formatting

  4. Creating and mounting the file system

    • Use this command to make a FAT32 out of your 1GB partition: mkfs.fat -F32 /dev/<your-partition-name>
    • Use this command to make a ext4 for the rest of the data in your partiton: mkfs.ext4 /dev/<your-artition-name>
  5. Mounting the partitions

    • Mounting the main partition (the larger one): mount /dev/<your-partition-name> /mnt
    • Mounting the EFI partition (the smaller one): mount /dev/<your-partition-name> /mnt/boot
  6. Verify the install by using lsblk again and checking the correct mount locations. lsblk after formatting

Running the Archinstall script

The Archinstall script is a automated arch installer with minimal user input an a cli to do all the hardwork for you. You’d need to ensure that the disk configuration is already done before proceeding here.

  1. Running the archinstall script
    • Just type in archinstall
  2. You’d be presented with a CLI like this
    • Select the archinstall language that you want
    • Select your apt locale
    • Mirrors and reposiotries - add your location or the location of the mirror you wanna add
  3. Disk configuration Disc configuration You’d see a menu like this, since we had preconfigured our storage we can go ahead and use Pre-mounted configuration Disc selection Select your disk where you want to install
  4. Other settings
    • Enable swap
    • Add your hostname and host password
    • Add your username and password and set it as a sudo account
    • Use pipewire as the audio driver
    • Use linux as the kernal
    • Select your timezone
    • Disalbe automatic time sync if you don’t want to meddle with windows settings and DST isn’t a thing
  5. Within profile use Desktop > KDE Plasma (or any other install).
  6. Click on install

Crutial services

  1. Wi-Fi

    The initial usb boot environment will not work if not connected to the internet for installing packages and profiles. You can connect to the internet via Wi-Fi and Ethernet. Ethernet and mobile wired hotspot will work out of the box and can be tested by pinging a site i.e.

    1
    
    ping google.com
    

    use ctrl + c after a couple of pings to stop the utility.
    However Wi-Fi would not work directly, so we have to use an utility called iwctl, you can click here to learn more.

Apps and user config

Pacman

Lets first see the base docs of pacman

The pacman command is a package manager used in Arch Linux and its derivatives to manage software packages. Here’s a basic guide on how to use it:

  1. Update Package Database:

    1
    
    sudo pacman -Sy
    

    Updates the package database to the latest version.

  2. Upgrade All Packages:

    1
    
    sudo pacman -Su
    

    Upgrades all installed packages to their latest versions.

  3. Install a Package:

    1
    
    sudo pacman -S package_name
    

    Replace package_name with the name of the package you want to install.

  4. Remove a Package:

    1
    
    sudo pacman -R package_name
    

    This removes the specified package.

  5. Remove a Package and Its Dependencies:

    1
    
    sudo pacman -Rns package_name
    

    This removes the package along with its unused dependencies.

  6. Search for a Package:

    1
    
    pacman -Ss search_term
    

    This searches the package database for the specified term.

  7. Show Package Information:

    1
    
    pacman -Si package_name
    

    Displays detailed information about a specified package.

  8. List Installed Packages:

    1
    
    pacman -Q
    
  9. Check for Package Updates:

    1
    
    pacman -Qu
    

    Lists all packages that have updates available.

Additional options

  • Verbose Mode: Add v for verbose output.
  • Help: Use pacman -h to see all available options.

My installed pacman packages

  1. Zsh - Ref

    1. Setup and install

      1
      2
      3
      
      sudo pacman -S zsh
      chsh -s $(which zsh) # enter your password when prompted
      sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" # this will install zsh
      
    2. My configuration - extensions Ref

      Extensions list

      1. Zsh autosuggest
      2. Zsh syntax highlight
      3. You should use
      4. Zsh-bat
      1
      2
      3
      4
      5
      
      # cloning all the repos
      git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
      git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
      git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $ZSH_CUSTOM/plugins/you-should-use
      git clone https://github.com/fdellwing/zsh-bat.git $ZSH_CUSTOM/plugins/zsh-bat
      

      Now go to the line that says plugins=(git) and replace them with the following. The source file is located at ~/.zshrc, and can be accessed through vim ~/.zshrc or nano ~/.zshrc.

      1
      
      plugins=(git zsh-autosuggestions zsh-syntax-highlighting you-should-use zsh-bat)
      

      A note that bat needs a package dependency also, this may be done via running the following command

      1
      
      sudo pacman -S bat
      

      Now refresh the shell by using

      1
      
      source ~/.zshrc
      
    3. Configuring the theme

      • Prerequisites: For some of the theme to work you’ll need to install a nerd font something like ttf-nerd-fonts-symbols would do the trick. This can be installed throgh

        1
        
        sudo pacman -Syu ttf-nerd-fonts-symbols
        

      For this install we are going to use powerlevel10k, via this command

      1
      
      git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
      

      then we are going to configure the ~/.zshrc file to reflect the theme, this can be done via opening the ~/.zshrc file and paste the following

      1
      2
      
      # file can be opened by
      nano ~/.zshrc
      

      paste the following in place of ZSH_THEME="robbyrussell

      1
      
      ZSH_THEME="powerlevel10k/powerlevel10k"
      
  2. NodeJS: For installing the 20x version we are using the following command

    1
    
    sudo pacman -S nodejs npm
    
  3. Pip: A package manager for python

    1
    
    sudo pacman -S python-pip
    
  4. Hugo: A static site builder

    1
    
    sudo pacman -S hugo
    
  5. LibreOffice: Documentation and productivity suite

    1
    
    sudo pacman -S libreoffice-fresh # or libreoffice-still for stable version 
    
  6. Neovim: CLI based text editor

    1
    
    sudo pacman -S neovim
    

    Optional: I’ve set up neovim kickstart to quick start neovim.

AUR

  1. Setting up yay and basics of AUR

    For the initial setup of the AUR first you need to update all the packages inside it this can be done via. Then install the packages. This can be checked below. Ref.

    1
    2
    
    sudo pacman -Syu
    sudo pacman -S git base-devel
    

    Firstly we need to install yay which is a helper for installing software via AUR this can be done by the following commands

    1
    2
    3
    
    git clone https://aur.archlinux.org/yay.git
    cd yay
    makepkg
    

    if the program doesn’t compile then you may need to install the following dependencies (optional)

    1
    2
    
    sudo pacman -Syu go
    makepkg
    

    now we can install yay via pacman

    1
    
    sudo pacman -U yay-12.4.2-1-x86_64.pkg.tar.zst
    

    the install can be checked and verified via

    1
    
    yay -h
    
  2. My AUR packages

    Note: Packages installed via yay may not need sudo privalages

    1. Notion: A note taking app

      1
      
      yay -S notion-app-electron
      
    2. VSCode (official version): Text ediitor by microsoft

      1
      
      yay -S visual-studio-code-bin
      
    3. Google Chrome: Web browser

      1
      
      yay -S google-chrome
      

Additional settings

  1. Battery threshold

    In a laptop where the laptop is always plugged in it is important to set up a battery threshold to preserve the battery life. In KDE Plasma 6 this feature is already baked in, however in Plasma 6.2.1 (the one which I’m using the time of writing) resets the threshold value on every boot, this can be fixed in the following way. Ref.

    To achieve this i did the following steps

    1. Create a service - I named it kde-battery-threshold-workaround.service, this can be located in /etc/systemd/system

    2. Paste the following in it

       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      
      [Unit]
      Description=Set Battery Charge Control Threshold
      
      [Service]
      ExecStart=/usr/bin/sudo /bin/sh -c 'echo "60" > /sys/class/power_supply/BAT1/charge_control_end_threshold' # you can change this line accordingly to your battery dir
      Type=oneshot
      RemainAfterExit=yes
      ExecStartPre=/bin/sleep 10
      
      [Install]
      WantedBy=multi-user.target
      
    3. Run the following commands

      1
      2
      3
      4
      
      sudo systemctl daemon-reload
      sudo systemctl enable kde-battery-threshold-workaround.service
      sudo systemctl start kde-battery-threshold-workaround.service
      sudo systemctl daemon-reload
      
  2. Git setup

    1
    2
    
      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"
    
  3. GRUB setup

    GRUB by default may not show all the OSes listed in the computer, and will usually skip the Windows OS and skip to direct Arch installation. While you may still enter windows through the motherboard’s boot manager it’s better to have the option to boot into windows through GRUB itself.

    1. Install os-prober and NTFS file system support
    1
    
    sudo pacman -S os-prober ntfs-3g
    
    1. Open grub configuration
    1
    
    sudo vim /etc/default/grub # or use nano 
    
    1. Uncomment this add, or if the comment is not present add this line, typically present in the end of the file of GRUB configuration
    1
    
    GRUB_DISABLE_OS_PROBER=false
    
    1. Remake the grub configuration
    1
    
    sudo grub-mkconfig -o /boot/grub/grub.cfg
    
    1. Reboot the system and check if the windows settings pops up