我使用以下JSON和KS.cfg来构建centos8模板。但是遇到了软盘错误(配置中没有使用软盘)。我已尝试更改启动顺序,但没有成功。也没有找到用于vsphere-iso构建器的centos 8 Json的示例。有人能帮我一下吗?
CentOS 8 JSON
{
"variables": {
"vsphere_uid": "Null",
"vsphere_passwd": "Null",
"vm_superuser_passwd" : "Null",
"vsphere_vm_name": "Null",
"bastion_host": "",
"bastion_user": "",
"bastion_password":"Null",
"datacenter": "",
"cluster": "",
"datastore": "",
"network": "",
"iso_paths": ""
},
"builders": [
{
"type": "vsphere-iso",
"vcenter_server": "{{user `vsphere_server` }}",
"username": "{{user `vsphere_uid` }}",
"password": "{{user `vsphere_passwd` }}",
"insecure_connection": "true",
"datacenter": "{{user `datacenter` }}",
"cluster": "{{user `cluster` }}",
"datastore": "{{user `datastore` }}",
"network": "{{user `network` }}",
"vm_name": "{{user `vsphere_vm_name` }}",
"guest_os_type": "centos7_64Guest",
"ssh_username": "admin",
"ssh_password": "{{user `vm_superuser_passwd` }}",
"ssh_bastion_host": "{{user `bastion_host` }}",
"ssh_bastion_username": "{{user `bastion_user` }}",
"ssh_bastion_agent_auth": true,
"CPUs": 2,
"RAM": 5120,
"RAM_reserve_all": false,
"convert_to_template": true,
"disk_controller_type": "pvscsi",
"disk_size": 102400,
"disk_thin_provisioned": true,
"network_card": "vmxnet3",
"http_directory" : "httpks",
"iso_paths": [
"[nfs] centos/CentOS-8.2.2004-x86_64-minimal.iso"
],
"iso_checksum": "e15fb0e51726de0a4128448b9bd63e7b",
"iso_checksum_type": "md5",
"boot_command": "<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg <enter><wait>"
}
]
}
错误是:
dracut-pre-udev{585}: modprobe: FATAL: Module floppy not found in directory /lib/modules/4.18.0-193.2l8.x86_64
—
2020/09/17 05:17:40 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepConfigParams'. Press enter to continue.
2020/09/17 05:17:40 packer-builder-vsphere-iso.linux:
2020/09/17 05:17:40 No floppy files specified. Floppy disk will not be made.
2020/09/17 05:17:40 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepCreateFloppy'. Press enter to continue.
2020/09/17 05:17:40 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepAddFloppy'. Press enter to continue.
— Dracut-initqueue: warning : could not boot Entering Emergency mode.
敬请协助
发布于 2021-01-30 11:36:30
使用cd_files
的工作cdrom替代方案
https://www.packer.io/docs/builders/vmware/vsphere-iso#cd_files
packer 1.6.6
相关代码片段
...
"type": "vsphere-iso",
"guest_os_type": "centos8_64Guest",
"cd_files": [
"{{template_dir}}/ks.cfg",
],
"boot_command": [
'<up>'
'e',
'<down><down><end><wait>',
' text ks=cdrom:/dev/sr1:/ks.cfg'
'<leftCtrlOn>x<leftCtrlOff>',
],
...
发布于 2020-12-02 06:17:11
你现在可能已经发现了,但对于那些寻找事实的人来说:
操作系统不再包含软盘设备驱动程序,因此您需要使用其他来源进行KS配置。inst.ks使用与inst.repo相同的格式,大多数人将使用HTTP源。
发布于 2021-03-10 00:51:12
我也遇到过类似的问题: vsphere-iso packer build使用了错误的HTTP目录IP,特别是当我在我公司的VPN上,而不是硬连线的时候。因此,它一直停留在‘等待IP’,并收到相同的dracut-init错误。对我来说,问题是packer用来确定哪个接口用于包含我的kickstarter文件的HTTP目录的优先顺序。
我们是如何解决这个问题的,实际上我们有一个外壳包装器,叫做packer。在该脚本中,我们要求用户输入访问HTTP目录的IP地址。我使用ifconfig并查看列表中的10.IP。shell脚本将环境变量传递给我的包装器的build.json它不是最干净的解决方案,但我已经使用这个修复程序好几个月了。让我知道如果你仍然有问题,我可以发布一些代码。
https://stackoverflow.com/questions/63949928
复制相似问题