You are not logged in.
Pages: 1
I followed tutorials online and they used arch-chroot during their installations.
I know chroot changes the root directory, but why is this useful in installations?
Offline
Don't follow tutorials, follow the wiki https://wiki.archlinux.org/index.php/In … ide#Chroot
Which makes it pretty obvious, all subsequent paths being used assume that to be the case and the changes will be reflected on your actual system as opposed to the live disk.
Offline
why is this useful in installations?
It's not
All of the post-chroot configuration listed in the Installation Guide can be done after booting into the new system for the first time (and it's easier then because the various systemd tools can be used) and GRUB & systemd-boot can be installed to the disk and configured without chrooting.
But I suppose it's a bit tidier to do everything before rebooting from the live environment.
Offline
`chroot` changes the "root" directory of your environment.
Imagine `/mnt/installation`. Let's say that you pacstrapped the system into `/mnt/installation`, afterward there are now folders within: `/mnt/installation/bin`, `/mnt/installation/lib`, etc.
The way that the Linux user-space shells look for programs is by default in a few standard paths like `/bin`, `/usr/bin`, etc.
When you `chroot /mnt/installation`, that becomes your new `/` point for the chrooted environment. This allows the shell to treat `/mnt/installation` as your root filesystem.
Then, everything works as expected, just as if you were already booted into your new installation (in a sense).
Without chrooting, your shell is using the root `/` mountpoint by default. Meaning the programs you run, will be run from the live ISO in your case, and they will all use the root path that they can see -- what is part of the live ISO.
Just as Head_on_a_Stick has elaborated on, this is not required to do work on a mounted filesystem that contains a root structure. However, it makes things easier, especially from a fresh user's perspective.
This can of course be worked around without arch-chroot; however, the tool it used to make it easier for users to deal with.
Kevin Morris <kevr@0cost.org>
Hangs out in #archlinux-aurweb. Loves the AUR.
Offline
Pages: 1