2

I am running Fedora as my primary OS on a 64 bit desktop machine. I have a RPi3 that I have installed Ubuntu Mate on -- but for this question assume I have Fedora on the Pi too. I want to install programs and update key settings on the RPi3 OS via the MicroSD card -- rather than on the actual RPi3 running the OS live. This is necessary, for example, to encrypt the root partition.

Typically to do this you would insert the MicroSD card into your desktop machine and chroot into it. But this is not directly possible because the desktop is of a different architecture (i.e., 64 bit v. ARM). So my understanding is that you need to use qemu. But all of the guides I've seen to do so (i.e., use qemu to chroot (or better, proot) into the Pi's OS assume the host OS is Ubuntu-based.

Is there any way to chroot into an ARM OS coming from a Fedora, x86_64 (amd64) host?

Note: I am currently working around the issue by using VirtualBox running Ubuntu 18.04 running qemu and prooting into the Ubuntu Mate RPi3. I am trying to achieve a more elegant solution for a full Fedora system.

  • i have never used it, but proot is available in the repository. Your question is too vague, and it is unclear what you are asking. – Milliways Feb 15 '18 at 5:13
  • 1
    Thanks. What is vague about the question? I will edit it to make it more clear. Regarding proot being in the repository. I can't find it in Fedora (there is a 2 year old copr version). Are you talking about the Fedora repository or the Ubuntu repository? I am trying to proot from a Fedora instance. – Rsync Feb 15 '18 at 6:07
  • This is a Raspberry Pi Forum! You will only get answers to questions about Pi. You have not specified what OS - I assume Raspbian in these cases because that is what most use. Unless you are asking about things to run on the Pi or detail of the OS on the Pi this is the wrong site. – Milliways Feb 15 '18 at 7:16
  • The edited question appears to be about modifying a SD image on some other machine/OS. – Milliways Feb 15 '18 at 9:06
  • fedoraproject.org/wiki/How_to_use_qemu <- You should be able to use this to discern whatever differences there are between using QEMU on Ubuntu and using QEMU on Fedora, which there does not appear to be much of significance that would. – goldilocks Feb 16 '18 at 16:28
1

The basic issue you have is that after you have chrooted, the "host" operating system (Fedora) can only see binaries inside the chrooted directory tree. This means that any binaries you try to run (including the command line) must be compatible with the kernel and architecture.

You have two possible ways round this:


I recommend you use a simulator (like qemu which you mentioned). Qemu is compatible with Fedora, so even if the tutorials are for Debian forked operating systems (such as Ubuntu), it should be possible to translate them and you would be better to try these and ask for help when you get stuck and explain why you are stuck.


Alternatively you can try without an emulator by bringing parts of your host OS into the directory tree of your Raspberry Pi before you chroot. Assuming you are using a Debian variant on your Pi, this may not be useful since Fedora doesn't use apt. Even if you install apt binaries there's a large risk that installs will fail. But for completeness if you really want to shoot yourself in the foot, then:

#assuming your sd card is on /media/foo/bar
mkdir /tmp/tools /tmp/tools/bin /tmp/tools/sbin /tmp/tools/usr
mount --bind /tmp /media/foo/bar/tmp
mount --bind /bin /media/foo/bar/tmp/tools/bin
mount --bind /sbin /media/foo/bar/tmp/tools/sbin
mount --bind /usr /media/foo/bar/tmp/tools/usr
PATH=/tools/bin:/tools/sbin:/tools/usr/bin:/tools/usr/sbin chroot /media/foo/bar /media/foo/bar/tools/bin/bash
  • I appreciate the answer. qemu appears to be the way to go. If anyone knows or finds or creates a tutorial out there for it, please post it here. In the interim, I will mark this as solved. – Rsync Feb 16 '18 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.