There should be a device called ‘loop0’, and then one called ‘loop1’ (possibly more). In your case, the flash.sh script is trying to use the loop0, but it is already taken, so when the script tries to map the ‘system.img’ to it, it fails. So, we need to tell the flash.sh script to use loop1 (the next loop device) which should not already be in use.
Open flash.sh in a text editor. There’s a line where it defines a variable to a text string containing the name of the loop device to use. It should be set to ‘loop0’. Change it to ‘loop1’, to tell the script to use the next loop device which should not be taken. (I’m not sure what the line number is, but I believe it’s the only line in the whole script that is hard-coded to use ‘loop0’.)
Maybe in the future, this script could be changed so that the loop-device is provided via a command-line argument, and is not hard-coded to ‘loop0’.
I want to confirm that this solved my loopback error on a live persistent USB version of Ubuntu 16.04 as the host, with a TK1 as the dev board. I have run into some issues with installing visionworks, but that’s an unrelated issue.
“loop0” is on line 450 of flash.sh for the curious, and changing the 0 to a 1 was all that was needed to get it working.