---
title: 删除虚拟机时提示cannot undefine domain with nvram的解决方法
description: 执行virsh undefine vm2，提示如下信息：
url: "https://www.hikunpeng.com/document/detail/zh/kunpengcpfs/troubleshooting/trouble/kunpengkvm_09_0011.html"
---

# 删除虚拟机时提示cannot undefine domain with nvram的解决方法

#### 问题现象描述

执行virsh undefine vm2，提示如下信息：

```
error: Requested operation is not valid: cannot undefine domain with nvram
```


#### 关键过程、根本原因分析

虚拟机启动时使用了nvram文件，销毁该虚拟机需要指定nvram的处理策略。


#### 结论、解决方案及效果

在命令中添加"--nvram"参数，使得在销毁虚拟机的同时，也删除对应的nvram文件。执行如下命令，删除虚拟机。

```
virsh undefine vm2 --nvram
```
