Installation Guide (Dual Boot) Windows/Arch
Arch Linux and Windows Installation: UEFI and Encrypted (2019)
Arch Linux is my primary workstation OS. I run it as a dual boot alongside Windows. While I rarely boot the Windows partition, there are edge cases where it has come in use. Booting occurs with UEFI. Root volumes for both operating systems are encrypted. This guide describes that installation.
Installation Media
This section covers creating installation media for Windows and Arch Linux. You'll need 3 USB drives sized to at least 8GB. These steps cover media creation from a Windows (for the Windows 10 ISO) and Linux (for the Arch Linux ISO) workstations. There are many alternative ways to create installation media. If you choose to go with an alternative, skip this section.
Windows Installation Media
As of Windows 10, Microsoft requires you to download a tool to create windows installation media. This .exe
requires a Windows host to create the installation media. If you do not have a Windows host to run this installer, Microsoft offers a USB for purchase.
Windows did not historically have this restriction. For example, Windows 8. You could follow this guide using Window 8. To create installation media directly from an ISO, consider WoeUSB.
Arch Linux Installation Media
Download the Arch Linux ISO.
Insert a USB drive.
List block devices and determine the device name.
In the above example, the USB drive is
sda
.Write the ISO to the device using dd.
dd
: copies and converts a file based on arguments.bs
: amount of bytes to write at a time.if
: specify a file to read rather than stdin.of
: specify a file to write to rather than stdout.status
: level to log to stderr; progress shows periodic transfer stats.oflag
: set to sync synchronizes I/O for data and metadata.
BIOS Settings
Boot into BIOS.
Often accomplished by hitting F2 on start-up.
Verify UEFI booting is enabled.
Verify Secure Boot is disabled.
Arch Linux can be installed with Secure Boot. See https://wiki.archlinux.org/index.php/Secure_Boot
Installing Windows
This section covers installing Windows. Installing it first allows reuse of the Windows-created EFI partition. Using VeraCrypt, the Windows partition will be encrypted.
Insert the USB containing Windows.
Power on.
While booting, open the device boot menu.
Often achieved by hitting F12 during boot.
Select the USB device in UEFI mode.
If you boot in legacy mode, the Arch UEFI installation will not work.
Select the language to install and click Next.
Click Install now
Enter your product key and click Next.
Accept the license terms and click Next.
Click Custom: Install Windows only (advanced).
Delete all existing partitions.
Create a new partition of the size you'd like Windows to occupy.
Windows creates additoinal partitions including the 100.0MB System partition that will act as the EFI partition.
Click Next and wait for Windows to install.
After the installation completes, the machine will reboot.
After reboot, go through the Windows setup procedure.
Open Control Panel.
In the top right search, enter
power
.
Click
Change what the power buttons do
.Click
Change settings that are unavailble
.Uncheck
Turn on fast startup (recommend
To understand why fast startup is not recommended, seehttps://wiki.archlinux.org/index.php/Dual_boot_with_Windows#Fast_Start-Up
Open Start > Settings > Update & Security and Check for updates.
Allow all Windows updates to download and install before proceeding.
Download and install VeraCrypt.
Launch VeraCrypt.
Choose Normal.
Choose Encrypt the Windows system partition.
Choose Single-boot
While you will have a multi-boot system eventually. This installation will have grub point to veracrypt that will then decrypt and point to windows. Thus, vercrypt needs to know nothing about Linux.
Choose your preferred encryption algorithm and click Next.
Create a strong password.
Allow VeraCrypt to collect random data.
If desired, create a rescue disk.
This will require a USB drive to save to.
Choose your preferred Wipe Mode.
Run the System Encryption Pretest.
This will require your machine to be restarted.
Upon restart, enter your encryption password when prompted.
Log back in to your Windows system.
Click Encrypt and run the encryption.
This will encrypt the file system and take several minutes.
Allow the encryption to complete.
Power off the machine.
Installing Arch Linux
This section covers installing Arch Linux. Using Linux Unified Key Setup (LUKS), the root partition will be encrypted.
Insert the USB containing Arch Linux.
Boot the machine.
While booting, open the device boot menu.
Often a key like F12 launches the boot menu.
Select the USB device.
If legacy boot is enabled on your system, assure you're choosing to boot the USB via UEFI.
At the Arch Boot Menu, hit
e
at the menu to edit parameters.Add
nomodeset video=1280x760
to the end.This boots the installer in lower resolution making the console easier to see.
If
TODO: Prompt here
is seen on bootup, unplug and replug the USB.The media is re-detected and Arch Linux loads.
Run
wifi-connect
and select a wireless network.If plugged into ethernet, this step can be skipped.
Validate connectivity.
Disk Partitioning
List block devices to determine the name of the drive.
In the above, the drive is mapped to
/dev/nvme0n1
.Launch cgdisk for the drive above.
cgdisk
is a curses-based GUID partition table manipulator. Unlike the command-onlyfdisk
approach,cgdisk
provides a text-menu for writing partitions.Select the free space.
Choose
[ New ]
.Enter no value for First sector (chooses default).
This means the Linux partition starts directly at the end of the Windows partition. Some believe it is best to leave a small amount of free space between partitions. However, I have not had issues with this.
Enter no value for Size in sectors (chooses default).
This is the end size of the partition.
Enter no value for Hex code or GUID (chooses default).
Default is 8300, Linux filesystem. A list can be found athttps://gist.github.com/gotbletu/a05afe8a76d0d0e8ec6659e9194110d2
Name the partition
root
.Note the partition number of the EFI System partition. This will be reference later when configuring grub.
Choose
[ Write ]
and say yes.Choose
[ Quit ]
.
Encrypting and Configuring the Root Partition
Encrypt the root partition.
At the confirmation prompt, be sure to type
YES
in uppercase.-y
: interactively requests the passphrase twice.--use-random
: uses /dev/random to produce keys.luksFormat
: initializes a LUKS partition.
Open the LUKS device
luksOpen
: Opens the LUKS device and creates a mapping in/dev/mapper
.
Initialize the physical volume (PV).
Initialize a volume group (VG) on the new PV.
Create a logical volume (LV) on that VG named root.
-l +100%FREE
ensures the LV takes up all the space in the VG.
Run lsblk to view the new volume relationship.
Format the LV as a
ext4
file system.
Mounting and Installing
Mount the LV at
/mnt
.Create a
boot
directory at root.Mount the Window's created EFI partition to
/mnt/boot
.This is the partition you noted in the Disk Partitioning section.
Install packages on the root file system.
base
: common packages for Linux (https://www.archlinux.org/groups/x86_64/base).base-devel
:common package for development in Linux (https://www.archlinux.org/groups/x86_64/base-devel).grub
: (GRand Unified Bootloader) is a multi-boot loader.vim
: text editor.git
: version control system.efibootmgr
: userspace application used to modify the Intel Extensible Firmware Interface (EFI) Boot Manager.dialog
: A tool to display dialog boxes from shell scripts.intel-ucode
: processor microcode; assumes Intel x86 processor.
Generate file system table (fstab) for mounting partitions.
-u
: Use UUIDs for source identifiers.
Mount the hostlvm into the new root fs.
Without this, grub related commands may take forever. See https://bbs.archlinux.org/viewtopic.php?pid=1820949#p1820949 for context.
System Configuration
This section assumes you have chroot'ed into the new arch installation's file system. This was completed in the step before this section. If not, run the following command.
Set the timezone.
Set the Hardware Clock from the System Clock, and update the timestamps in /etc/adjtime.
Uncomment
en_US.UTF-8 UTF-8
in/etc/locale.gen
.Generate locale.
Set the
LANG
variable to the same locale in/etc/locale.conf
.Set your
hostname
.
Initial Ramdisk Configuration
The initial ramdisk is a root file system that will be booted into memory. It aids in startup. This section covers setup and generation of an mkinitcpio configuration for generating initramfs.
Add
encrypt
andlvm2
toHOOKS
in/etc/mkinitcpio.conf
(order matters).HOOKS
are modules added to the initramfs image. Withoutencrypt
andlvm2
, systems won't contain modules necessary to decrypt LUKs.Build initramfs with the
linux
preset.
GRUB Bootloader Setup
Determine the UUID of your root disk.
Use the UUID of the root partition (not the mapped volume group).
Edit the GRUB boot loader configuration.
Update the
GRUB_CMDLINE_LINUX
to match the formatcryptdevice=UUID=$ROOT_UUID:cryptroot,allow-discards,header
where$ROOT_UUID
is the UUID captured above.cryptroot
: TODOallow-discards
: TODOheader
: TODO
Uncomment
GRUB_ENABLE_CRYPTODISK=y
.Add grub menu item for Windows 10 by editing
/etc/grub.d/40_custom
.Install grub.
Generate the grub configuration.
User Administration
Set the root password.
Add a user.
-G
adds the user to a group.-m
creates a home directory.
Set the user's password.
Enter visudo.
visudo
edits the sudoers files at /etc/sudoers. It does this safely by acquiring a lock.Uncomment the lines that allow users of group
wheel
to sudo.
Rebooting
Exit the
arch-chroot
Unmount the partitions.
Reboot.
Using grub, login to Arch linux
Use
wifi-menu
to establish internet and begin installing packages.
Last updated