ioctl LOOP_SET_FD failed: Device or resource busy

8,343

Figured it out! Had to attach the image file to a /dev/block/loopxxx THEN mount the /dev/block/loopxxx as an ext4 file system.

Full how-to I wrote http://forum.xda-developers.com/showthread.php?t=2194237 just in case anyone needs help figuring out the same thing I did.

Share:
8,343

Related videos on Youtube

Joseph
Author by

Joseph

Updated on September 18, 2022

Comments

  • Joseph
    Joseph over 1 year

    I'm trying to get Backtrack to run on my Droid DNA. I've been tweaking the script little by little but I still come up with the following. I changed the loop on it, and another program always seems to jump in front, or I still get the ioctl error, then running it again gives the loop device exists (it doesn't the first time). Any ideas?

    root@android:/sdcard/bt5 # sh bootbt
    Loop device exists
    ioctl LOOP_SET_FD failed: Device or resource busy
    mount: No such file or directory
    mount: No such file or directory
    mount: No such file or directory
    net.ipv4.ip_forward = 1
    chroot: can't execute '/bin/bash': No such file or directory
    Shutting down BackTrack ARM For DNA
    failed: No such file or directory
    failed: No such file or directory
    failed: No such file or directory
    failed: Invalid argument

    1|root@android:/sdcard/bt5 # losetup
    /dev/loop7: 0 /data/app-asec/fahrbot.apps.screen.pro1-1.asec root@android:/sdcard/bt5 #

    Kernel does support looping. I found this out. Here's my modified boot script to start Backtrack:

    perm=$(id|cut -b 5)

    if [ "$perm" != "0" ];then echo "This Script Needs Root! Type : su";exit;fi

    mount -o remount,rw /dev/block/mmcblk0p5 /system export kit=/sdcard/bt5 export bin=/system/bin export mnt=/data/local/mnt mkdir -p $mntcd / export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
    export TERM=linux
    export HOME=/root
    if [ -b /dev/block/loop99 ]; then
    echo "Loop device exists"
    else
    busybox mknod /dev/block/loop99 b 7 99
    fi

    echo "SETTING UP LOOP DEVICE"
    losetup /dev/block/loop99 /sdcard/bt5/bt5.img

    mount -o loop,noatime -t ext2 $kit/bt5.img $mnt
    mount -t devpts devpts $mnt/dev/pts
    mount -t proc proc $mnt/proc
    mount -t sysfs sysfs $mnt/sys
    busybox sysctl -w net.ipv4.ip_forward=1
    echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
    echo "127.0.0.1 localhost bt5" > $mnt/etc/hosts
    busybox chroot $mnt /bin/bash

    echo "Shutting down BackTrack ARM For DNA"
    umount $mnt/dev/pts
    umount $mnt/proc
    umount $mnt/sys
    umount $mnt
    losetup -d /dev/block/loop99

    Even with loop99, I still get ioctl LOOP_SET_FD failed: Device or resource busy