Docker Community Forums

Share and learn in the Docker community.

No device-mapper support in the kernel


(Secguy) #1

It appears that device mapper support has not been compiled into the kernel being used for Docker for Mac. I noticed this because it broke a number of my containers that I use to build disk images and rely on being able to use kpartx to mount partitions inside disk image files. These build containers work just fine on boot2docker and the inability to use tools like kpartx that use the device-mapper breaks this important use case for me.

Can we get device-mapper support included in the Docker for Mac custom kernel?

Expected behavior

Tools that use device-mapper such as kpartx should function correctly from containers running on Docker for Mac. A simple check for device-mapper support indicates kernel support:

# dmsetup ls
No devices found

Actual behavior

Device-mapper support does not appear to be built into the Docker for Mac kernel which renders such useful tools as kpartx non-functional. The same check from above sadly fails:

# dmsetup ls
/dev/mapper/control: open failed: No such device
Failure to communicate with kernel device-mapper driver.
Check that device-mapper is available in the kernel.
Incompatible libdevmapper (unknown version) and kernel driver (unknown version).
Command failed

Information

$ pinata diagnose -u
OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.1-beta11
Running diagnostic tests:
[OK] docker-cli
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160516-090522.tar.gz
Most specific failure is: No error was detected
Your unique id is: 39F41E0E-DF04-4A98-A7B2-0727884ECF08
Please quote this in all correspondence.

OSX 10.11.4

Steps to reproduce the behavior

  1. Run an alpine container and install device-mapper.

$ docker run --rm -it --privileged alpine sh
# apk update
# apk add device-mapper
(1/1) Installing device-mapper (2.02.138-r0)
Executing busybox-1.24.1-r7.trigger
OK: 5 MiB in 12 packages

  1. List devices with dmsetup and observe the failure condition.

# dmsetup ls
/dev/mapper/control: open failed: No such device
Failure to communicate with kernel device-mapper driver.
Check that device-mapper is available in the kernel.
Incompatible libdevmapper (unknown version) and kernel driver (unknown version).
Command failed

This also fails when directly run on the Docker for Mac VM:

moby:~# dmsetup ls
/dev/mapper/control: open failed: No such device
Failure to communicate with kernel device-mapper driver.
Check that device-mapper is available in the kernel.
Incompatible libdevmapper (unknown version) and kernel driver (unknown version).
Command failed

The expected behavior should be as per boot2docker:

# dmsetup ls
No devices found


Customize the kernel for docker vm (to get device mapper working)
(Elsonrodriguez) #2

Just confirmed this.


(Rajpatel) #3

Yes, this break one of my use case too.

Tue Jun 28 2016 12:30:27 INF dpControl [pre-start][1] Resizing DPOS partition from 2727936 to 2861057 sectors
Tue Jun 28 2016 12:30:31 ERR dpControl [pre-start][1] Cannot run /sbin/kpartx -pdp -av /dev/loop/0
Tue Jun 28 2016 12:30:31 ERR dpControl [pre-start][1] kpartx: /dev/mapper/control: open failed: No such device
Tue Jun 28 2016 12:30:31 ERR dpControl [pre-start][1] kpartx: Failure to communicate with kernel device-mapper driver.
Tue Jun 28 2016 12:30:31 ERR dpControl [pre-start][1] kpartx: Check that device-mapper is available in the kernel.
Tue Jun 28 2016 12:30:31 ERR dpControl [pre-start][1] kpartx: device mapper prerequisites not met
Tue Jun 28 2016 12:30:31 ERR dpControl [post-stop][1] Cannot open lockfile ‘/var/opt/ibm/datapower/4ef19e916832.datapower.img.lck’: No such file or directory
/dev/mapper/control: open failed: No such device
Failure to communicate with kernel device-mapper driver.
Check that device-mapper is available in the kernel.
Tue Jun 28 2016 12:30:31 ERR dpControl [post-stop][1] Cannot close LUKS partition ‘var_opt_ibm_datapower_4ef19e916832_datapower_img’: No such device (error 19)
Tue Jun 28 2016 12:30:31 ERR dpControl [post-stop][1] Cannot open lockfile ‘/var/opt/ibm/datapower/4ef19e916832.datapower.img.lck’: No such file or directory
Tue Jun 28 2016 12:30:32 ERR dpControl [post-stop][1] Cannot open lockfile ‘/var/opt/ibm/datapower/4ef19e916832.datapower.img.lck’: No such file or directory
Tue Jun 28 2016 12:30:32 ERR dpControl [post-stop][1] Cannot open lockfile ‘/var/opt/ibm/datapower/4ef19e916832.datapower.img.lck’: No such file or directory


(Cunnie) #4

Same problem here:

kpartx -dv /mnt/stemcells/vsphere/esxi/ubuntu/work/work/vsphere-esxi-ubuntu.raw
/dev/mapper/control: open failed: No such device
Failure to communicate with kernel device-mapper driver.

(Deanjameseverett) #5

This is still not functional in Version 1.12.0 native for Mac. Reverted to the Toolbox install and works. Any time frame on when the native instance will have device-mapper support?


Same Dockerfile works when built outside, fails when I build