CachyOS Cachy Chroot Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki

CachyOS Cachy Chroot Guide

Complete beginner-friendly guide to using cachy-chroot on CachyOS for system maintenance, recovery, and advanced operations.


Table of Contents

  1. Understanding Chroot
  2. What is cachy-chroot?
  3. Installing cachy-chroot
  4. Basic Usage
  5. Common Use Cases
  6. Advanced Operations
  7. Troubleshooting

Understanding Chroot

What is Chroot?

Chroot (change root) changes the apparent root directory for a process.

What it does:

  • Isolates environment: Creates isolated system environment
  • Changes root: Makes directory appear as root filesystem
  • System maintenance: Access system for repairs
  • Recovery: Fix system issues

Why use chroot:

  • System repair: Fix broken system
  • Package management: Install packages in isolated environment
  • Recovery: Recover from boot issues
  • Testing: Test system changes safely

What is cachy-chroot?

CachyOS Chroot Tool

cachy-chroot is CachyOS's custom chroot helper tool.

What it does:

  • Simplifies chroot: Makes chroot easier to use
  • Automatic setup: Handles chroot setup automatically
  • CachyOS optimized: Optimized for CachyOS systems
  • User-friendly: Easier than manual chroot

Advantages:

  • Easier: Simpler than manual chroot
  • Automatic: Handles setup automatically
  • Safe: Built-in safety checks
  • Convenient: Quick access to chroot

Installing cachy-chroot

Installation

Check if installed:

pacman -Q cachy-chroot

Install cachy-chroot:

sudo pacman -S cachy-chroot

What this does:

  • Installs cachy-chroot tool
  • Makes chroot available
  • Ready to use

Basic Usage

Entering Chroot

Basic chroot:

sudo cachy-chroot

What this does:

  • Enters chroot environment
  • Mounts necessary filesystems
  • Provides system access

Chroot to specific directory:

sudo cachy-chroot /path/to/root

What this does:

  • Chroots to specific directory
  • Useful for different root directories
  • Custom chroot location

Exiting Chroot

Exit chroot:

exit

What this does:

  • Exits chroot environment
  • Returns to normal shell
  • Unmounts filesystems

Or press:

  • Ctrl+D: Exits chroot

Common Use Cases

System Repair

Fix broken system:

  1. Boot from live USB
  2. Mount system partition
  3. Enter chroot:
    sudo cachy-chroot /mnt
    
  4. Fix issues
  5. Exit chroot

What you can do:

  • Reinstall packages
  • Fix configuration files
  • Update system
  • Repair bootloader

Package Management

Install packages in chroot:

sudo cachy-chroot
pacman -S package-name
exit

What this does:

  • Enters chroot
  • Installs package
  • Exits chroot

Update system in chroot:

sudo cachy-chroot
pacman -Syu
exit

What this does:

  • Updates system in chroot
  • Useful for system maintenance
  • Safe system updates

Bootloader Repair

Repair bootloader:

sudo cachy-chroot /mnt
bootctl install  # For systemd-boot
# or
grub-install /dev/sda  # For GRUB
exit

What this does:

  • Repairs bootloader
  • Fixes boot issues
  • Restores boot functionality

Advanced Operations

Custom Chroot Setup

Manual chroot setup:

# Mount filesystems
sudo mount /dev/sda2 /mnt
sudo mount /dev/sda1 /mnt/boot
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys

# Enter chroot
sudo chroot /mnt

What this does:

  • Manually sets up chroot
  • Mounts necessary filesystems
  • Provides full system access

cachy-chroot does this automatically!

Network in Chroot

Enable network in chroot:

sudo cachy-chroot --network

What this does:

  • Enables network access in chroot
  • Allows downloading packages
  • Useful for updates

Troubleshooting

Chroot Not Working

Check mount points:

mount | grep /mnt

What this does:

  • Shows mounted filesystems
  • Verifies mounts are correct
  • Helps identify issues

Remount if needed:

sudo mount -o remount,rw /mnt

What this does:

  • Remounts as read-write
  • Fixes permission issues
  • Allows modifications

Permission Issues

Check permissions:

ls -la /mnt

What this does:

  • Shows directory permissions
  • Verifies access
  • Helps fix permission issues

Fix permissions:

sudo chmod 755 /mnt

What this does:

  • Fixes directory permissions
  • Allows access
  • Resolves permission issues

Additional Resources


Summary

This guide covered:

  1. Understanding chroot - What chroot is and why it matters
  2. cachy-chroot - CachyOS chroot tool
  3. Installation - Installing cachy-chroot
  4. Basic usage - Entering and exiting chroot
  5. Common use cases - System repair, package management
  6. Advanced operations - Custom setup, network access
  7. Troubleshooting - Common issues and solutions

Key Takeaways:

  • cachy-chroot simplifies chroot operations
  • Use for system repair and maintenance
  • Automatically handles filesystem mounting
  • Safe way to access system for repairs
  • Exit with exit or Ctrl+D
  • Use --network flag for network access

This guide is based on the CachyOS Wiki and expanded with detailed explanations for beginners. For the most up-to-date information, always refer to the official CachyOS documentation.