Dual Boot Installation Guide of Arch Linux & Windows 10
2024-11-16  / Arch Linux Series

0. Introduction

☀ The weather is nice, perfect for reinstalling a dual boot (Windows 10 + Arch Linux (KDE)) on my personal laptop, the ThinkPad T470p. Here’s a system info screenshot from Arch Linux:

Arch_Linux_system_info.png

Currently, there are two storage drives: a 500GB HDD and a 250GB SSD. Both systems are installed on the SSD, while the HDD is used as a data storage drive for both systems. First, the Windows system is installed, followed by Arch Linux. The disk space allocation is as follows:

Disk Type Windows 10 Arch Linux
500G HD 140G for application data Remaining (approx. 325.76GB) for user home directory /home
250G SSD 500M EFI, 50M MSR, 100G OS Remaining (approx. 137.94GB) for root directory /

1. Installing Windows

1.1. Preparing the Windows System Image

Choose any version of Windows that you prefer:

Download URL:

Win10 image ed2k link:

1.2. Create a Bootable USB Drive (Using Rufus)

Use Rufus (Linux users can use dd) to create a bootable USB drive. Select the Windows 10 ISO image, set the partition scheme to GPT, and the target system type to UEFI. Leave other options as default, then click “Start”.

Rufus制作Win10启动U盘

1.3. Configure the BIOS

Insert the USB drive and restart the computer. Enter the BIOS settings menu:

  • Disable Secure Boot in the motherboard settings.
  • Set the boot mode to UEFI (UEFI Only).

1.4. Access the Boot Menu (Custom Installation)

After restarting, when you see the boot screen, press F12 repeatedly (or the key specific to your device) to enter the boot menu. Follow the on-screen instructions until you reach the installation type selection screen. Choose “Custom” at this stage.

win10安装类型选择

1.5. Disk Partitioning

Press Shift + F10 to open the Command Prompt window.

(1) Enter diskpart mode:

1
2
3
4
5
# Open Microsoft DiskPart partition tool
X:\Sources> diskpart

# View disk information:
DISKPART> list disk
进入diskpart模式

(2) Clear partitions on Disk 0 (Warning: This will format the disk. Please back up important data in advance)

1
2
3
4
5
6
7
8
# Select Disk 0 (500GB hard drive)
DISKPART> select disk 0

# Clear existing partitions and data on the hard drive
DISKPART> clean

# Convert the selected disk to GPT format
DISKPART> convert gpt
格式化disk0

(3) Clear partitions on Disk 1 (Note: This will format the disk. Please back up important data in advance)

1
2
3
4
5
6
7
8
9
10
11
# Select disk 1 (250G SSD)
DISKPART> select disk 1

# Clear existing partitions and data on the disk
DISKPART> clean

# Convert the currently selected disk to GPT format
DISKPART> convert gpt

# Verify the clearing result
DISKPART> list disk
格式化disk1

(4) System Partition

1
2
3
4
5
6
7
8
9
10
11
# Select disk 1 (SSD) as the system disk
DISKPART> select disk 1

# Create EFI partition 500M
DISKPART> create partition efi size=500

# Create MSR partition 50M
DISKPART> create partition msr size=50

# Create primary system partition 100G
DISKPART> create partition primary size=102400
系统分区disk1
1
2
3
4
5
# Confirm the current disk
DISKPART> list disk

# View the information of the created partitions
DISKPART> list partition
查看disk1分区结果

1.6. System Installation

After completing the partitioning, in the Windows installation location selection screen, click “Refresh” to display the result of the partitioning done through the command line, as shown in the following image:
选择安装win10的分区

Select “Drive 1 Partition 3” (the 100G space for system installation), and click “Next” to begin the Windows installation.
正在安装Windows

1.7. Installation Success

After the system is installed, it will automatically restart. At this point, you can remove the USB drive.
After rebooting, a series of configurations will take place, which will not be elaborated here.

After installation is successful, go to the Disk Management interface and allocate 140G from the 500G HD disk for personal application data storage, as shown in the following image:
win10磁盘管理

2. Install Arch Linux

When installing Arch Linux, you can refer to the official Arch Linux installation guide as the primary resource, with this document as a supplementary reference.

2.1. Prepare Arch Linux Image

You can visit the Arch Linux Downloads official website to choose and download the latest system package:

2.2. Create Bootable USB Drive (Using Rufus)

Select the Arch Linux iso image, use UEFI + GPT, and click Start to begin the writing process.
制作Arch Linux启动盘

When clicking Start, select “Write in DD image mode”:
以DD镜像写入

2.3. Boot into Live Environment

After restarting, when you see the boot screen, press F12 (this may vary depending on the machine) to enter the boot menu, usually selecting the first option by default.
When you see the following screen, it means the boot was successful.

成功进入Arch Linux

2.4. Verify Boot Mode

1
2
# If the result shows directories without errors, the system is booted in UEFI mode. Otherwise, it may be booted in BIOS mode.
root@archiso ~ # ls /sys/firmware/efi/efivars

2.5. Disable Reflector

1
2
# Disable reflector to prevent updating the mirrorlist automatically
root@archiso ~ # systemctl stop reflector.service

2.6. Connect to Network

You can first check if the wireless device is disabled:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Check the wireless device status
root@archiso ~ # rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
Soft blocked: no
Hard blocked: no
1: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
2: hci0: Bluetooth
Soft blocked: no
Hard blocked: no

# If Wireless LAN shows blocked: yes, it means the wireless connection is disabled
# Enable wireless connection (if not already disabled, skip the command below)
root@archiso ~ # rfkill unblock wifi

Use iwctl to connect to a wireless network:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# View network device information
root@archiso ~ # ip a

# Use iwctl to connect to WiFi
root@archiso ~ # iwctl
# List all WiFi devices
[iwd]# device list
# Scan for networks (wlan0 is your device)
[iwd]# station wlan0 scan
# List all available networks
[iwd]# station wlan0 get-networks
# Choose a wireless network to connect to (xixi is your network name)
[iwd]# station wlan0 connect xixi
Type the network passphrase for xixi psk.
Passphrase: # Enter password
# After successful connection, exit iwctl
[iwd]# exit

# Verify if the network connection was successful
root@archiso ~ # ping -c 5 baidu.com

For a wired connection, theoretically, just plug in the network cable, and you should be able to connect to the internet directly.

2.7. Update System Time

1
2
3
root@archiso ~ # timedatectl set-ntp true
# Check service status
root@archiso ~ # timedatectl status

2.8. Create Disk Partitions

(1) View Disk Information

1
2
3
4
5
# View Disk Information
root@archiso ~ # fdisk -l

# Alternatively, use lsblk to view the disks. Disks without partitions will not be displayed as blocks.
root@archiso ~ # lsblk

lsblk displays as shown in the following image:
lsblk展示磁盘信息

  • sda is a 500G hard drive, with 140G of sda1 used as the Win10 personal application data storage partition, and the remaining space allocated for the Arch Linux user home directory /home;
  • nvme0n1 is a 250G SSD, with 500M of nvme0n1p1 used for the Win10 EFI, 50M of nvme0n1p2 for the Win10 MSR, 99.4G (approximately 100G) of nvme0n1p3 for the Win10 system partition, nvme0n1p4 for the Win10 recovery system partition, and the remaining space allocated for the Arch Linux root directory /.

(2) Create/Format/Mount Root Directory

1
root@archiso ~ # cfdisk /dev/nvme0n1
  • Create Partition: Use the down arrow key to select the row at the bottom of the Device list that shows “Free space.” Choose “New” and press Enter. The “Partition size” at the bottom left will automatically fill with the current maximum available space on the disk (which can be modified). After confirming the partition size, press Enter.
  • Write Partition: Select “Write” and press Enter, then type yes to confirm writing the partition to the disk.
  • Exit cfdisk: Select “Quit” to exit.

At this point, you can use lsblk to view the newly added partition, such as a new partition nvme0n1p5 under nvme0n1.

  • Partition Formatting:
1
2
# Format the newly created partition to ext4 format. Ensure the partition number is nvme0n1p5.
root@archiso ~ # mkfs.ext4 /dev/nvme0n1p5
格式化nvme0n1p5为ext4
  • Mount Partition:
1
2
# Mount the root partition to `/mnt`
root@archiso ~ # mount /dev/nvme0n1p5 /mnt

Note: When mounting partitions, it’s essential to follow the correct order: first mount the root partition (to /mnt), then mount the boot partition (to /mnt/boot or /mnt/efi, if it’s separated), and finally mount any other partitions. Otherwise, you may encounter issues with booting the system after installation.

(3) Create/Format/Mount User Home Directory

1
root@archiso ~ # cfdisk /dev/sda

Create and write partitions as described above.

At this point, you can use lsblk to view the newly added partition, such as an additional partition sda2 under sda.

  • Partition Formatting:
1
2
# Format the newly created partition as ext4, ensuring the partition number is sda2
root@archiso ~ # mkfs.ext4 /dev/sda2
  • Mounting the Partition:
1
2
3
root@archiso ~ # mkdir /mnt/home
# Mount the user home directory to /mnt/home
root@archiso ~ # mount /dev/sda2 /mnt/home

(4) Mount EFI
Since it’s a dual-boot installation, the EFI partition for Arch Linux shares the one used by Windows.

1
2
3
4
root@archiso ~ # mkdir /mnt/efi

# Mount the EFI partition
root@archiso ~ # mount /dev/nvme0n1p1 /mnt/efi

(5) Confirm All Mounting Status
lsblk确认挂载情况

2.9. Install the Basic System

Before installation, consider changing to a domestic mirror source to speed up download speeds, such as USTC or Tsinghua. (For Chinese user!)

Use vim /etc/pacman.d/mirrorlist to modify the mirror sources, adding the following lines at the top:

1
2
3
4
# Tsinghua University
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
# USTC
Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch

Update the package cache:

1
root@archiso ~ # pacman -Syy

Install the base packages:

1
2
3
4
5
# Install the base software package, Linux kernel, and firmware for common hardware
root@archiso ~ # pacstrap /mnt base base-devel linux linux-firmware

# Install functional software: dhcpcd for wired, iwd for wireless, vim editor, sudo for privilege escalation
root@archiso ~ # pacstrap /mnt dhcpcd iwd vim sudo

2.10. Generate the fstab File

1
2
3
4
root@archiso ~ # genfstab -U /mnt >> /mnt/etc/fstab

# Check the generated fstab file
root@archiso ~ # cat /mnt/etc/fstab

2.11. Chroot

1
2
# Change root to the newly installed system
root@archiso ~ # arch-chroot /mnt

2.12. Set the Time Zone

1
2
3
4
5
6
7
# Set the time zone
[root@archiso /]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# Or
[root@archiso /]# timedatectl set-timezone Asia/Shanghai

# Synchronize the hardware clock
[root@archiso /]# hwclock --systohc

2.13. Set Locale

1
[root@archiso /]# vim /etc/locale.gen

Find the lines for en_US.UTF-8 UTF-8 and zh_CN.UTF-8 UTF-8, remove the # at the beginning of each line, and save and exit.

1
2
# Generate locale information
[root@archiso /]# locale-gen

Create and write to the /etc/locale.conf file: vim /etc/locale.conf
Add the following content: LANG=en_US.UTF-8
Exit and save.

2.14. Set the Hostname

Create and write the hostname: vim /etc/hostname
Add the following content (modify as needed): utopia

Modify the hosts file: vim /etc/hosts
Add the following content:

1
2
3
127.0.0.1   localhost
::1 localhost
127.0.0.1 utopia

Exit and save.

2.15. Set the Root User Password

Create a password for the root user:

1
[root@archiso /]# passwd root

2.16. Create the Bootloader

  • Install Microcode:
    If you’re unsure of your CPU model, you can install pacman -S neofetch to check your computer’s CPU model.
1
2
3
4
5
# For Intel CPUs, install intel-ucode
[root@archiso /]# pacman -S intel-ucode

# For AMD CPUs, install amd-ucode
[root@archiso /]# pacman -S amd-ucode

For UEFI boot mode, you need to install both grub and efibootmgr:

1
2
3
# grub is the bootloader, and efibootmgr is used by grub scripts to write boot entries to NVRAM
[root@archiso /]# pacman -S grub efibootmgr
[root@archiso /]# pacman -S os-prober dosfstools

Grub 2.06 update requires user intervention for os-prober:

  1. If you are using os-prober to generate boot entries for other systems, grub 2.06 no longer automatically enables os-prober. You need to add GRUB_DISABLE_OS_PROBER=false to the /etc/default/grub configuration file and re-run grub-mkconfig.
  2. Grub 2.06 will now automatically add firmware setup menu boot entries, eliminating the need to create them manually.

Given this, you need to manually enable os-prober to ensure Windows is correctly recognized:

1
[root@archiso /]# vim /etc/default/grub

Find an empty line and add: GRUB_DISABLE_OS_PROBER=false, then save and exit.

1
2
3
4
5
# Install the GRUB EFI application grubx64.efi to /efi and its modules to /boot/grub/x86_64-efi/
[root@archiso /]# grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB

# Generate grub.cfg
[root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg
安装grub引导程序

2.17. Complete the Installation

Exit the new system and unmount:

1
2
3
4
5
6
7
8
# Exit arch-chroot
[root@archiso /]# exit

# Unmount all
root@archiso ~ # umount -R /mnt

# Reboot, please remove the USB drive during startup
root@archiso ~ # reboot

After rebooting, log in with the root user and password.
Connect to the network:

1
2
3
4
5
6
7
# Start DHCP immediately
[root@utopia ~]# systemctl start dhcpcd

# For wireless connections, you need to start iwd and connect via iwctl
[root@utopia ~]# systemctl start iwd
# Connect using iwctl as mentioned above
[root@utopia ~]# iwctl

3. Arch Linux Desktop Environment and Common Applications

3.1. Set Up the archlinuxcn Repository and Install yay

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Modify /etc/pacman.conf and add the following at the end:
[archlinuxcn]
SigLevel = Optional TrustedOnly
Include = /etc/pacman.d/archlinuxcn

# Then create /etc/pacman.d/archlinuxcn and add:
# USTC
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch
# Tsinghua University
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch

# After setting up, update the package sources
[root@utopia ~]# pacman -Syyu
# Install the keyring
[root@utopia ~]# pacman -Sy archlinuxcn-keyring
# Install yay (Yet Another Yaourt): not included in the official repository, only available in archlinuxcn
[root@utopia ~]# pacman -S yay

The AUR is a software repository maintained by the Arch Linux community. The official address is: AUR (en) - Home (archlinux.org).
You can use AUR software through yaourt (previously popular but now discontinued) and yay (currently the preferred option).

3.2. Add a Non-root User (Set Up a Personal Account)

1
2
3
4
5
6
7
8
# The wheel group can use sudo for privilege escalation. -m creates the user's home directory, and ray is the username (set as needed).
[root@utopia ~]# useradd -m -G wheel -s /bin/bash ray
# Set a new password for the newly created user ray
[root@utopia ~]# passwd ray

# Edit the sudo file
[root@utopia ~]# EDITOR=vim visudo
# Find the line #%wheel ALL=(ALL) ALL and remove the # at the beginning, then :wq to save and exit.

3.3. Install Dual Graphics Card Driver

(0) Check Graphics Card Devices:

1
2
3
4
5
6
7
8
9
10
# Check graphics card information
$ lspci -k | grep -A 2 -E "(VGA|3D)"
# I have a dual graphics card:
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
Subsystem: Lenovo Device 505e
Kernel driver in use: i915
--
02:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940MX] (rev a2)
Subsystem: Lenovo Device 505e
Kernel modules: nouveau

(1) Install xorg:

1
2
3
# Essential for graphical interface
# xorg is a specific open-source implementation of X11, providing an X Server responsible for low-level operations. When you run a program, it connects to the X server, which handles keyboard and mouse input, manages screen output, window movement, window title styles, and more.
[root@utopia ~]# pacman -S xorg

It is recommended to use open-source drivers for all AMD graphics cards and closed-source drivers for NVIDIA graphics cards.

(2) Installing Intel Graphics:

1
[root@utopia ~]# pacman -S mesa lib32-mesa vulkan-intel lib32-vulkan-intel

Intel Graphics Wiki: Intel graphics - ArchWiki (archlinux.org)
Arch Wiki generally does not recommend installing xf86-video-intel, but instead using xorg’s modesetting driver (more stable).
Note: Only Intel HD 4000 and above integrated graphics support Vulkan.

(3) Installing NVIDIA Graphics Card:

1
2
3
# For GeForce 930 and above, 10 series to 20 series, Quadro / Tesla / Tegra K-series, and newer GPUs (NV110 and newer GPU families), install the nvidia package (for linux package) or nvidia-lts package (for linux-lts package).
# NVIDIA Installation Wiki: https://wiki.archlinuxcn.org/wiki/NVIDIA#%E5%AE%89%E8%A3%85
[root@utopia ~]# pacman -S nvidia

NVIDIA Wiki: NVIDIA - ArchWiki (archlinux.org)

(4) Installing Switchable Graphics Tool:

1
[root@utopia ~]# yay -S optimus-manager optimus-manager-qt

optimus-manager provides three modes: dedicated GPU only, integrated GPU only, and hybrid dynamic switching mode.

After installation, simply restart to use. Upon installation, optimus-manager will automatically enable its service. You can check its status before rebooting; if not enabled, you can sudo systemctl enable optimus-manager.

Reference:

3.4. Installing Graphic Interface - KDE Plasma

3.4.1. Installing KDE Desktop

1
2
3
4
5
6
7
8
# Install the plasma-meta meta package
[root@utopia ~]# pacman -S plasma-meta

# Install konsole terminal, dolphin file manager
[root@utopia ~]# pacman -S konsole dolphin

# Configure greeter sddm
[root@utopia ~]# systemctl enable sddm
  • KDE wiki: KDE (Simplified Chinese) - ArchWiki (archlinux.org)
  • The difference between meta package (such as plasma-meta) and package group (such as plasma) can be found here: Meta package and package group (Simplified Chinese) - ArchWiki (archlinux.org)
    plasma-meta: Meta package that installs software packages through dependencies. If new software packages are added later, they will be automatically installed during updates; users cannot choose to install only a part of the software that the meta package depends on.
    plasma: Package group that is just a list, providing similar functionality to plasma-meta. If new software packages are added later, they will not be automatically installed during updates; users can choose to install some software in the group or choose to only remove some software from the package group.

After rebooting, you can enter the KDE graphical interface. For more information on using KDE, you can refer to KDE UserBase.

3.4.2. Network Setup and Connection

After completing the reboot and entering the desktop by entering the user password, open the konsole command terminal to configure the network settings.

1
2
3
4
5
6
# Ensure that iwd is disabled at boot as its wireless connections may conflict with NetworkManager
$ sudo systemctl disable iwd
$ sudo systemctl stop iwd

# Make sure to start NetworkManager first and establish a network connection
$ sudo systemctl enable --now NetworkManager

3.4.3. Setting Up Swap File

In a desktop environment, a swap partition or file is used to implement hibernation, which saves the current environment to a swap file or partition on disk. The performance of swap files and partitions is similar, but swap files are more flexible, allowing for changes in size, addition, and deletion at any time.

1
2
3
4
5
6
7
8
# Create 16G of swap space, size can be adjusted as needed
$ dd if=/dev/zero of=/swapfile bs=1M count=16384 status=progress
# Set the correct permissions
$ chmod 600 /swapfile
# Format the swap file
$ mkswap /swapfile
# Enable the swap file
$ swapon /swapfile

Finally, append the following content to /etc/fstab: /swapfile none swap defaults 0 0
KDE itself provides an out-of-the-box suspend function, which suspends the system to memory, consuming only a small amount of power. Hibernate will suspend the system to a swap partition or file, consuming almost no power.

Hibernate function: Power management/Suspend and hibernate - ArchWiki (archlinux.org)

3.4.4. Install KDE Applications

Here is the translation, keeping the format intact:

3.4.4. Install KDE Applications

1
2
3
4
5
6
7
8
9
# Install the KDE application package repository: such as kde-applications or kde-applications-meta, you can also choose to install:
# It is recommended to install system utilities, which include basic applications required by the KDE desktop environment, such as the terminal tool Konsole, file editor Kate, dropdown terminal yakuake, compression tool Ark, etc.
$ sudo pacman -S kde-utilities

# Graphics tool collection, including image viewer Gwenview, PDF viewer Okular, screenshot tool Spectacle, etc.
$ sudo pacman -S kde-graphics

# System tool collection, including file manager dolphin, partition manager partitionmanager, etc.
$ sudo pacman -S kde-system

The above are optional installations. Alternatively, you can choose to install the full KDE suite. The kde-applications-meta / kde-applications package includes a variety of software, and while it offers a comprehensive set of applications, it also means the space usage after installation is quite large. It is generally not recommended to install it, and you can choose to install selectively based on your actual needs. For the difference between a meta package and a package group, refer to: Meta package and package group

1
2
3
4
5
# meta package
$ sudo pacman -S kde-applications-meta

# package group
$ sudo pacman -S kde-applications

References