offensive-security / kali-arm-build-scripts

Kali Linux ARM build scripts
874 stars 374 forks source link

rpi3-nexmon.sh fails with error code 1 #135

Closed rhythmize closed 6 years ago

rhythmize commented 6 years ago

While trying to build kali for raspberry pi using rpi3-nexmon.sh, script fails at

systemd-nspawn -M ${machine} -D kali-${architecture} /debootstrap/debootstrap --second-stage

I am sure and have checked also debootstrap command just before this is executed properly. The error message I see is

execv(/debootstrap/debootstrap) failed: No such file or directory Container ${id} failed with error code 1.

Please suggest

rhythmize commented 6 years ago

Same thing happens if I try nanopi2.sh too. systemd-nspawn command fails.

threeway commented 6 years ago

Can you please provide the full output of the command? Is this on a fully up to date Kali host and did you run build-deps.sh before running the scripts?

rhythmize commented 6 years ago

The output of systemd-nspawn command is

execv(/debootstrap/debootstrap) failed: No such file or directory Container ${id} failed with error code 1.

And my host system is ubuntu 18.04. In order to get build-deps.sh complete properly and rpi3-nexmon.sh working, I had to do some tweaks so that I can use required kali sources and kali-archive-keyring along with appropriate gpg signatures for the same. After that script fails at systemd-nspawn command only.

rhythmize commented 6 years ago

And FYI, /debootstrap/debootstrap exists inside the root directory mentioned in following command for -D flag

systemd-nspawn -M ${machine} -D kali-${architecture} /debootstrap/debootstrap --second-stage

I can't figure out why the script is failing.

rhythmize commented 6 years ago

Also, I tried running sudo chroot for root directory kali-armhf, it also throws error

chroot: failed to run command '/bin/bash': No such file or directory

Is it because of the reason that file system was not created properly by debootstarp. Because bin/bash exists in the created fs. Am I missing something here? Thanks

rhythmize commented 6 years ago

Okay, solved the issue. I just had to copy qemu-arm-static from /usr/bin to kali-${architecture}/usr/bin And everything worked fine.

threeway commented 6 years ago

Unfortunately, the version of systemd used by Ubuntu is older than the one we use in Kali. The version in Debian/Kali does not require copying the file in place, it is handled by systemd-nspawn transparently.

rhythmize commented 6 years ago

Okay, didn't knew that. I though ubuntu 18.04 should be having the recent one.