loboris / OrangePi-BuildLinux

122 stars 75 forks source link

create_image fails on chroot #8

Open roens opened 7 years ago

roens commented 7 years ago

I've not been able to get create_image to complete a successful build. I'm attempting to build an image that I can then write to the OrangePi Plus's EMMC storage.

The output I get is:

# sudo ./create_image

Tue Jan 24 14:44:44 PST 2017
=======================================================
Creating Ubuntu/Debian SD Card instalation for OrangePI
=======================================================

Using disk image "Orangian.img"
Creating partition images, please wait ...

Creating new filesystem on Orangian.img...
  New filesystem created on Orangian.img.

Partitioning Orangian.img...
  Creating boot & linux partitions
  OK.

Formating fat partition ...
  fat partition formated.
Formating linux partition (ext4), please wait ...
  linux partition formated.

Instaling u-boot to Orangian.img ...
U-boot installed to Orangian.img.

Mounting SD Card partitions...
SD Card partitions mounted to _linux_img_mnt & _boot_img_mnt

DEBOOTSTRAP, FIRST STAGE
OK.                        
Creating "sources.list"
Error while loading /bin/bash: No such file or directory
================================================
ERROR on second-stage, instalation NOT FINISHED.
================================================

If I add -x to the shebang (first line), I can see that it's failing on running chroot:

+ mkdir -p _linux_img_mnt/media/boot
+ mkdir -p _linux_img_mnt/usr/local/bin
+ mkdir -p _linux_img_mnt/usr/bin
+ cp /etc/timezone _linux_img_mnt/etc
+ cp /usr/bin/qemu-arm-static _linux_img_mnt/usr/bin
+ cp second-stage _linux_img_mnt/second-stage
+ cp params.sh _linux_img_mnt/params.sh
+ '[' '!' yes = yes ']'
+ chroot _linux_img_mnt /usr/bin/qemu-arm-static -cpu cortex-a9 /bin/bash /second-stage
Error while loading /bin/bash: No such file or directory

I can see that both ${sdcard}1 and ${sdcard}2 are still mounted, yet the 2nd, _linux_img_mnt has no /bin dir, where /bin/bash would be located… even tho that mkdir -p _linux_img_mnt/usr/bin line would appear to have run. https://github.com/loboris/OrangePi-BuildLinux/blob/master/create_image#L205

vencol commented 6 years ago

hello, i have the same problem with you ,how do you fix it? could you share it with me?Thanks

MarkZ2012 commented 5 years ago

sudo apt-get install debootstrap qemu qemu-user-static I resolve this problem by the command above