Skip to content

Instantly share code, notes, and snippets.

@evanesoteric
Created June 3, 2025 01:54
Show Gist options
  • Select an option

  • Save evanesoteric/2fe9e6e3b8a140a017ad8f8dc344d3ad to your computer and use it in GitHub Desktop.

Select an option

Save evanesoteric/2fe9e6e3b8a140a017ad8f8dc344d3ad to your computer and use it in GitHub Desktop.
Artix linux rescue/recovery instructions.
## Identify drives and partitions
# lsblk # List block devices in tree format
# lsblk -f # List with filesystem information
# blkid # Display block device attributes (UUID, filesystem type, etc.)
# Unlock the encrypted LUKS partition
cryptsetup open /dev/nvme0n1p1 luksroot
# - /dev/nvme0n1p1: The encrypted partition (NVMe SSD, first partition)
# - luksroot: Name for the decrypted device mapper (/dev/mapper/luksroot)
# Mount the root filesystem
mount /dev/mapper/luksroot /mnt
# Maps the decrypted volume to /mnt for access
# Create and mount EFI boot partition
mkdir -p /mnt/boot/efi # Create EFI directory structure
mount /dev/sda1 /mnt/boot/efi # Mount EFI system partition (separate drive/partition)
# Bind mount essential system directories for chroot environment
mount --rbind /dev /mnt/dev # Device files (recursive bind mount)
mount --rbind /proc /mnt/proc # Process information filesystem
mount --rbind /sys /mnt/sys # System information filesystem
mount --rbind /run /mnt/run # Runtime data (systemd, udev, etc.)
# Copy DNS configuration to chroot environment
cp /etc/resolv.conf /mnt/etc/
# Ensures network name resolution works inside chroot
# Enter the chroot environment
chroot /mnt /bin/bash
# Changes root directory to /mnt, allowing you to work as if booted into the system
## --- Inside chroot environment ---
# Update package repositories and upgrade all packages
pacman -Syyu
# -S: sync packages, -yy: force refresh, -u: upgrade
# Rebuild initial RAM filesystem
mkinitcpio -P
# -P: rebuild all presets (important after kernel updates or encryption changes)
# Reinstall kernel (ensures latest version and proper initramfs)
pacman -S linux # Standard kernel
# pacman -S linux-lts # Alternative: Long Term Support kernel
# Install/reinstall GRUB bootloader
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --removable
# --target=x86_64-efi: UEFI 64-bit target
# --efi-directory: Location of EFI system partition mount
# --bootloader-id: Name in UEFI boot menu
# --removable: Creates fallback bootloader for portability
# Generate GRUB configuration file
grub-mkconfig -o /boot/grub/grub.cfg
# Detects kernels and creates boot menu entries
# Exit chroot environment
exit
## --- Back in live environment ---
# Unmount all mounted filesystems
umount -R /mnt
# -R: recursive unmount (unmounts all nested mounts)
# Close/lock the LUKS encrypted volume
cryptsetup close luksroot
# Securely closes the decrypted mapping
# Restart the system
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment