执行virt-install创建虚拟机时提示“ERROR --os-variant/--osinfo OS name is required, but no value was set or detected.”
问题描述
执行virt-install创建虚拟机时提示“ERROR --os-variant/--osinfo OS name is required, but no value was set or detected.”。
ERROR --os-variant/--osinfo OS name is required, but no value was set or detected. This is now a fatal error. Specifying an OS name is required for modern, performant, and secure virtual machine defaults. If you expected virt-install to detect an OS name from the install media, you can set a fallback OS name with: --osinfo detect=on,name=OSNAME You can see a full list of possible OS name values with: virt-install --osinfo list If your Linux distro is not listed, try one of generic values such as: linux2022, linux2020, linux2018, linux2016 If you just need to get the old behavior back, you can use: --osinfo detect=on,require=off Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
可能原因
根因:Ubuntu系统上安装非官方系统时,会因为UEFI Secure Boot而被阻止。
解决方案
- 通过virt-install创建虚拟机时,同时关闭os的需求,即在原有的创建指令后添加--osinfo detect=on,require=off参数,例如:
virt-install --name=kylin --vcpus=4 --ram=8192 --disk path=/home/kvm/images/kylin.img,format=qcow2,size=100,bus=virtio --cdrom /home/kvm/Kylin-Server-10-SP2-aarch64-Release-Build09-20210524.iso --network bridge=virbr0,model=virtio --force --autostart --graphic vnc,listen=0.0.0.0,port=5906 --input type=tablet,bus=usb --input type=keyboard,bus=virtio --osinfo detect=on,require=off
- 进入虚拟机的BIOS界面,关闭Secure Boot。
- 执行如下命令,连接到虚拟机。
Cnnected to domain ‘kylin’ Escape character is ^] (Ctrl + ]) Press ESC in 1 seconds to skip startup.nsh or any other key to continue Shell>
- 在UEFI shell界面输入exit,按“Enter”键进入BIOS界面。
- 依次选择“Device Manager > Secure Boot Configuration > Attempt Secure Boot”,按“Enter”键将“Attempt Secure Boot”右侧的[X] 变为[ ])。
- 选择“Reset Secure Boot Keys”并选择“Yes”确认重置Secure Boot Keys。
- 连续两次按ESC键返回初始目录。
- 选择“Reset”,并按“Enter”键,使安全启动修改生效,完成安全启动设置。
- 执行如下命令,连接到虚拟机。
- 在物理机上执行如下命令,打开虚拟化管理器。
- 重新进入虚拟机BIOS界面,依次选择“Boot Manager > UEFI QEMU QEMU CD-ROM”并按“Enter”键。
- 在下图中单击图标
。
- 参考虚拟机安装OS章节安装虚拟机OS。
- 安装流程结束后,单击图标
。
- 单击“Remove”后并单击“Delete”,删除挂载的镜像。
父主题: FAQ