XenServer Ghost Devices Woes

February 1, 2016


As you may recall from my previous article, XenServer and HP Firmware Woes,  I was involved in a rather large XenServer upgrade project.

Anyone that has done some XenServer updates/upgrades surely has come across the “ghosted nics” issue before. I’m certainly not alone, since CTP Alexander Ervik Johnsen also wrote a little something on his blog the other day, you can read about his solution here.

As you might have guessed, Ghost or Phantom NIC’s are a bad thing. The solution sounds simple enough: get rid of them. From a technical perspective, it’s not a difficult thing to do. As Alexander Ervik Johnsen mentioned, it’s a matter of following these steps:

  1. Log in as local admin account (TIP: make sure you know this one BEFORE you start upgrading)
  2. Open a command prompt
  3. Issue the command “set devmgr_show_nonpresent_devices=1”
  4. Launch Device Manager by typing devmgmt.msc in the same command prompt session (so the device manager session “sees” the environment variable)
  5. In Device Manager select View -> Show hidden devices
  6. Now the Ghosted NIC’s should be visible and you should be able to just uninstall them, just by right-clicking them and select uninstall

It’s a quite straightfoward procedure to follow, but it can become a very tedious job if you need to go through these for a high number of VM’s.

And there’s more to it… from time to time, Device Manager does not seem to respond to the uninstall command. You click uninstall, you do a refresh and the device is still there. Issueing multiple uninstall commands won’t help you either.

So then there is the option to dive into the Registry and carve out the Ghost device by hand. It can be done, but it will take a lot of time and is not without any risk.

The solution? Enter a marvelous tool I (re)discovered recently: GhostBuster (by wvd_vegt, https://ghostbuster.codeplex.com/). It scans for ghosted devices, shows them in a nice GUI so you can
select the Ghosted NIC by selecting “Add Device”

2016-01-20 22_29_20-XenCenter

When selected you hit the Remove Ghosts button

2016-01-20 22_29_54-XenCenter

And you’re done.

Ghostbuster even comes in a portable format, so there’s no need to install it every time.

So, to make my life a bit easier, I created a small ISO file that I can mount on a VM. That ISO contains a couple of things:

  • start.cmd -> sets the devmgr environment variable and starts Device manager with “View Hidden” already enabled
  • the MMC used by start.cmd which is good old Device Manager with “View Hidden” enabled.
  • the portable version of Ghostbuster

I’ve thought about automating it some more, like using GhostBuster to automatically clean stuff. The biggest issue there is that in my environment, the number of ghosted nics is not always the same, it’s not always the “Realtek” either, I’ve seen cases where I have the Realtek nic and 3 ghosted Xenserver NICs together. In that type of situation, I’d like to control things myself, because this usually means something else is also very much messed up with that VM.

Maybe I’ll do the automation part in the future, but for now, I use the ISO as is. If you like it too, you can find it in the Downloads section.

You can always find the most current files by going to http://carlwebster.com/where-to-get-copies-of-the-documentation-scripts/ and looking in the Bart Jacobs’ Toolbox section.


Bart Jacobs

About Bart Jacobs

Bart Jacobs is a Senior System Engineer/Consultant based in Belgium. He started his career back in 1998. One of the first projects he worked on in those days was Citrix Metaframe 1.8 on Microsoft Windows NT 4 Terminal Server codename "Hydra". Over the years, Citrix technology has always been a major theme in his professional career, resulting in becoming a true technical expert in the matter. In the last few years, he has also become an expert in virtualization technology, with a special interest in a real challenger in this business: Citrix XenServer. Bart has founded his own company BJ IT back in 2007 and is mainly working as a (Citrix) consultant now.

View all posts by Bart Jacobs

One Response to “XenServer Ghost Devices Woes”

  1. Alan Lantz Says:

    Now why didn’t I think of this. I get so annoyed with ghosted network interfaces. Next time I upgrade XenTools I will have this handy.


Leave a Reply