Chroot onto ARM based image

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
1
down vote

favorite
1












I'm trying to do some work on an image for a raspberry pi, but I don't have access to the pi itself, just the SD card that runs the OS.



I'd like to chroot onto the pi's SD card (mainly to run some pip commands), but I'm getting errors with bash :



chroot: failed to run command ‘/bin/bash’: Exec format error


I assume this is because the programs are compiled for the pi's processor and not mine.



The only thought I have is changing the $PATH to point to my /bin, but I can't imagine that being good practice or safe in any way



Is there a way to make this work?










share|improve this question

























    up vote
    1
    down vote

    favorite
    1












    I'm trying to do some work on an image for a raspberry pi, but I don't have access to the pi itself, just the SD card that runs the OS.



    I'd like to chroot onto the pi's SD card (mainly to run some pip commands), but I'm getting errors with bash :



    chroot: failed to run command ‘/bin/bash’: Exec format error


    I assume this is because the programs are compiled for the pi's processor and not mine.



    The only thought I have is changing the $PATH to point to my /bin, but I can't imagine that being good practice or safe in any way



    Is there a way to make this work?










    share|improve this question























      up vote
      1
      down vote

      favorite
      1









      up vote
      1
      down vote

      favorite
      1






      1





      I'm trying to do some work on an image for a raspberry pi, but I don't have access to the pi itself, just the SD card that runs the OS.



      I'd like to chroot onto the pi's SD card (mainly to run some pip commands), but I'm getting errors with bash :



      chroot: failed to run command ‘/bin/bash’: Exec format error


      I assume this is because the programs are compiled for the pi's processor and not mine.



      The only thought I have is changing the $PATH to point to my /bin, but I can't imagine that being good practice or safe in any way



      Is there a way to make this work?










      share|improve this question













      I'm trying to do some work on an image for a raspberry pi, but I don't have access to the pi itself, just the SD card that runs the OS.



      I'd like to chroot onto the pi's SD card (mainly to run some pip commands), but I'm getting errors with bash :



      chroot: failed to run command ‘/bin/bash’: Exec format error


      I assume this is because the programs are compiled for the pi's processor and not mine.



      The only thought I have is changing the $PATH to point to my /bin, but I can't imagine that being good practice or safe in any way



      Is there a way to make this work?







      sd-card chroot






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 16 at 16:32









      Brydon Gibson

      1284




      1284




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          It is possible.



          You need to install qemu-user-static on your x86/x86_64 computer:



          sudo apt-get install qemu-user-static


          Let's assume that your rootfs is mounted to /mnt.



          Then try:



          sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/
          sudo cp /etc/resolv.conf /mnt/etc/resolv.conf

          cd /mnt
          sudo mount --bind /dev dev/
          sudo mount --bind /sys sys/
          sudo mount --bind /proc proc/
          sudo mount --bind /dev/pts dev/pts
          #sudo rm /mnt/etc/ld.so.preload # not sure about this
          sudo chroot .





          share|improve this answer






















          • Can you expand on the ld.so.preload? Would it only be a bad idea because it may load something that I need in the chroot?
            – Brydon Gibson
            Feb 16 at 17:34










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1006846%2fchroot-onto-arm-based-image%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          It is possible.



          You need to install qemu-user-static on your x86/x86_64 computer:



          sudo apt-get install qemu-user-static


          Let's assume that your rootfs is mounted to /mnt.



          Then try:



          sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/
          sudo cp /etc/resolv.conf /mnt/etc/resolv.conf

          cd /mnt
          sudo mount --bind /dev dev/
          sudo mount --bind /sys sys/
          sudo mount --bind /proc proc/
          sudo mount --bind /dev/pts dev/pts
          #sudo rm /mnt/etc/ld.so.preload # not sure about this
          sudo chroot .





          share|improve this answer






















          • Can you expand on the ld.so.preload? Would it only be a bad idea because it may load something that I need in the chroot?
            – Brydon Gibson
            Feb 16 at 17:34














          up vote
          0
          down vote













          It is possible.



          You need to install qemu-user-static on your x86/x86_64 computer:



          sudo apt-get install qemu-user-static


          Let's assume that your rootfs is mounted to /mnt.



          Then try:



          sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/
          sudo cp /etc/resolv.conf /mnt/etc/resolv.conf

          cd /mnt
          sudo mount --bind /dev dev/
          sudo mount --bind /sys sys/
          sudo mount --bind /proc proc/
          sudo mount --bind /dev/pts dev/pts
          #sudo rm /mnt/etc/ld.so.preload # not sure about this
          sudo chroot .





          share|improve this answer






















          • Can you expand on the ld.so.preload? Would it only be a bad idea because it may load something that I need in the chroot?
            – Brydon Gibson
            Feb 16 at 17:34












          up vote
          0
          down vote










          up vote
          0
          down vote









          It is possible.



          You need to install qemu-user-static on your x86/x86_64 computer:



          sudo apt-get install qemu-user-static


          Let's assume that your rootfs is mounted to /mnt.



          Then try:



          sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/
          sudo cp /etc/resolv.conf /mnt/etc/resolv.conf

          cd /mnt
          sudo mount --bind /dev dev/
          sudo mount --bind /sys sys/
          sudo mount --bind /proc proc/
          sudo mount --bind /dev/pts dev/pts
          #sudo rm /mnt/etc/ld.so.preload # not sure about this
          sudo chroot .





          share|improve this answer














          It is possible.



          You need to install qemu-user-static on your x86/x86_64 computer:



          sudo apt-get install qemu-user-static


          Let's assume that your rootfs is mounted to /mnt.



          Then try:



          sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/
          sudo cp /etc/resolv.conf /mnt/etc/resolv.conf

          cd /mnt
          sudo mount --bind /dev dev/
          sudo mount --bind /sys sys/
          sudo mount --bind /proc proc/
          sudo mount --bind /dev/pts dev/pts
          #sudo rm /mnt/etc/ld.so.preload # not sure about this
          sudo chroot .






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 16 at 17:59

























          answered Feb 16 at 16:37









          N0rbert

          16.6k33378




          16.6k33378











          • Can you expand on the ld.so.preload? Would it only be a bad idea because it may load something that I need in the chroot?
            – Brydon Gibson
            Feb 16 at 17:34
















          • Can you expand on the ld.so.preload? Would it only be a bad idea because it may load something that I need in the chroot?
            – Brydon Gibson
            Feb 16 at 17:34















          Can you expand on the ld.so.preload? Would it only be a bad idea because it may load something that I need in the chroot?
          – Brydon Gibson
          Feb 16 at 17:34




          Can you expand on the ld.so.preload? Would it only be a bad idea because it may load something that I need in the chroot?
          – Brydon Gibson
          Feb 16 at 17:34

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1006846%2fchroot-onto-arm-based-image%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          pylint3 and pip3 broken

          Missing snmpget and snmpwalk

          How to enroll fingerprints to Ubuntu 17.10 with VFS491