---
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
sourcePath: /source/zh/kunpengcpfs/troubleshooting/trouble/kunpengkvm_09_0011.html
indexId: 736035d9d2c857a38fc363ec19500b3622e50acdada5448217aeffea9eca172170
---
# 删除虚拟机时提示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
```
