2

Before anyone asks why you'd want to do that, I'm using molecule to test my "infrastructure as code" locally before deploying it to actual machines.

Start by creating two block devices:

# dd if=/dev/zero of=/tmp/test0 bs=1M count=10
# dd if=/dev/zero of=/tmp/test1 bs=1M count=10
# losetup /dev/loop0 /tmp/test0
# losetup /dev/loop1 /tmp/test1

Now create the array:

# mdadm --create /dev/md127 --metadata=0.90 --level=1 --raid-devices=2 /dev/loop0 /dev/loop1
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.76-linuxkit/modules.dep.bin'
modprobe: FATAL: Module md_mod not found in directory /lib/modules/4.19.76-linuxkit
mdadm: Fail create md127 when using /sys/module/md_mod/parameters/new_array
mdadm: unexpected failure opening /dev/md127

I tried installing the linux-generic package to populate the missing /lib/modules directory, but it doesn't look like the correct version of that package exists for the running kernel (this is on Ubuntu 20.04):

# uname -r
4.19.76-linuxkit

# apt show linux-generic | grep Version
Version: 5.4.0.12.15
1
  • Did you consider using the molecule vagrant driver for this rather than the default docker driver ? Vagrant driver will let you spin up VMs where ti will be much easier to acheive what you want in this case. I don't think you can realiably test such things with docker container (if you can test at all....). Feb 6, 2020 at 23:22

0

You must log in to answer this question.

Browse other questions tagged .