2

I am creating an Ubuntu Server VM with VirtualBox. This morning I created the VM (with Networking configurations shown below) and installed the guest OS from an ISO.

I just logged in for the first time and tried to run apt-get update and got a million errors:

Failed to fetch <some-http-url>. Temporary failure resolving <blah>.ubuntu.com

I believe it's giving me one error message for each item it's trying to update. This tells me my network settings on either the VBox machine (.vbox file) or the guest OS instance (installed in the .vdi file) are set incorrectly or not at all.

How do I diagnose which of the two is happening here, and what are my options? I'd hate to have to reinstall the entire OS again...

VBox Network Settings for the machine are as follows (for Adapter 1 only):

  • Network Adapter is enabled
  • Attached to NAT
  • Adapter type: IntelPRO 1000/MT Desktop
  • Cable connected is enabled/set

I hope the issue is the last item (Cable connected is set to true). I am running the guest OS VM on a laptop which is using a wireless connection to my home LAN. Perhaps the guest VM is expecting a wired connection?

Edit adding screenshots show VM networking settings:

enter image description here

Running ifconfig:

enter image description here

Running route:

enter image description here

6 Answers 6

4
+175

The bounty will be rewarded to the individual who can help me get this Ubuntu Server VM connected to the internet (instead of just having a private LAN between itself and the host machine) and to be visible to the wireless router the host machine is connected to. This is because I need to use MAC/IP reservations and give my VM a dedicated IP address, and so it must be visible to the router.

Based on the bolded text above (bolding is mine), I am 100% certain that you need Bridged mode. From my Windows install of VBox:

vbox-routed

If it doesn't work, check and make sure that your VBox install properly installed all the kernel modules in the host for the network adapters, and make sure that the guest has Guest Additions installed and working properly.

Then you can configure your guest on the wifi network of the host as if you have two "PCs" inside of your one PC. One IP for the host and one for the guest on the same private subnet.

For a thorough explanation from the authors of VirtualBox, see their website / manual about NAT vs. Bridged vs. Host Only network mode.

Also, from the VirtualBox manual, which I linked to above:

Note Bridging to a wireless interface is done differently from bridging to a wired interface, because most wireless adapters do not support promiscuous mode. All traffic has to use the MAC address of the host's wireless adapter, and therefore VirtualBox needs to replace the source MAC address in the Ethernet header of an outgoing packet to make sure the reply will be sent to the host interface. When VirtualBox sees an incoming packet with a destination IP address that belongs to one of the virtual machine adapters it replaces the destination MAC address in the Ethernet header with the VM adapter's MAC address and passes it on. VirtualBox examines ARP and DHCP packets in order to learn the IP addresses of virtual machines.

7
  • I also seem to think that bridged mode only works with physical/ethernet connections
    – Journeyman Geek
    Aug 24, 2012 at 23:59
  • This is not the case. Any valid network adapter can be used in bridge mode. This is even truer on Linux than on Windows, because Windows treats some things (such as dial-up modems) differently than it treats true network adapters. On the other hand, every network-related device on Linux is available through the IP stack the same way. I've definitely bridged a VBox guest to a WiFi adapter on Linux before. Aug 25, 2012 at 0:02
  • I edited my answer to quote the VirtualBox manual stating that, while bridging to a wireless interface is "different", it is still possible. Aug 25, 2012 at 0:04
  • Odd, this has never worked for me. I got into the habit of having a usb wifi adaptor and directly passing it through - virtualbox.org/ticket/393 seems to indicate its specific to the adaptor.
    – Journeyman Geek
    Aug 25, 2012 at 0:05
  • That's a 4-5 year old defect, by the way. We're up to VirtualBox version 4.1.x (stable). That defect talks about version 1.x, which is ancient history. Aug 25, 2012 at 0:06
1

There's another option - bypass virtualbox's networking completely and using a dedicated USB wireless adaptor you pass through to the host.

I'd also note we haven't actually trouble shot the network properly - can you ping google and 8.8.8.8? What would traceroute look like? Does switching to another mirror help? i've found that my local mirror is horrid and end up using the UK or US mirrors instead.

0

1st step run

# ifconfig

and see if the eth interface is up and you got the corresponding IP

2nd edit

/etc/network/interfaces

and see if you got something like

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp
4
  • Thanks @Pat (+1) - please see my edits regarding VM network config, ifconfig and route. My /etc/network/interfaces file is identical to yours above. Hope this helps and thanks again!
    – pnongrata
    Aug 24, 2012 at 22:29
  • your net looks OK... next confirm you can ping from within the VM any internet host like www.ibm.com or thing like that. next past here some of the errors, probably your problem is not the net but the apt-get conf files
    – Pat
    Aug 24, 2012 at 23:16
  • well, I see you have changed your original question....
    – Pat
    Aug 25, 2012 at 1:31
  • This is really awesome the asker makes a question, gives his aproval on certain answer, after that he changes the question, then the answer does not make much sense on the new scenario, then the answer gets downgraded for some other reader...
    – Pat
    Sep 17, 2012 at 21:35
0

If the server must be visible to the router and receive its own IP address, you want a bridged network connection instead of NAT. Select "Bridged Adapter" under "Attached to:" and select your wireless network card under "Name:"

A bridged connection creates a direct connection to the router instead of a translated connection through the host machine.

3
  • I dont know why this answer was downvoted as it is correct.
    – Kendrick
    Aug 24, 2012 at 23:26
  • Could be because I posted 30 seconds after allquixotic's answer. I'm new here. Should I just delete my answer?
    – Ryan
    Aug 24, 2012 at 23:27
  • as far as I know its a manual process. Also your post shows 18 min and his 20 so doubt thats it either.
    – Kendrick
    Aug 24, 2012 at 23:36
0

I just logged in for the first time and tried to run apt-get update and got a million errors: Failed to fetch . Temporary failure resolving .ubuntu.com

Since you had this error how is the machine getting dns? ping www.google.com before you get an issue like the error message above and ensure that dns is properly responding. If you havent set a static ip the above bridge suggestion is the way I would go in that respect.

you have not mentioned what your HOST os is. I have a system that has a pair of those intels and when I started dualbooting between windows and linux, Win got finiky about holding the network interface up. I never 1ce had an issue with linux makeing or holding a network connection. I often transfer 50+gb at a time and it didn't even flintch. Windows on the other hand would randomly not get on the network. its possible there is a bug with either the driver or the nic that it isnt playing nice.

2
  • The OP is pretty clearly running a recent-ish version of Ubuntu, judging from the GTK+ theme that is displaying the VirtualBox GUI in his screenshot. I'd say it's at least version 10.04. Aug 24, 2012 at 23:45
  • Good guess @allquixotic - 12.04
    – pnongrata
    Aug 25, 2012 at 0:16
0

If the network is functioning correctly (for example you can browse the Internet), then the apt-get problem must relate to bad depository(ies) in the sources list of apt-get.

Verify the contents of the sources.list file, or compare it with an Ubuntu installation where apt-get works correctly.

The site Ubuntu Sources List Generator can also help you generate a new sources.list (but save the old one first).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .