All my Ubuntu VMs have apt-get update problems
I'm running Virtualbox 4.1 on an x86_64 Windows 7 host. I've got a collection of 12.04 and 10.04 LTS VMs I use to create debs for work. In the last week I started noticing problems on the 12.04 VMs. Tried the usual apt-get clean bit which didn't help.
I rolled a new 11.10 VM for testing a Worpress upgrade. This VM has never been able to run apt-get update without errors. The interesting errors look like this:
Get: 8 http://security.ubuntu.com oneiric-security/main Translation-en_US [344 B]
14% [7 Sources 48686/877 kB 6%] [Waiting for headers]bzip2: (stdin) is not a bzip2 file.
Hit http://security.ubuntu.com oneiric-security/multiverse Translation-en
Hit http://security.ubuntu.com oneiric-security/restricted Translation-en
Hit http://security.ubuntu.com oneiric-security/universe Translation-en
22% [7 Sources 127526/877 kB 15%] [Waiting for headers]/usr/bin/xz: (stdin): File format not recognized
and ends with
/usr/bin/xz: (stdin): File format not recognized
Ign http://us.archive.ubuntu.com oneiric/main Translation-en_US
Ign http://us.archive.ubuntu.com oneiric-updates/main Translation-en_US
Fetched 18.5 MB in 47s (392 kB/s)
W: GPG error: http://us.archive.ubuntu.com oneiric InRelease: File /var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_oneiric_InRelease doesn't start with a clearsigned message
W: GPG error: http://security.ubuntu.com oneiric-security InRelease: File /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_oneiric-security_InRelease doesn't start with a clearsigned message
xv-utils, lzma, etc are all installed. I've reinstalled the VM from scratch three times and up at the same point.
Solution 1:
This was a doozy.
The problem was that I had recently switched Virtualbox to NAT the Ubuntu VMs rather than bridge them. I ran several tests and found that if NAT was enabled, encoding problems developed on the incoming files. Once I returned the main interface to bridge mode the error changed to the standard BADSIG one which was fixed by grabbing the key again from keyserv and running the apt-get clean stuff.
Solution 2:
This solution worked perfectly in my case:
Change the config file that apt uses to look for the update url
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
-- to keep a backup of the conf
sudo gedit /etc/apt/sources.list
in the editor just find and replace all the http:// to ftp://
or
delete everything and replace it with mirror.
deb ftp-mirror name YOUR_UBUNTU_VERSION_HERE main
deb-src ftp-mirror name YOUR_UBUNTU_VERSION_HERE main
(can get other mirrors from here)
I did this because for some reason running in virtual machine http:// was not working with apt. Try this out hope this will work