Linux Virtual Machine runs Slow depending on the Network

6

2

At work I use a VM running Linux Mint 13 under Oracle VM VirtualBox 4.2.16 on a Windows7 machine. The laptop is connected to a network cable and the wireless connection is turned off. The network setup for the VM is to use a Bridged Adapter to the Gigabit Network Connection with its own MAC Address. This allows me to run Samba on the Linux system so I can share files between the two operating systems. Everything works fine.

The problem happens when I take the laptop home. At home I use the wireless connection. The Windows side has no internet connectivity problems. The VM, on the other hand, runs really slow. Bringing up a xterm window and completing an 'ls' command might take 15 seconds. I've tried bringing up the VM with different adapter settings in VirtualBox and even with all Network Adapters disabled, but I see the same behavior every time.

When I'm patient enough (and an adapter is connected), I can see that the VM is getting an IP Address but it's unable to ping anything in the outside world. What could be happening here?

To further confuse things, I have a second VM running the same version of Linux Mint. Same VM hardware setup, it just doesn't have Samba running or any of my work. :) Anyway, it connects to the internet and runs just fine.

What could be different between the two that could cause one Linux VM to be so slow that it's unusable? I've tried stopping Samba, but that doesn't seem to change anything. What else could I try?

Update

Results of experiments tonight (Note: By "Xterm operations" I mean simple things like typing 'ls' in an Xterm window and navigating a directory structure):

  1. Tried running with no network connections enabled at all on the laptop (Windows or VM). Xterm operations were still slow.
  2. Enabled wireless network connection to the laptop. Enabled network connection to the VM, but did not attach it. Xterm operations were slow.
  3. Enabled NAT connection to the VM. The VM obtained a strange IP Address (10.0.3.15) and Xterm operations were still slow.
  4. Enabled bridged connection. Obtained correct IP Address (172.16.42.7, Windows was 172.16.42.4 and both had 255.255.255.0 for the mask), but Xterm operations were slow. Was able to ping 172.16.42.1 from the VM and ping the VM from Windows.

I should mention that I'm connecting to the Guest Network on my Apple Time Capsule.

At this point, I double checked the hardware configuration between my two VMs - the working one and the non-working one. I noticed 3D acceleration was enabled for the non-working one. When I disabled 3D acceleration, the Cinnamon windows manager displayed numerous graphical glitches, but Xterm operations were normal speed. I disabled 3D acceleration and rebooted into the software rendered version of Cinnamon.

The graphical glitches were gone and Xterm operations were normal speed. Unfortunately I could not connect externally. By that I mean I could ping 172.16.42.1, but not www.google.com. I would be okay switching to MATE, but that's difficult right now without an external connection.

Why would the window manager and/or 3D acceleration affect operations in an Xterm window when I'm running on a different network? Or could this be related to a different factor like the power supply? Something magical about my kitchen table?

Update 2

I switched Linux Mint 13 from running Cinnamon to running MATE and that solved the slowness problem!

Unfortunately I'm not out of the woods yet. This is probably a separate problem, but I can't connect to the outside world. The Linux Mint VM running MATE starts up and obtains an IP Address. I can ping the system from Windows. I can even mount the Linux Mint Samba share from Windows and browse the directories.

From the Linux Mint VM perspective, I can't ping the Windows host, but I can ssh into a Raspberry Pi on my network. So connectivity inside the network appears to work fine. I just can't ping Google from the Linux Mint VM. I even tried connecting via my wired network, but no luck there. I should probably write up a new question, but I wanted to at least post an update here on my latest status.

GrandAdmiral

Posted 2013-08-29T19:47:59.837

Reputation: 435

Verify that the emulated hardware in both VMs are identical. Try in Windows to un-check the “VirtualBox Bridged Networking Driver” setting in the “Wireless Network Connection Properties” dialog for the wireless card adapter. – harrymc – 2013-09-05T06:24:37.943

"when I'm patient... the VM is getting an IP Address ": what address? what is the network mask in your host (windows)? what kind of networking (bridged, nat?) Can windows ping the linux box? – Riccardo Zorn – 2013-09-05T19:03:53.543

@harrymc - The emulated hardware in both VMs is identical. If I un-check the "Bridged Networking Driver", that will break my Samba share because the VM will use the same IP Address as Windows. I don't really want to do that. – GrandAdmiral – 2013-09-06T11:00:42.800

@Riccardo Zorn - Basically it gets another address on the network. I'll confirm the numbers and try pinging the Linux box from Windows. – GrandAdmiral – 2013-09-06T11:04:34.570

Try switching off Windows Firewall (or maybe the VM's firewall (e.g. iptables)) to see if that is interfering with connectivity to the VM - sounds like it's managing to get an address via DHCP and then being blocked. The UI on VM is likely be slow if it think it's got an interface up as it tries to DNS lookups for X desktop services is timing out. – Pierz – 2013-09-06T15:43:39.923

I'll just reiterate that I can bring up the VM with all network connections disabled and I still see the same slowness problem. Does that make sense with any of the proposed fixes? – GrandAdmiral – 2013-09-06T18:43:52.110

Answers

3

It could very easily be that the wrong thing is getting set in /etc/resolv.conf. Either the contents point to the wrong DNS server (non-existant, broken, or behind a firewall (the one at work) or your network is not providing you access to the network where the listed nameserver resides (e.g., the internet, or your local router/gateway device.

When the VM is acting slow, as root, edit /etc/resolv.conf and comment out everything in it.

See if operations become normal speed again. If they do, then access to DNS is what is slowing you down.

Then ping 8.8.8.8. If it works, edit /etc/resolv.conf and put this as the first line:

nameserver 8.8.8.8

Wayne Walker

Posted 2013-08-29T19:47:59.837

Reputation: 206

I commented out everything in /etc/resolv.conf and it worked! I was able to connect to the external world. I'll leave everything commented out and try it at work. What's interesting is that the other VM didn't have an /etc/resolv.conf file. I don't know enough about Linux to know why the two were different, but they were. – GrandAdmiral – 2013-09-20T02:45:04.127

The VM connets to the external world at work too. I'm not sure what happened, but at least things are working now. – GrandAdmiral – 2013-09-20T14:14:54.293

0

Looks like something is loused-up within the VM, but I don't think it is possible for us here to find out what's wrong for you over there. Only you can do that, because only you can experiment.

In the case that the problem is with the VM's definition, you could try to delete the VM while keeping the .vdi file, create a new virtual machine (with attention to the 32/64-bits host/guest question), and attach the .vdi disk.

If this doesn't help, then the problem is inside the VM within Linux Mint internals and can be anything at all.

If nobody comes up with any better idea, I would then suggest junking this VM and starting afresh, maybe taking the VM that works as a starting point.

harrymc

Posted 2013-08-29T19:47:59.837

Reputation: 306 093

The problem with junking it is that I've installed a lot of toolchains and self-compiled libraries. I don't want to reconstruct all that work just because the VM doesn't work at home. That said, I would like it to work at home. Could you explain what attaching the .vdi file to a new virtual machine would do for me (i.e. does it keep the filesystem intact)? Could I copy that file and attach the duplicate to a new VM? That way I could try what you are suggesting without touching the other VM. – GrandAdmiral – 2013-09-07T11:46:59.700

Yes, that will work too. – harrymc – 2013-09-07T11:55:44.640