-
Notifications
You must be signed in to change notification settings - Fork 14
2) Tutorials
This tutorial is for those who don't want to do any manual configuration, just a simple isolated chroot container. Take a look at the options for ChArch with charch -h
if you'd like to try more advanced configurations.
Let's start!
-
First, find the rootfs tarball of your choice for your desired distro. For this example, we will be using the ARM Arch Linux rootfs tarball from the official mirrors.
-
With root permissions, type
charch -n -u <url>
. For an aarch64 device, the command would look likecharch -n -u "http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz"
. This will fetch the latest rootfs tarball from Arch Linux directly and automatically configure and enter it. If all goes well, you should be logged in as root in your Arch Linux instance. Note that on your next login, you will not need the-n
or-u
options, as your rootfs instance has already been created. If you get an error, head over to issues and provide a log to find help on fixing the bug. -
The first thing you may want to do is update your packages. Type
pacman -Syu
and confirm your upgrades. If you are using the bootstrap rootfs tarball, this may not work as your pacman repositories are not setup. You will need to configure this manually. -
Once you are finished in your Arch Linux instance, type
exit
to return to your host terminal. -
You may want to unmount your host partitions from the Arch Linux instance. Type
unarch
to kill any running processes and proceed with the unmount. If you receive an error stating that the unmount failed, you may need to either manually kill any running processes in the Arch Linux instance, or reboot your host device to kill everything and unmount automatically.
To remove a rootfs instance, simply type rmarch
. If you want to specify a rootfs name, use rmarch <name>
. To remove just the rootfs tarball, use rmarch -t
. To remove your entire chroot container folder, type rmarch -a
(NOTE: all rootfs instances must be removed prior to running this command).
If you have a custom rootfs tarball that you want to use, but don't want to specify a URL to charch
, you can manually sideload a tarball.
- Navigate to your chroot container of choice. The default is
/home/chroot
for Linux and/data/local/chroot/
for Android. - Remove any existing
rootfs.tar.gz
usingrmarch -t
. - Copy your rootfs tarball to
rootfs.tar.gz
(the final file should look like/home/chroot/rootfs.tar.gz
). - Type
charch -n <name>
to create a rootfs instance calledname
that will use your custom tarball. - Type
rmarch -t
to remove your custom tarball.
If your image is already extracted, or you'd like to sideload a premade rootfs, you can follow these steps.
- Navigate to your chroot container of choice. The default is
/home/chroot
for Linux and/data/local/chroot/
for Android. - Copy your extracted rootfs here (the final folder could look like
/home/chroot/custom/
). - You can directly enter the rootfs using
charch <foldername>
(the command could look likecharch custom
).
Some power users may prefer to keep their ChArch folder on a MicroSD card or a USB OTG flash drive. There are a few steps we need to take.
- First we need to figure out which device our external drive is on. With your drive unplugged, type
blkid
as root. Then plug in your drive, and type it again. You should see a new entry show up at the very bottom. It might look something like/dev/block/sda
, or maybe/dev/block/sdg
. Keep this path in your memory for later. - For chroot to work, your drive must be formatted as a UNIX compatible filesystem. The most popular choices are
ext4
andf2fs
. If your device kernel supportsf2fs
, I'd suggest using it since it is optimized for flash storage. However, if you are in need of compatibility (i.e. using this ChArch external drive on older devices), I'd suggestext4
, as all Android devices support it. Typemkfs.ext4 -f /dev/block/***
, where***
is specific to your device. Replacemkfs.ext4
withmkfs.f2fs
if you chose to usef2fs
instead ofext4
. - Now, we need to mount the drive. Type
mount /dev/block/*** /mnt
, replacing***
with the device specific hardware ID (obviously). - Time to create your ChArch directory! Type
charch -n -d /mnt -u <url>
, similar to the steps in the tutorial. Note the-d /mnt
, where/mnt
is the path to your mounted external drive. ChArch commands will need a-d
option if you want it to execute them with respect to an external drive. - To unmount your rootfs instance, we'll use a similar process to Step #4. Type
unarch -d /mnt
. - To unmount your external drive completely, we need to unmount it from the
/mnt
folder. Typeumount /mnt
.