This has been a long term problem with apt, and Ubuntu has never fixed it. Apt doesn't seem to use the same DNS servers that the internal system does - 'ping ' returns a correct IP address. Apt-get claims that the hostname isn't found.
"Something wicked happened resolving 'extras.ubuntu.com:http" (Which sounds, somewhat, like it's trying to resolve a .com:http domain, which isn't a valid TLD)
To modify /etc/hosts, use the following:
Ping each of the names that are failing to resolve -
PING extras.ubuntu.com (91.189.88.33) 56(84) bytes of data.
Use your favourite editor, such as vi - 'sudo vi /etc/hosts'.
Scroll down to the end, and add a line such as the following
91.189.88.33 extras.ubuntu.com (with the appropriate name and IP address. IP is first)
Save the file, then re-run apt-get. Once you've run apt-get, edit /etc/hosts again, and comment out the line with a hash mark - #. (or delete it entirely)
#91.189.88.33 extras.ubuntu.com
The reason to comment out/delete the line is that Ubuntu apparently shuffles their servers around randomly, and that might not be the correct IP the next time.
/etc/netowrk/interfaces
file (based on this). So others encountering similar issue may want to check their network configuration. – Wilf Jun 30 '15 at 20:40