当定制 Ubuntu 16.04 图像以用于 MAAS 2.0 时没有可用的说明。
看起来其他人已经取得了成功,但没有可用的步骤来复制他们的成功。
我尝试过的步骤如下:
获取已知工作图像的副本:
wget http://images.maas.io/ephemeral-v2/daily/xenial/amd64/20160914/root-image.gz
或者从这里:/var/lib/maas/boot-resources/cache
装载映像以进行自定义Mount the image to customize
gunzip root-image.gz
mkdir /tmp/image
mount root-image /tmp/image
根据需要自定义镜像,卸载并压缩
umount /tmp/image
gzip root-image
将其导入 MAAS
maas admin boot-resources create name="custom/my-custom-image" architecture="amd64/generic" subarches="generic" content@=/root/root-image.gz
maas admin boot-resources import
接下来,您将使用此映像部署一个节点,但就我而言,此操作失败,并显示以下输出。
Cloud-init v. 0.7.8 running 'modules:config' at Mon, 26 Sep 2016 18:17:20 +0000. Up 14.84 seconds.
--2016-09-26 18:17:32-- http://10.40.0.250:5248/images/custom/amd64/generic/my-custom-image/uploaded/root-tgz
Connecting to 10.40.0.250:5248... connected.
HTTP request sent, awaiting response... 200 OK
Length: 211170553 (201M) [text/html]
Saving to: 'STDOUT'
0K ..... 0% 19.0M=0.02s
Cannot write to '-' (Success).
Unexpected error while running command.
Command: ['chroot', '/tmp/tmpoa1mrw83/target', 'dpkg-query', '--list']
Exit code: 127
Reason: -
Stdout: ''
Stderr: "chroot: failed to run command 'dpkg-query': No such file or directory\n"
Installation failed with exception: Unexpected error while running command.
Command: ['curtin', 'curthooks']
Exit code: 3
Reason: -
Stdout: b'Unexpected error while running command.\nCommand: [\'chroot\', \'/tmp/tmpoa1mrw83/target\', \'dpkg-query\', \'--list\']\nExit code: 127\nReason: -\nStdout: \'\'\nStderr: "chroot: failed to run command \'dpkg-query\': No such file or directory\\n"\n'
Stderr: ''
Unexpected error while running command.
这与以下内容相关:MAAS 2.0 导入自定义图像不起作用
答案1
我对上述问题的解决方案原来与文件格式有关。
这:
根据需要自定义镜像,卸载并压缩
umount /tmp/image gzip root-image
应该:
然后根据需要自定义图像:
cd /tmp/image
tar -cf /root/root-tgz ./*
gzip /root/root-tgz
mv /root/root-tgz.gz /root/root-tgz
(最后一步是可选的)
我还将启动资源创建更改为:
maas admin boot-resources create name="custom/my-custom-image" architecture="amd64/generic" filetype=tgz title="我的自定义图像" content@=/root/root-tgz