Sto cercando di configurare un server MaaS all'interno di un contenitore LXC.
Quando importare i file PXE, deve essere in grado di montare dispositivi loop.
Ho impostato le seguenti opzioni nel file di configurazione del contenitore per consentire il montaggio in loop, ma mi manca qualcosa.
lxc.cgroup.devices.allow = b 7:* rwm
lxc.cgroup.devices.allow = c 10:237 rwm
Ottengo il seguente errore perché lo script non può montare in loop un file:
mount: cannot mount block device /dev/loop0 read-only
Wed, 13 Nov 2013 07:26:41 +0000: failed to mount /var/lib/maas/ephemeral/precise/ephemeral/i386/20131010/disk.img
Traceback (most recent call last):
File "/usr/sbin/maas-import-ephemerals", line 26, in <module>
main(args)
File "/usr/lib/python2.7/dist-packages/provisioningserver/import_images/ephemerals_script.py", line 428, in main
target.sync(source, args.path)
File "/usr/lib/python2.7/dist-packages/simplestreams/mirrors/__init__.py", line 85, in sync
return self.sync_index(reader, path, data, content)
File "/usr/lib/python2.7/dist-packages/simplestreams/mirrors/__init__.py", line 237, in sync_index
self.sync(reader, path=epath)
File "/usr/lib/python2.7/dist-packages/simplestreams/mirrors/__init__.py", line 83, in sync
return self.sync_products(reader, path, data, content)
File "/usr/lib/python2.7/dist-packages/simplestreams/mirrors/__init__.py", line 315, in sync_products
self.insert_item(item, src, target, pgree, ipath_cs)
File "/usr/lib/python2.7/dist-packages/provisioningserver/import_images/ephemerals_script.py", line 251, in insert_item
self.extract_item(path, flat)
File "/usr/lib/python2.7/dist-packages/provisioningserver/import_images/ephemerals_script.py", line 295, in extract_item
tarball, target_dir, temp_location=self._simplestreams_path())
File "/usr/lib/python2.7/dist-packages/provisioningserver/import_images/ephemerals_script.py", line 124, in extract_image_tarball
call_uec2roottar(image, os.path.join(target_dir, 'dist-root.tar.gz'))
File "/usr/lib/python2.7/dist-packages/provisioningserver/import_images/ephemerals_script.py", line 97, in call_uec2roottar
subprocess.check_call(["uec2roottar"] + list(args))
File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '[u'uec2roottar', u'/var/lib/maas/ephemeral/precise/ephemeral/i386/20131010/disk.img', u'/var/lib/maas/ephemeral/precise/ephemeral/i386/20131010/dist-root.tar.gz']' returned non-zero exit status 1
root@maaslxc2:~# mount /dev/loop0 /mnt
mount: block device /dev/loop0 is write-protected, mounting read-only
mount: cannot mount block device /dev/loop0 read-only
Quindi, cosa devo modificare nella configurazione del contenitore per consentirgli di montare i dispositivi loop? Sembra che questo non sia solo un problema MaaS, ma una restrizione che causerebbe problemi per qualsiasi cosa (non solo MaaS) che deve montare in loop un file in un contenitore LXC.