1

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
http_proxy=http://1.2.3.4:5678/
ftp_proxy=http://1.2.3.4:5678/
socks_proxy=socks://1.2.3.4:5678/
https_proxy=http://1.2.3.4:5678/

set | grep -i proxy
ftp_proxy=http://1.2.3.4:5678/
http_proxy=http://1.2.3.4:5678/
https_proxy=http://1.2.3.4:5678/
socks_proxy=socks://1.2.3.4:5678/
      -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:
  default-jdk
Se instalarán los siguientes paquetes NUEVOS:
  android-studio
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/2.3.2.0/android-studio-ide-162.3934792-linux.zip
Resolviendo dl.google.com (dl.google.com)... 216.58.202.206, 2800:3f0:4001:815::200e
Conectando con dl.google.com (dl.google.com)[216.58.202.206]: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?

Thanks

15
  • 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
    Commented May 18, 2017 at 13:59
  • Your proxy seems to be IPv4 and the address is resolving to IPv6
    – muru
    Commented May 18, 2017 at 14:47
  • @Ravexina here's the output with suggested command pastebin.com/pe1z6ze5
    – Enrique
    Commented May 18, 2017 at 15:26
  • Your question has been marked as a duplicate question, see the duplicate question it might help you.
    – Ravexina
    Commented May 18, 2017 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
    Commented May 18, 2017 at 15:35

2 Answers 2

0

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=http://1.2.3.4:5678/
export ftp_proxy=http://1.2.3.4:5678/
export socks_proxy=socks://1.2.3.4:5678/
export https_proxy=http://1.2.3.4:5678/

.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.

5
  • 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
    Commented May 18, 2017 at 16:03
  • can you download the file in terminal with wget https://dl.google.com/dl/android/studio/ide-zips/2.3.2.0/android-studio-ide-162.3934792-linux.zip? If yes, you have a problem with AptGet, if no, there is still a connection problem in terminal.
    – mondjunge
    Commented May 18, 2017 at 16:11
  • Yes, as described in the question, i can download the file with wget in terminal...
    – Enrique
    Commented May 18, 2017 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
    Commented May 18, 2017 at 19:54
  • yes, will try that... and in case i get no luck, will install manually...
    – Enrique
    Commented May 19, 2017 at 14:59
0

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 ...)

#!/bin/bash

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



echo "******************************************************************************"
echo "*                                                                            *"
echo "*                                                                            *"
echo "*                          Salvar credenciais no PC                          *"
echo "*                                                                            *"
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 **********************************"
local="http://"$matricula":"$senha"@ironport.br:80/"
local1="https://"$matricula":"$senha"@ironport.br:80/"
local2="ftp://"$matricula":"$senha"@ironport.br:80/"
local3="socks://"$matricula":"$senha"@ironport.br:80/"
#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
clear 
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
fi

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
  • 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
    Commented May 22, 2017 at 16:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .