Windows updates can sometimes overwrite the existing bootloader, leaving you without a way to boot into your Linux installation. If you have a dual-boot setup with Arch Linux and Windows 11, and a Windows update has removed your Linux bootloader, you can restore it using a bootable Arch Linux USB drive. This guide will take you through the process step-by-step.

Prerequisites

  1. A bootable Arch Linux USB drive.
  2. Basic understanding of Linux command-line operations.
  3. The ability to identify your root filesystem and EFI partition.

Steps to Restore systemd-boot

Step 1: Boot from the Arch Linux USB Drive

Insert the Arch Linux USB drive into your computer and boot from it. This usually involves pressing a key (such as F12, F2, Del, or Esc) during startup to select the boot device.

Step 2: Identify the Root Filesystem and EFI Partition

Once you are booted into the Arch Linux live environment, open a terminal and identify your root filesystem and EFI partition using the lsblk command:

lsblk

Look for your Linux root partition (usually something like /dev/sda2, /dev/nvme0n1p2, etc.) and your EFI partition (usually /dev/sda1, /dev/nvme0n1p1, etc.).

Step 3: Mount the Root Filesystem and EFI Partition

Mount your root filesystem to /mnt:

mount /dev/sdX2 /mnt

Replace /dev/sdX2 with your actual root partition identifier.

Next, create the boot directory and mount the EFI partition:

mkdir -p /mnt/boot
mount /dev/sdX1 /mnt/boot

Replace /dev/sdX1 with your actual EFI partition identifier.

Step 4: Chroot into the Installed System

To amend your installed system, you need to chroot into it. This can be done using the following commands:

arch-chroot /mnt

Step 5: Install or Update systemd-boot

Once chrooted into your system, you can install or update the systemd-boot loader. First, ensure that the bootctl command is available:

bootctl --path=/boot install

This command installs the systemd-boot loader to the EFI system partition and configures it.

Step 6: Verify the Boot Configuration

You should verify that your loader.conf and entries are properly set up. The loader.conf file should be located at /boot/loader/loader.conf. Ensure it has the following content:

default  arch
timeout  5
editor   0

Next, ensure that the entry for Arch Linux exists in /boot/loader/entries/arch.conf. It should look something like this:

title   Arch Linux
linux   /vmlinuz-linux
initrd  /initramfs-linux.img
options root=/dev/sdX2 rw

Make sure to replace /dev/sdX2 with your actual root partition identifier.

Step 7: Exit Chroot and Reboot

Exit the chroot environment:

exit

Unmount the filesystems:

umount -R /mnt

Reboot your system:

reboot

Upon rebooting, you should be greeted with the systemd-boot menu, allowing you to choose between Arch Linux and Windows 11.

Conclusion

Restoring your Linux bootloader after a Windows update can be a daunting task, but with the right tools and a clear set of instructions, it becomes manageable. By using a bootable Arch Linux USB drive, mounting your filesystems, and reinstalling systemd-boot, you can restore access to your Arch Linux installation. This guide provides a reliable method to recover your dual-boot setup and ensure that both your Windows 11 and Arch Linux systems are accessible. Happy dual-booting!

Restoring a Linux systemd-boot Loader on a Dual Boot Machine After a Windows 11 Update

Johannes Rest


.NET Architekt und Entwickler


Beitragsnavigation


Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert