---
title: 执行virt-install创建虚拟机时提示“ERROR --os-variant/--osinfo OS name is required, but no value was set or dete
description: 执行virt-install创建虚拟机时提示“ERROR --os-variant/--osinfo OS name is required, but no value was set or detected.”。
keywords: 虚拟机;Secure Boot;BIOS
url: https://www.hiascend.com/document/caselibrary/detail/topic_0000002239384706
section: (其他)
---

# 执行virt-install创建虚拟机时提示“ERROR --os-variant/--osinfo OS name is required, but no value was set or dete

URL: https://www.hiascend.com/document/caselibrary/detail/topic_0000002239384706
描述: 执行virt-install创建虚拟机时提示“ERROR --os-variant/--osinfo OS name is required, but no value was set or detected.”。
关键词: 虚拟机;Secure Boot;BIOS

昇腾文档 [了解详情](https://www.hiascend.com/document)

故障案例 [了解详情](https://www.hiascend.com/document/caselibrary)

执行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.”

2025/04/11

612

问题信息

| 问题来源 | 产品大类 | 产品子类 | 关键字 |
| --- | --- | --- | ---|
| 内部测试 | 部署虚拟机 | 虚拟机 | 虚拟机、Secure Boot、BIOS |

#### 问题现象描述

执行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而被阻止。

#### 解决措施

1. 通过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
2. 进入虚拟机的BIOS界面，Secure Boot。

1. 执行如下命令，连接到虚拟机。

virsh consolekylin

```
Cnnected to domain ‘kylin’
Escape character is ^] (Ctrl + ])
 
 
 
 
Press ESC in 1 seconds to skip startup.nsh or any other key to continue
Shell>
```
2. 在UEFI shell界面输入exit，按“Enter”键进入BIOS界面。
3. 依次选择“Device Manager &gt; Secure Boot Configuration &gt; Attempt Secure Boot”，按“Enter”键将“Attempt Secure Boot”右侧的[X] 变为[ ]）。
4. 选择“Reset Secure Boot Keys”并选择“Yes”确认重置Secure Boot Keys。
5. 连续两次按ESC键返回初始目录。
6. 选择“Reset”，并按“Enter”键，使安全启动修改生效，完成安全启动设置。
3. 在物理机上执行如下命令，打开虚拟化管理器。

virt-manager

1. 双击准备安装的虚拟机，打开图形化界面。
2. 单击图标并选择“SCSI CDROM 1”。
3. 单击“Browse”，根据物理机目录选择安装的镜像ISO文件。
4. 依次单击“Choose Volume”和“Apply”完成镜像挂载。
4. 重新进入虚拟机BIOS界面，依次选择“Boot Manager &gt; UEFI QEMU QEMU CD-ROM”并按“Enter”键。
5. 在下图中单击图标。
6. 安装虚拟机OS。
7. 安装流程结束后，单击图标。
8. 单击“Remove”后并单击“Delete”，删除挂载的镜像。

本页内容

- 问题信息
- 问题现象描述
- 原因分析
- 解决措施
