|
| 1 | +--- |
| 2 | +title: CachyOS chroot Helper |
| 3 | +description: Helper tool to make it easier to chroot into systems |
| 4 | +--- |
| 5 | + |
| 6 | +[**`cachy-chroot`**](https://github.com/CachyOS/cachy-chroot) is a simple helper program to ease the process of chrooting into existing |
| 7 | +CachyOS or any Arch-based install. It lists all the partitions discovered on the machine and also supports listing BTRFS subvolumes. |
| 8 | +Last but not least, `cachy-chroot` also supports encrypted systems via LUKS. It will map each `fstab` entries to its designated `crypttab` |
| 9 | +entries and will close all LUKS volumes gracefully when exitting the chroot. |
| 10 | + |
| 11 | +## Usage |
| 12 | + |
| 13 | +The process of chrooting **must** be done on a live ISO. Below is an example of using `cachy-chroot` in a CachyOS BTRFS install. |
| 14 | + |
| 15 | +```sh title="chrooting with cachy-chroot" |
| 16 | +❯ sudo su # Enter the root user within the live ISO |
| 17 | +❯ pacman -Sy cachy-chroot # Ensure that cachy-chroot is at the latest version |
| 18 | +❯ cachy-chroot |
| 19 | +Info: Found 3 block devices |
| 20 | +Info: Found partition: Partition: /dev/nvme0n1p1: FS: vfat UUID: EDA6-ED98 |
| 21 | +Info: Found partition: Partition: /dev/nvme0n1p2: FS: btrfs UUID: b09a027e-a61d-424f-858f-2e02be61b342 |
| 22 | +Info: Found partition: Partition: /dev/nvme0n1p4: FS: btrfs UUID: 66e84339-8c77-4131-afce-50ec2cf67a80 |
| 23 | +? Select the block device for the root partition (use arrow keys): › |
| 24 | + Partition: /dev/nvme0n1p1: FS: vfat UUID: EDA6-ED98 |
| 25 | +❯ Partition: /dev/nvme0n1p2: FS: btrfs UUID: b09a027e-a61d-424f-858f-2e02be61b342 |
| 26 | + Partition: /dev/nvme0n1p4: FS: btrfs UUID: 66e84339-8c77-4131-afce-50ec2cf67a80 |
| 27 | +✔ Select the block device for the root partition (use arrow keys): · Partition: /dev/nvme0n1p2: FS: btrfs UUID: b09a027e-a61d-424f-858f-2e02be61b342 |
| 28 | +Info: Selected BTRFS partition, mounting and listing subvolumes... |
| 29 | +Info: Mounting partition /dev/nvme0n1p2 at /tmp/cachyos-chroot-temp-mount-b09a027e-a61d-424f-858f-2e02be61b342-hwAeIm with options: [] |
| 30 | +Info: Unmounting partition at /tmp/cachyos-chroot-temp-mount-b09a027e-a61d-424f-858f-2e02be61b342-hwAeIm |
| 31 | +? Do you want to use CachyOS BTRFS preset to auto mount root subvolume? (y/n) › # Enter y if on CachyOS |
| 32 | +``` |
| 33 | + |
| 34 | +After selecting the root partition, you will also be prompted to mount additional partitions, e.g. your `/boot` partition |
| 35 | + |
| 36 | +```sh title="Mounting additional partitions" |
| 37 | +✔ Do you want to mount additional partitions? · yes |
| 38 | +? Enter the mount point for additional partition (e.g. /boot) type 'skip' to cancel: › # /boot on systemd-boot, /boot/efi on GRUB and rEFInd |
| 39 | +``` |
| 40 | + |
| 41 | +When you are done, you can exit the chroot environment by passing `exit` to the prompt or pressing `CTRL+D` in your keyboard |
| 42 | + |
| 43 | +```sh title="Exiting chroot" |
| 44 | +exit |
| 45 | +``` |
| 46 | + |
| 47 | +## Learn More |
| 48 | + |
| 49 | +- [Arch Wiki - chroot](https://wiki.archlinux.org/title/Chroot) |
| 50 | + |
0 commit comments