Skip to content

Instantly share code, notes, and snippets.

@bunkbail
Created January 23, 2026 00:40
Show Gist options
  • Select an option

  • Save bunkbail/192e3f8f311879f7f40db901bd9f64de to your computer and use it in GitHub Desktop.

Select an option

Save bunkbail/192e3f8f311879f7f40db901bd9f64de to your computer and use it in GitHub Desktop.
Complete tutorial for installing Chimera Linux with GNOME, Btrfs on NVMe, and Hibernation

Complete tutorial for installing Chimera Linux with GNOME, Btrfs on NVMe, and Hibernation (Swapfile).

Phase 1: Partitioning & Formatting

  1. Switch to Root:

    doas -s
  2. Partition the NVMe Drive:

    cfdisk /dev/nvme0n1
    • Label Type: gpt
    • Partition 1: 1G (Type: EFI System)
    • Partition 2: Remaining space (Type: Linux Filesystem)
    • Write and Quit.
  3. Format Partitions:

    mkfs.vfat -F32 -n EFI /dev/nvme0n1p1
    mkfs.btrfs -L chimera_root /dev/nvme0n1p2

Phase 2: Btrfs Subvolumes & Mounting

We need a dedicated subvolume for the swapfile to ensure we can easily mount it with the nodatacow (No Copy-on-Write) option, which is mandatory for Btrfs swapfiles.

  1. Mount Root to Create Subvolumes:

    mount /dev/nvme0n1p2 /mnt
    btrfs subvolume create /mnt/@
    btrfs subvolume create /mnt/@home
    btrfs subvolume create /mnt/@swap
    umount /mnt
  2. Mount the Target Hierarchy:

    # Mount Root (@) with compression
    mount -o noatime,compress=zstd,subvol=@ /dev/nvme0n1p2 /media/root
    
    # Create Mount Points
    mkdir -p /media/root/home
    mkdir -p /media/root/boot/efi
    mkdir -p /media/root/swap
    
    # Mount Home (@home)
    mount -o noatime,compress=zstd,subvol=@home /dev/nvme0n1p2 /media/root/home
    
    # Mount EFI
    mount /dev/nvme0n1p1 /media/root/boot/efi
    
    # Mount Swap (@swap) with NoCOW
    # Crucial: nodatacow must be set on mount for the swapfile to work reliably
    mount -o nodatacow,subvol=@swap /dev/nvme0n1p2 /media/root/swap

Phase 3: Installation & Chroot

  1. Bootstrap the System:

    chimera-bootstrap /media/root
  2. Generate Fstab:

    genfstab -U /media/root > /media/root/etc/fstab
  3. Enter Chroot:

    chimera-chroot /media/root

Phase 4: Software Installation (GNOME)

Inside the chroot:

  1. Update Repositories:

    apk update
    apk upgrade --available
  2. Install Base, Kernel, GNOME, and Tools:

    # base-full: Standard tools
    # linux-lts: Kernel
    # gnome: Desktop Environment (includes GDM)
    # networkmanager: Network management (standard for GNOME)
    # btrfs-progs: Required for filesystem management
    apk add base-full linux-lts gnome networkmanager btrfs-progs
  3. User Setup:

    # Set Hostname
    echo "chimera-laptop" > /etc/hostname
    
    # Set Root Password
    passwd root
    
    # Create User (Add to wheel for doas)
    useradd -m -G wheel myuser
    passwd myuser

Phase 5: Enabling Services (Symlinks)

Since dinitctl doesn't work in chroot, we manually link the service files from their install location (/usr/lib/dinit.d) to the boot runlevel directory (/etc/dinit.d/boot.d).

  1. Enable GDM (Display Manager):

    ln -s /usr/lib/dinit.d/gdm /etc/dinit.d/boot.d/gdm
  2. Enable NetworkManager:

    ln -s /usr/lib/dinit.d/NetworkManager /etc/dinit.d/boot.d/NetworkManager

    Note: Other standard services (like udev) are usually enabled by default via the base-full package links.


Phase 6: Hibernation Swapfile Setup

You have 32GB RAM. We will create a 34GB swapfile in the @swap subvolume.

  1. Create the Swapfile:

    # Create an empty file first
    truncate -s 0 /swap/swapfile
    
    # Set NoCOW attribute (redundant if mounted with nodatacow, but good practice)
    chattr +C /swap/swapfile
    
    # Allocate 34GB of space
    fallocate -l 34G /swap/swapfile
    
    # Set permissions
    chmod 600 /swap/swapfile
    
    # Format as swap
    mkswap /swap/swapfile
    
    # Turn it on (temporarily, to test)
    swapon /swap/swapfile
  2. Add to Fstab: We need to ensure this mounts on boot.

    echo "/swap/swapfile none swap defaults 0 0" >> /etc/fstab
  3. Calculate Resume Offset (Critical): The kernel needs the physical offset of the file on the NVMe drive. Run this command:

    btrfs inspect-internal map-swapfile -r /swap/swapfile

    Write down the number output by this command. (e.g., 53600)


Phase 7: Bootloader (GRUB) & Hibernation Config

  1. Install GRUB:

    apk add grub-x86_64-efi
  2. Get the UUID of the Root Partition:

    blkid /dev/nvme0n1p2

    Copy the UUID="..." string (not PARTUUID).

  3. Edit GRUB Configuration: Open the config file:

    vi /etc/default/grub
    # or install nano with: apk add nano && nano /etc/default/grub

    Find GRUB_CMDLINE_LINUX_DEFAULT. You need to add resume (the UUID of the disk) and resume_offset (the number from Phase 6).

    It should look like this:

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=YOUR-COPIED-UUID resume_offset=YOUR_OFFSET_NUMBER"
  4. Install and Update GRUB:

    # Install to EFI partition
    grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=CHIMERA
    
    # Generate config
    update-grub
  5. Update Initramfs: Ensure the initramfs is aware of the changes.

    update-initramfs -c -k all

Phase 8: Finish

  1. Exit Chroot:

    exit
  2. Unmount:

    umount -R /media/root
  3. Reboot:

    reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment