LXC containers on Ubuntu and loop device support

As part of building a new network management VM, I decided to install cobbler in a separate LXC virtual machine (container) to make it that bit cleaner. Unfortunately, I quickly ran into a stumbling block when I went to import an ISO.

Errors when mounting loop devices in an LXC container

Could not find any loop device. Maybe this kernel does not know about the loop device? (If so, recompile or ‘modprobe loop’.)

Wat.

Could not load /lib/modeules/3.8.0-35-generic/modules.dep: No such file or directory
What does that mean?

As it turns out, LXC containers on Ubuntu do not support the loop device so you can’t loop mount ISO’s inside the container! Why LXC doesn’t have this support seems downright strange to me, and reinforces my impression that, as useful and powerful as it is, LXC is not ready for the big-leagues by any stretch of the imagination.

I ended up just loop-mounting the image in the host (a KVM machine in itself), tar’ing the whole disk, then copying it into the LXC container and importing it that way. However, if you’re willing to get your hands dirty, you might want to try the instructions from this thread from the lxc-users mailing list. You can build a new configuration file, re-define the machine and you should have access to the loop device.

Comments

comments powered by Disqus