User login

VirtualBox guests lose shared folder and networking on host suspend resume


VirtualBox (in my case, vagrant-managed) local-only network connections (and, e.g. NFS shares piped through them) fail when the host syspends and resumes. NetworkManager (or possibly another network managers) are interfering. If you use NetworkManager, get it out of the way by adding:

to your /etc/NetworkManager/NetworkManager.conf. (Additional interfaces can be listed after a semi-colon). If you need to read this later and get back to work NOW, try this:
VBoxManage hostonlyif ipconfig vboxnet0 --ip 192.your.subnet.1


When an active virtual machine is running, and the host is suspended, upon resume:

  • NFS shared folders are unavailable within the guest
  • host-only network is unreachable in the guest
  • The host network adapter (vboxnetX) is ACTIVE yet has no IP address


In my case, NetworkManager was attempting to manage the interfaces, for which it does not have configuration. Network manager clears the IP address assigned to the network adapter (typically vboxnet[0...]), disabling communication to the host from the guest. As your computer goes to sleep, you may see a similar entry in your logs:
NetworkManager[440]: <info>  (vboxnet0):  device state change: activated -> unmanaged (reason 'sleeping').


If NetworkManager is your current network management software, you can disable it's management of certain interfaces by adding the following to your to /etc/NetworkManager/NetworkManager.conf:

Additional interfaces (e.g. vboxnet1) can be specified on the same line by adding a semicolon, and repeating the selection (e.g. add ';interface-name:vboxnet1').

If you cannot modify the system for some reason (which I'd find odd), or just want to make the adapter work immediately, you can use either of these methods to bring the machine back, without losing anything:

Simply suspend the machine and bring it back up:
vagrant suspend && vagrant resume

Or, directly reactivate the network adapter for the internal networking, for example, my guest has the fixed IP, so I give the adapter the x.x.x.1 address with:
VBoxManage hostonlyif ipconfig vboxnet0 --ip

I found the solution thanks to this bug report. There's also mention there of using an asterisk for NetworkManager's configuration for the numeric portion of the adapter name if you have multiple, which I certainly do! Alas, this did not work for me (version

There is another possibility for making this work, however my attempts at this also failed. Using udev, you can flag an interface (or set of interfaces - asterisk support definitly works here!) such that NetworkManager automatically ignores it. The NetworkManager documentation mentions an NM_UNMANAGED flag. Frankly, I'm not sure how to set it - I tried creating a rules file in /etc/udev/rules.d/z21_persistent-local.rules, and do see that it takes effect with udevadm, however, this did not make NetworkManager ignore the interface. It seems YMMV!

udev rule:

Testing udev:
# udevadm info --path=/devices/virtual/net/vboxnet0
P: /devices/virtual/net/vboxnet0
E: DEVPATH=/devices/virtual/net/vboxnet0
E: ID_NET_DRIVER=vboxnet
E: ID_NET_LINK_FILE=/lib/systemd/network/
E: ID_NET_NAME_MAC=enx0a0027000000
E: INTERFACE=vboxnet0
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/vboxnet0
E: TAGS=:systemd:

I did also try using true for this value with the same result (1 or true are supposed to work).

I believe it is possible to use a single interface for all your local-only hosts. This should also allow the guests to communicate with one another privately (which you may not want). If this method interests you, you may want to start here.

Searched words: 
vbox VirtualBox vagrant nfs networking hang NetworkManager


Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.