I have recently wiped and reinstalled a Kali Nethunter instance running on my Nexus 5 phone. It gave me a bit of trouble, so I thought I'd document the work-around in case it helps anyone out there :)
Downloaded Nethunter for Nexus 5 Marshmallow. Did this straight from my phone.
Grabbed the latest CM nightly from my phone.
Booted up in recovery mode, wiped / factory reset the phone.
Installed the latest nightly.
Rebooted in normal mode, and verified that the phone was functional under CM.
Rebooted in recovery mode, and installed Kali Nethunter.
At this point, rebooting the phone didn't work for me. It got stuck in the typical infinite loop of starting, running app optimization, then rebooting. Bummer.
Rebooted in recovery mode, and re-installed CM nightly.
Rebooted the phone in normal mode. Noted that CM booted up correctly, yet it still had Nethunter & co. installed. However, when I tried to start up nethunter, it couldn't find busybox. OK, I can work with this.
Downloaded the latest, ARM 7.1 version of busybox (https://busybox.net/downloads/). Here's where things get fun: you can download the binary easily, but then you have to put it in /system, which is read-only.
You start by jumping into a shell (Terminal Emulator, JuiceSSH... whatever suits) and becoming root. Then, you remount the /system partition in read-write mode: mount -o rw,remount /system. Then, move busybox to /system/xbin/.
Finally, a bit of permissions cleanup: chmod +x busybox; chmod o+r busybox; chmod g-w busybox; chgrp shell busybox
I also noticed that symlinks were missing, which was messing with running some of the nethunter features. This led me here:
Fixing the symlinks helped, but still doesn't seem to fix everything. However, it gets me most of the way there: by running bootkali_bash, I can run nmap, msfconsole, python... And that's really all I need.
This fixed most of the issues I was having running nethunter on marshmallow. If I've missed something, or if you have suggestions on how to improve this process, don't hesitate to get in touch with me on Twitter. Link's below :)