# How do I create loop devices? [solved]

## curmudgeon

For CONFIG_BLK_DEV_LOOP_MIN_COUNT, the help says:

The historic default is 8. If a late 2011 version of losetup(8) is used, it can be set to 0, since needed loop devices can be dynamically allocated with the /dev/loop-control interface.

Sounds good to me (it is set to zero in the kernel).

However,

```

# mount -o loop /path/to/some/file /mnt/point

mount: Could not find any loop device. Maybe this kernel does not know

       about the loop device? (If so, recompile or `modprobe loop'.)

```

After some reading:

```

losetup /dev/loop-control /path/to/some/file 

ioctl: LOOP_SET_FD: Function not implemented

```

Unfortunately, "a late 2011 version" is not very clear:

```

# qlist -Iv util-linux

sys-apps/util-linux-2.20.1-r1

# ls -al /usr/portage/distfiles/util-linux-2.20.1.tar.bz2 

-rw-rw-r-- 1 portage portage 4614302 2011-10-20 12:26:05 /usr/portage/distfiles/util-linux-2.20.1.tar.bz2

```

If anyone knows what is going on, could you please enlighten me? Thank you in advance.Last edited by curmudgeon on Sun Jun 03, 2012 12:37 am; edited 1 time in total

----------

## Jaglover

You may need to load the module by hand, latest kernels do not autoload properly on demand in my experience.

----------

## curmudgeon

 *Jaglover wrote:*   

> You may need to load the module by hand, latest kernels do not autoload properly on demand in my experience.

 

The security policy I am working under prohibits modular kernels. Period.

EVERYTHING is compiled in.

I did forget to mention that I am using the latest stable kernel (3.2.12-gentoo).

----------

## VoidMage

There's also kernel req there, but most likely you meet that ( >= 2.6.37).

----------

## Jaglover

Create a device with mkdev, major 7 minor 0?

----------

## curmudgeon

 *Jaglover wrote:*   

> Create a device with mkdev, major 7 minor 0?

 

Well, I suppose I could do that (in the short term), but I don't really think that matches the "needed loop devices can be dynamically allocated with the /dev/loop-control interface" description. :)

I believe this in one more capability originating in the dark, mysterious pool known as udev.

----------

## Hu

According to the sys-apps/util-linux release notes, you need >=sys-apps/util-linux-2.21.

----------

## curmudgeon

 *Hu wrote:*   

> According to the sys-apps/util-linux release notes, you need >=sys-apps/util-linux-2.21.

 

I couldn't find that (because I probably actually need 2.21 to see it), but I will accept your word as the definitive answer. Thank you.

----------

## Hu

You can read the release notes on the project homepage.  :Wink:   That is how I found it, since Gentoo does not include the release notes in the installed package.

----------

