I'm using Ubuntu 15.10 guest on VMWare Player (7.1.3 build-3206955), with Windows 10 as the host OS. I'm able to use Firefox to browse the web inside the guest, however I'm unable to use apt on the terminal.
Whenever i invoke the command sudo apt-get update, it gets stuck at 0% [connecting to in.archive.ubuntu.com], finally failing. Also, using sudo apt-get install <package> always results in the package not even being found.
On the other hand, using the same commands with the -E flag on sudo makes them work.
Can somebody explain what's happening here?
EDIT: I forgot to add that i'm using multiple internet connections; one with proxy and one without. Regular sudo works on the one without proxy but not on the one with it.
21 Answer
The magic word here is proxy. In your environment you will have proxy information set that allows you to access the internet.
The environment variable http_proxy contains your proxy settings.
Execute echo $http_proxy to see them (maybe $HTTP_PROXY).
If you run sudo <command>, the command will be executed in its own environment as root. If you add the -E option to sudo, the command will be executed as root, but with most of your environment copied over.
You can check that by executing the following three commands:
envsudo envsudo -E env