I recently wanted to install Arch Linux onto a second drive on my Windows desktop, but didn't have a flash drive around. Eventually, I figured out how to use Windows Subsystem for Linux (WSL) instead of the installation medium to install Arch Linux on my second drive with the GRUB boot loader. I could not find any information on how to do this, so I had to figure it out mostly on my own. I wrote this guide to help anyone who wishes to try this installation method too!
PowerShell (Administrator):
wsl --install
Follow instructions at https://github.com/yuk7/ArchWSL and make sure you have an adequate environment to work in.
PowerShell (Administrator):
wmic diskdrive list brief
wsl --mount \\.\PHYSICALDRIVE1 --bare
Replace \\.\PHYSICALDRIVE1
with correct drive from first command.
Using ArchWSL and following the ArchWiki Installation Guide, start at (1.9) Partition the disks with modifications to the following sections:
Same as normal install, but you might need to install dosfstools
for Fat32. This guide is for booting in UEFI mode.
Instead of mounting to /mnt
, I recommend mounting to another location such as /home/$USER/mnt
to prevent confusion with WSL.
Also install grub
, os-prober
, a text editor, and other necessary packages like networkmanager
or another network daemon.
You might have to genfstab
outside of chroot, then copy it manually into /etc/fstab
after next step.
Make sure to use the mounting location you selected in (1.11).
Using ArchWSL,grub-install
will fail to add the EFI entry because WSL does not contain the efivarfs kernel module. To workaround this you will need to use GRUB on Windows. Additionally, the GRUB for Windows x86_64-efi kernel has a bug which prevents it from booting (https://savannah.gnu.org/bugs/?64482), so you will need to run grub-install
in ArchWSL after doing so in Windows.
PowerShell (Administrator):
wsl --shutdown
The EFI partition you created should mount in Windows and be visible in File Explorer.
Download latest grub-for-windows binaries from https://ftp.gnu.org/gnu/grub/ and unzip.
PowerShell (Administrator):
.\grub-install.exe --target=x86_64-efi --efi-directory=D:\\ --bootloader-id=GRUB
Make sure --efi-directory
is the EFI partition you created in the previous steps and not a Windows partition.
PowerShell (Administrator):
wsl --mount \\.\PHYSICALDRIVE1 --bare
Replace \\.\PHYSICALDRIVE1
with correct drive from previous steps.
Use ArchWSL and follow previous recommendations in (1.11) and (3.2).
This will fix the bugged GRUB kernel installed under GRUB for Windows.
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
Make sure --efi-directory
is the EFI partition you created in the previous steps and not a Windows partition.
Close everything, reboot into BIOS, and set GRUB to be the first boot priority and disable secure boot if you have not set it up. GRUB should load and boot into Arch Linux.
It is likely that GRUB was unable to add a Windows boot entry because the Windows EFI partition is not available under WSL. To fix this, boot into the system and reconfigure GRUB to use os-prober.
In /etc/default/grub
, uncomment:
GRUB_DISABLE_OS_PROBER=false
Mount the Windows EFI partition anywhere then run:
sudo os-prober
grub-mkconfig -o /boot/grub/grub.cfg