I'm trying to install a package (android-studio) through ppa, and am having some troubles. I'm 95% sure it is related to the corporate proxy we're behind of.

These are my settings:

env | grep -i proxy

set | grep -i proxy
      -p --http-proxy --no-http-proxy\
      -p --http-proxy --no-http-proxy\
      -p --http-proxy --no-http-proxy\
      -p --http-proxy --no-http-proxy\
      -p --http-proxy --no-http-proxy\
      -p --http-proxy --no-http-proxy\
      -p --http-proxy --no-http-proxy\

Then, when I execute the command, the process gets stuck while trying to download the package from terminal.

sudo apt-get install android-studio
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias       
Leyendo la información de estado... Hecho
Paquetes sugeridos:
Se instalarán los siguientes paquetes NUEVOS:
0 actualizados, 1 se instalarán, 0 para eliminar y 2 no actualizados.
4 no instalados del todo o eliminados.
Se necesita descargar 0 B/36,2 kB de archivos.
Se utilizarán 98,3 kB de espacio de disco adicional después de esta operación.
(Leyendo la base de datos ... 885309 ficheros o directorios instalados actualmente.)
Preparando para desempaquetar .../android-studio_162.3934792~trusty_amd64.deb ...
--2017-05-18 10:37:30--  https://dl.google.com/dl/android/studio/ide-zips/
Resolviendo dl.google.com (dl.google.com)..., 2800:3f0:4001:815::200e
Conectando con dl.google.com (dl.google.com)[]:443... 

PS: I can download the file through browser, and using wget from terminal

Does any1 know how I could solve this, even if I have to use a temporal setting or command?


  • instead of sudo apt-get install android-studio run LC_ALL=c sudo apt-get install android-studio and add the output to your question, so it's more helpful to diagnose your problem. – Ravexina May 18 '17 at 13:59
  • Your proxy seems to be IPv4 and the address is resolving to IPv6 – muru May 18 '17 at 14:47
  • @Ravexina here's the output with suggested command pastebin.com/pe1z6ze5 – Enrique May 18 '17 at 15:26
  • Your question has been marked as a duplicate question, see the duplicate question it might help you. – Ravexina May 18 '17 at 15:27
  • @muru please check, tried the suggestion in the question you link, but I think that is not an IPv4 related problem, the output is the same... pastebin.com/ycrmdmxf – Enrique May 18 '17 at 15:35

From my experience, terminal does not respect gnome system settings.

When we had a coporate proxy, we needed to set those in .bashrc. So, set your proxy in ~/.bashrc by adding these lines to the end of the file and try again (it might be enough to set http and https proxy only, but you never know...) :

export http_proxy=
export ftp_proxy=
export socks_proxy=socks://
export https_proxy=

.bashrc is executed every time you start up a terminal. So do not forget to close and reopen your terminal after saving .bashrc.

Good luck and have fun.

  • thanks @mondjunge but no luck. Added those lines to the end of ~/.bashrc then exited the terminal, restarted, but again it hangs on pastebin.com/ycrmdmxf – Enrique May 18 '17 at 16:03
  • can you download the file in terminal with wget https://dl.google.com/dl/android/studio/ide-zips/ If yes, you have a problem with AptGet, if no, there is still a connection problem in terminal. – mondjunge May 18 '17 at 16:11
  • Yes, as described in the question, i can download the file with wget in terminal... – Enrique May 18 '17 at 16:17
  • that's odd. Might be a wild guess, but have you tried using apt instead of apt-get? I guess you already know that you can just download the zip and unpack it somewhere to home to use it. – mondjunge May 18 '17 at 19:54
  • yes, will try that... and in case i get no luck, will install manually... – Enrique May 19 '17 at 14:59

I've created a script to make it easier for the new user to record their proxy credentials without relying on a third party. Modify the proxy addresses for your (ironport ...)


if [ $(id -u) != "0" ]; then
    echo "You must be the superuser to run this script" >&2
    exit 1

echo "******************************************************************************"
echo "*                                                                            *"
echo "*                                                                            *"
echo "*                          Salvar credenciais no PC                          *"
echo "*                                                                            *"
echo "*                                                                            *"
echo "******************************************************************************" 
echo "Digite sua m#chmod 755 $HOME/script/enviromentatricula do XXX de até 4 digitos"
read matricula    
clear #!/bin/bash
echo "******************************************************************************"                                                       
echo "*                                                                            *"
echo "*                       Sua matricula é $matricula                           *"
echo "*                                                                            *"
echo "******************************************************************************"
echo "Digite sua senha do TRT" 
read -s senha
echo "************************* Criando arquivos **********************************"
#echo -e "HTTP_proxy $local \nFTP_proxy=$local \nHTTPS_proxy=$local \n" "http_proxy=$local \n""ftp_proxy $local \n""https_proxy $local"
echo -e "HTTP_proxy=$local \nFTP_proxy=$local \nHTTPS_proxy=$local \nhttp_proxy=$local \nftp_proxy=$local \nhttps_proxy=$local" > tmpfile
#mv tmpfile $HOME/script/enviroment
#chmod 755 $HOME/script/enviroment
#mv tmpfile /etc/enviroment
cat tmpfile > $HOME/script/environment
cat tmpfile > /etc/environment
chmod 755 /etc/enviroment
echo -e "Acquire::http::proxy \"$local\"; \nAcquire::https::proxy \"$local1\"; \nAcquire::ftp::proxy \"$local2\"; \nAcquire::socks::proxy \"$local3\"; "> apt
#mv apt $HOME/script/apt.conf
#mv apt /etc/apt/apt.conf
cat apt.txt > $HOME/script/apt.conf
cat apt.txt > /etc/apt/apt.conf
echo "******************************************************************************"
echo "*                                                                            *"
echo "*         Arquivos gravados com sucesso                                      *"
echo "*         /etc/environment                                                   *"
echo "*         /etc/apt/apt.conf                                                  *"
echo "*                                  Cópia de I                                          *"
echo "******************************************************************************" 
echo " testar configuração digite S" Cópia de I
read testar
if [ $testar = "S" ]; then
    apt-get update

save as arquivo.sh and chmod -x ./arquivo.sh and run ./arquivo.sh

To test without the super user comment (#) lines 4, 5, 6 and 7

  • 1
    sory error in this scrip change "mv" lines cat tmpfile > $HOME/script/environment cat tmpfile > /etc/environment chmod 755 /etc/environment cat apt.txt > $HOME/script/apt.conf cat apt.txt > /etc/apt/apt.conf – Max May 22 '17 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.