Is installing the bootloader the reason why we chroot?
The only thing I do inside my system when I chroot into it is to install grub and configure it.
If there was some way to configure the bootloader without chrooting, would it be necessary to do it?
Also, I see in other minimalist distros there are other tools to do chroot. Is because every distro needs it's own tool? Or could I just use for example gentoo or artix chrooting tool in Arch?
About this post
- Posted
- Archived
- Score
- 76 · 100% up
- Kind
- Text
- ID
- e486ua
30 comments
I don't think you need to chroot during the install process. It's just nice to do it ASAP so that you can start running normal commands and using normal paths for everything.
I'm pretty sure I've set up a UEFI system without chrooting. efibootmgr doesn't care if you're running a live OS.
EFISTUB doesn't require any special configuration step.
But it requires that your UEFI firmware supports passing the command line to the kernel, right?
You can put a minimal bootloader like systemd-boot in between.
Systemd provides a stub (
/usr/lib/systemd/boot/efi/linuxx64.efi.stubfor x86_64) that you can use to create a single EFI executable that includes the kernel, initramfs and cmdline.To do this:
To use multiple initramfs files, concatenate them into a single file (for example,
cat /boot/initramfs-linux.img /boot/amd-ucode.img > /boot/merged-initrd.img), then pass that to objcopy.I've actually created a program that does all this for you (as well as signing it with a custom key for Secure Boot), that you can find here (
I should really make an AUR package for it at some point, as well as add a proper README).If you decide to tweak the kernel config you can build in a command line.
Deleted before we saved it.
It's not necessary for installing grub. grub-mkconfig has -o option, and grub-install has --boot-directory and --efi-directory options to specify custom paths
My understanding is chroot'ing will allow you to "log in" to the installed base system and make configuration changes before actually restarting and booting into it. This is mostly for convenience, and to save time at the end. It might also be useful in a scenario where you have a very specific, scripted install, and could easily wipe a machine & re-deploy again in a very short amount of time.
But all in all, nothing stops you from installing the base system and immediately rebooting to log in to the newly-installed system, then continuing your customizations from there. Chroot'ing at least guarantees you'll be able to login to the system and maybe have a defined user account, DE, login manager, some working drivers, etc.
One other thing that comes to mind is that the live system tends to work well for most people -- i.e., if your drivers work on the live system, but not on native hardware, then it's an indication of a failure in configuration (usually). So, taking advantage of the live system and chroot'ing into your install helps prevent putzing around with drivers/internet connection after the fact.
Right after I commented that i hadn't found an answer I stumble on this. Thanks for the very nice explanation. Concept finally fully understood.
You're welcome! Glad I could help with my limited understanding of Arch
It is enough to root into it, instead of chrooting. (Just login and sudo). When you install grub, you will need /boot to be mounted, I think this is the only requirement that grub install has.
Actually a very good question. I never thought about why before.
I don't chroot for that but I change the grub directory to copy the modules from the otherwise chroot'ed system. Sometimes the grub version is different, but it boots fine and I run grub-install later
I assume that there are minor differences between the chroot tools used by different distros, but they should all do roughly the same thing. They are effectively convenience scripts which run a bunch of programs needed to make your chroot'ed environment useful. Check the arch wiki page: https://wiki.archlinux.org/index.php/Chroot#Using_arch-chroot
It worked for me using the chroot tool from arch on Debian
There are often a lot of stuff I need to change in chroot. E.g. language (Danish), keyboard, time, region, and to install some essential software such as NetworkManager. If I don't remember I have a hard time getting wifi to work. Not sure if there are any easy alternatives already installed though.
I install all I need with pacstrap and do the configuration after the first boot. And for wifi devices I use wifi-menu.
Arh! I've previously used netctl, but stopped since I was on a Eduroam which didn't play nice for some reason. I should give netctl another chance :) Thanks!
I've read thru most of the comments and didn't find an answer so far, Ive chrooted with instruction from a friend but i didn't really understand the point. Can someone explain what chroot IS actually for/why it's useful?
When you are installing Arch you are inside your pendrive creating an OS in your PC's disk.
After having everything done, you can retire your pendrive and just turn on your computer to enter the OS you just created from your pendrive (Arch in this case).
So, as you are not in your new system while you are creating it, to enter your system without leaving the installer (Your pendrive) you can use Chroot to fake that you are already inside your new OS. So using it you can do almost everything you could do after retire your pendrive and entering your computer.
People usually use it to configure the OS because thats something you can't do from the installer. You have to be inside the system.
Sorry if I didn't explain very good. This isn't my mother language :p
Chroot-ing allows "logging-in" to the partition where
/is installed, whether a new installation or old. As some others have said when you run commands such asgrub-mkconfigorgrub-installyour output paths will be the "real paths" used when your system is truly booted itself (i.e/boot/EFIand similar). Otherwise, you would need to prepend/mnt(or wherever you temporarily mounted your new installation) to each of the paths for the commands listed above if you did notchroot(/mnt/boot/EFI).Another benefit to the
arch-chrootfeature specifically helped me solve a networking issue on my multi-boot setup on my laptop (Manjaro, Arch, Lubuntu). I installed Arch using ethernet, but didn't test the wifi during. Long story short I did not have access to ethernet to boot into Arch and install the firmware natively but was instead able toarch-chrootinto the Arch/partition and install the necessary firmware while booted in Manjaro.Arch-chrootis similar tochrootbut also mounts system directories like/proc,/sys,/devwhich are necessary directories if you want to install packages on a system, and you would need to mount them manually withchroot. Check out the link in u/PaperChromatagram's post.Deleted before we saved it.
I don't think I've ever chrooted, ever. Of course, I use Grub and from reading all the posts here I assume that is why I never have and up until today never even heard of the term. LOL
Perfect thank you!