Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Ubuntu

Lubuntu or Ubuntu Fails to Update on VirtualBox Virtual Machine

0.00/5 (No votes)
12 Oct 2012CPOL2 min read 8.5K  
When a Lubuntu or Ubuntu is installed in a VirtualBox, by default the networking mode is selected NAT.

Sometimes, I feel like I have reached the end point of my patience just like this day when I was stuck in Lubuntu update. I set up the Lubuntu in VirtualBox virtual machine. Right after the installation, I tried to update it – it failed to update, then I tried to install GNOME-Commander that also failed.

The error was like this:

Failed to fetch 
http://archive.ubuntu.com/ubuntu/pool/main/libe/liberror-perl/liberror-perl_0.17-1_all.deb Size mismatch
Failed to fetch 
http://archive.ubuntu.com/ubuntu/pool/main/g/git/git-man_1.7.5.4-1_all.deb Bad header line 
[IP: 91.189.92.181 80]
Failed to fetch 
http://archive.ubuntu.com/ubuntu/pool/main/g/git/git_1.7.5.4-1_i386.deb Bad header line 
[IP: 91.189.92.181 80]
Failed to fetch 
http://archive.ubuntu.com/ubuntu/pool/main/p/patch/patch_2.6.1-2_i386.deb Bad header line 
[IP: 91.189.92.181 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

It seemed that it could not connect to the server very well. But when I check the internet connection, it works fine in all browsers. I searched about this topic in Google but could not find any way to fix it, not even in Ubuntu Forum. I was super confused and didn’t ever think that it could be an issue from VirtualBox – because all the browsers were working fine. Fortunately, the next day a post from Nicolas saved me out.

The network connection for a VirtualBox uses optionally 8 hardware settings and 6 networking modes. Check out here for details. Among the 8 hardware, most commonly used hardware is AMD PCNet FAST III (Am79C973, the default) – no problem with that. But among the 6 networking modes, the following 3 are mostly used:

  • Not attached mode (the guest OS consider that the network cable is unplugged)
  • Network Address Translation (NAT) mode (uses NAT between guest and host OS – therefore has some limitation)
  • Bridged networking mode (VirtualBox connects to one of your installed network cards and exchanges network packets directly)

When a Lubuntu or Ubuntu is installed in a VirtualBox, by default, the networking mode is selected NAT which is OK for browsing but has certain limitations with some protocols (i.e., NFS) and that leads to our problem – the Update manager cannot communicate with the servers properly.

So to fix this issue, just change the mode from NAT to Bridged networking mode. To do this in VirtualBox, go to Settings -> Network, under the first tab, change the ‘Attached to’ drop-down from ‘NAT’ to ‘Bridged Adapter’.

Hope this post will save a day of yours.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)