Chroot into the Zero, although doing this from my x86_64 machine looks to be asking for problems,
If by "chroot in" you meant, put the card in your x86-64 machine and chroot into it there to run systemctl
and raspi-config
, that isn't "asking for problems" it simply will never work -- the system on the card is not compatible and cannot be run on an x86-64. You would need an emulator (QEMU being the one and only option I'm aware of there).
A bit more detail: Chroot
(change root) is a command to switch the root filesystem inside a running OS. You can't do that with a Pi card on an x86-64 system because the software on the card was compiled for a different ISA. Just as software compiled for an x86-64 system cannot be run on a Pi.1
QEMU is a hardware emulator, more broadly a "virtual machine", if you've used a VM of any sort, same idea (but most VMs are not hardware emulators). So you are running a system inside a system, there is no chroot involved.
That said, I haven't used QEMU for this, and I think there's a restriction there whereby you can use it to develop, compile etc. software for the pi but you need to use a special OS image (ie., the card won't do). You'll need to investigate that part, there should be enough stuff here an online generally ("pi QEMU") -- but TBH that would be by far my last choice anyway, I suspect minimally this is an afternoon worth of fiddling the first time.
What I would recommend is considering whether everything you want to do really requires this (ie., is this an XY problem). Pretty much everything I can think of that raspi-config
does (which surely isn't everything, but in general:) doesn't really require a running system. It is mostly about altering on-disk configuration in ways that are not hard to do manually, and, since it is just a few thousand lines of POSIX shell code, most of which is very simple, all you need to do is read it to find out what to do (and/or when in doubt, ask here about it since deciphering raspi-config
is solidly on topic).
WRT systemd
, if all you are talking about is adding and removing services, this just requires creating and deleting symlinks in a very, very straightforward way -- I presume that is by design, since what it means is you can do it without using systemctl
, or the system running, or even a binary compatible system to do it on. This is something you can do quickly and easily by putting the card in an x86-64 box. The same applies to what I just said about raspi-config
, because those configurations are mostly in text files. Text files don't have an ISA ;)
For the software you need to compile on the Pi, you could always do that and copy it out for installation to (another) card.
For what really does require a running system, you could just script it and have that run at first boot.
- Another issue with
chroot
is that not everything raspi-config
does operates only on the root fs; much of it alters stuff on the boot partition, although that is not a hard problem to get around.