Removing a Guest VM from the command line

Discussions related to using VirtualBox on Linux hosts.
Locked
memilanuk
Posts: 54
Joined: 1. Jul 2009, 18:16
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: openSuSE, Fedora, Ubuntu, CentOS
Location: Wenatchee, WA USA

Removing a Guest VM from the command line

Post by memilanuk »

Hello,

I'm hoping this is a lot easier than it seems...

What command (or string of commands) do I need to do to completely remove, unregister, nuke, whatever a given guest VM? When looking at the manual there are all kinds of options for adding and modifying stuff, but it sure skates around the topic of getting rid of a VM once its set up...

TIA,

Monte
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Removing a Guest VM from the command line

Post by Perryg »

VBoxManage unregistervm <uuid>|<name> [--delete]
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Removing a Guest VM from the command line

Post by Sasquatch »

And don't forget "VBoxManage closemedium disk|dvd|floppy <uuid>|<filename> [--delete]" to remove the VDI file too.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
memilanuk
Posts: 54
Joined: 1. Jul 2009, 18:16
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: openSuSE, Fedora, Ubuntu, CentOS
Location: Wenatchee, WA USA

Re: Removing a Guest VM from the command line

Post by memilanuk »

Perryg wrote:VBoxManage unregistervm <uuid>|<name> [--delete]
Didn't work, complained about still having disk images registered/attached/mounted (don't recall the exact verbage)

Start to finish, once you decide to get rid of a VM and its associated disk image... what command sequence do you use?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Removing a Guest VM from the command line

Post by Perryg »

Snapshots?
memilanuk
Posts: 54
Joined: 1. Jul 2009, 18:16
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: openSuSE, Fedora, Ubuntu, CentOS
Location: Wenatchee, WA USA

Re: Removing a Guest VM from the command line

Post by memilanuk »

Didn't last long enough for there to be any.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Removing a Guest VM from the command line

Post by Sasquatch »

Then it would appear you remove the disk first. Or at least unregister it from the VM.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
alpha_YbSXf
Posts: 5
Joined: 1. Mar 2018, 20:32

Re: Removing a Guest VM from the command line

Post by alpha_YbSXf »

The unregister command worked for me, when I ran it as a elevated user (adminstrator on Windows).

However, it did leave behind the Snapshots. So I manually deleted that after running the unregistervm --delete option.

Further, if I run `VboxManage.exe list vms`the old VM is still listed.

How do I remove and unlist the non-existent VM from the command line?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Removing a Guest VM from the command line

Post by socratis »

I'm sorry, but this is an 8-year old thread. It's beyond the limits of a "dead thread". I'm going to have to ask you to open a new thread, we can't be building the discussion on such old foundation.

Locking this.

PS. Do *not* change the user when doing VM operation. VirtualBox uses a per-user environment. Becoming root (or any other user) does *not* give you access or more powers to the original user's VMs. *ALWAYS* perform VM operations as the user that actually created the VMs.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Locked