7

I would assume most all of you know why I am asking this, but for those who don't, Loop Device Support of a Kernel on an Android device is utilized to mount a Linux Distro IMG file (Ubuntu or Debian, & a couple others) to run the linux img in a Chrooted environment to run side by side next to your Android System.

So there is tons of information on what Loop Device Support is (if you need a good explanation see Wikipedia's article.), and why you need it, but there is a great lack of explaination as to how you find out if your device supports it. The most information relating to it is that "most roms support it"...

So down to the issue, how would one discover if my device currently supports it? Is there some script I can look at or something in the kernel I can view to find out if my device supports it?

3
  • You could just try mounting a loop device. The programming part is off-topic here though -- try Stack Overflow. Commented Jul 6, 2012 at 21:52
  • Okay thanks for fixing that. Id still like to know how to find what gives it the support
    – insomnia
    Commented Jul 6, 2012 at 21:56
  • @insomnia: Like any non-trivial feature, a lot of things are required to make loopback device works, CONFIG_BLK_DEV_LOOP is just one of them, the mount program also has support the appropriate mount options, recognize the IMG format, and find the correct driver to translate the disk image format to a block device. In short, the only reliable way to check for support is to actually trying to mount it.
    – Lie Ryan
    Commented Jul 7, 2012 at 3:29

5 Answers 5

4

You can verify by checking /proc/config.gz and search through it looking for the configure option - CONFIG_BLK_DEV_LOOP=y.

To do that you need to do it this way:

cp /proc/config.gz /sdcard/kernel_config.gz

and

adb pull /sdcard/kernel_config.gz

Unzip the kernel_config.gz and open it up in a notepad or text editor and search it.

If its either # CONFIG_BLK_DEV_LOOP is not set or CONFIG_BLK_DEV_LOOP=n all bets are off.

7
  • Thanks a bunch! Too bad I dont know what Matt edited. probably something that would of been useful to me. Rediculous how anal the whole entire stack exchange network is.. Who cares if its still on the topic, its useful information that many may find useful, but no, makes it so people have to search. And in fact that information that has been removed has probably never been posted anywhere else on the net. But it cant stay because you cant discuss Android Development on an Android Site.. Weird I just don't get it.. But thank you so much t0mm13b, exactly what I was looking for!
    – insomnia
    Commented Jul 11, 2012 at 4:31
  • @insomnia: You can see exactly what was edited by clicking on the timestamp. He fixed the formatting on one piece of text. There was no information removed from this post. Commented Aug 10, 2012 at 20:25
  • @eldarerathis yeah I noticed. My bad. I was new at that point. But he also deleted a relevant comment which is what made me say it in the first place. But yeah sorry about that.
    – insomnia
    Commented Aug 12, 2012 at 0:42
  • On Cyanogenmod 10.1, I don't have /proc/config.gz file. What to do?
    – enedil
    Commented Feb 21, 2014 at 12:56
  • @enedil: Build your own kernel am afraid... no can do, some elect to include the config, others don't.
    – t0mm13b
    Commented Feb 21, 2014 at 17:49
3

You can use the following command at the terminal:

export | grep LOOP_MOUNTPOINT

If there is a LOOP_MOUNPOINT, probably you can mount loop devices.

UPDATED

HOW TO TEST?

Download a freedos image (http://www.freedos.org/) 40MB ISO.

Make a loop device association:

losetup /dev/block/loop4 fd11src.iso 

Mount a iso device

mkdir freedos_img
mount -t iso9660 -o ro /dev/block/loop4 freedos_img

And there is this the mounted iso at freedos_img

2
  • And if I find it, what? does it signify I have support for loop devices?
    – enedil
    Commented Feb 21, 2014 at 13:01
  • You can easily find out without searching for LOOP_MOUNTPOINT. Just type this export | grep LOOP in Terminal Emulator. This will show the instances of LOOP_MOUNTPOINT.
    – k1chy
    Commented Feb 22, 2014 at 3:28
1

Just came across this. I was having the same issue. You could just do zcat /proc/config.gz | grep CONFIG_BLK_DEV_LOOP from a terminal emulator. If you get a y, you are good to go.

3
  • Definitely the best answer. Commented Jul 5, 2013 at 9:34
  • How does one install zcat? zcat: not found
    – Redsandro
    Commented Oct 13, 2014 at 22:19
  • 1
    @Redsandro Install busybox.
    – Adan
    Commented Oct 14, 2014 at 3:59
1

Here is a shell function to check for loop support without creating a loop device. It should even work as non-root.

function check_loop_support {
    local tmp

    # assuming that losetup -f works ... to be checked somewhere else
    tmp=$(losetup -f 2>/dev/null)
    if test -b "$tmp"; then
        return 0
    fi

    # So far we haven't found any loop support. Let's check whether we
    # could load the module and assume that it would work.
    modprobe --quiet --dry-run loop &>/dev/null
    return $?
}

Note there exist losetup versions with different behavior of -f. Sometimes they would automatically load loop module if needed and possible. And some versions would even directly return 1 if no loop support available. Others just print "/dev/loop0" although there is no such device. The function above tries to be safe for all known cases.

Note that you may still need to load the loop module to have usable loop devices available. If you are root you could also run a real "modprobe loop" before losetup to be sure.

1

You can use Loop device checker to check if your device supports it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .