Uma variável env está causando o apt 'Não foi possível resolver'

2

Sempre que tento atualizar / atualizar / instalar pacotes, ele me diz o seguinte.

Err http://security.ubuntu.com trusty-security InRelease

Err http://archive.canonical.com trusty InRelease

Err http://archive.canonical.com trusty Release.gpg
  Could not resolve 'archive.canonical.com'
Err http://security.ubuntu.com trusty-security Release.gpg
  Could not resolve 'security.ubuntu.com'
Err http://nl.archive.ubuntu.com trusty InRelease

Err http://nl.archive.ubuntu.com trusty-updates InRelease

Err http://nl.archive.ubuntu.com trusty-backports InRelease

Err http://nl.archive.ubuntu.com trusty Release.gpg
  Could not resolve 'nl.archive.ubuntu.com'
Err http://nl.archive.ubuntu.com trusty-updates Release.gpg
  Could not resolve 'nl.archive.ubuntu.com'
Err http://nl.archive.ubuntu.com trusty-backports Release.gpg
  Could not resolve 'nl.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://nl.archive.ubuntu.com/ubuntu/dists/trusty/InRelease

W: Failed to fetch http://nl.archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease

W: Failed to fetch http://nl.archive.ubuntu.com/ubuntu/dists/trusty-backports/InRelease

W: Failed to fetch http://archive.canonical.com/ubuntu/dists/trusty/InRelease

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/InRelease

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg  Could not resolve 'security.ubuntu.com'

W: Failed to fetch http://archive.canonical.com/ubuntu/dists/trusty/Release.gpg  Could not resolve 'archive.canonical.com'

W: Failed to fetch http://nl.archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg  Could not resolve 'nl.archive.ubuntu.com'

W: Failed to fetch http://nl.archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg  Could not resolve 'nl.archive.ubuntu.com'

W: Failed to fetch http://nl.archive.ubuntu.com/ubuntu/dists/trusty-backports/Release.gpg  Could not resolve 'nl.archive.ubuntu.com'

W: Some index files failed to download. They have been ignored, or old ones used instead.

Sempre que eu verifico se posso resolver esses hosts, a máquina funciona bem. por exemplo:

root@ubuntu-server:/etc# host  nl.archive.ubuntu.com
nl.archive.ubuntu.com is an alias for ubuntuarchive.bit.nl.
ubuntuarchive.bit.nl is an alias for ftp.bit.nl.
ftp.bit.nl has address 213.136.12.213
ftp.bit.nl has IPv6 address 2001:7b8:3:37::21:3

A máquina tem uma conexão de internet funcionando e não há nada errado com meu resolv.conf

root@ubuntu-server:/etc# cat resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.1

Alguma idéia do que está errado e o que posso fazer para corrigir isso?

EDIT: variáveis de ambiente do terminal:

root@ubuntu-server:/etc# printenv
XDG_SESSION_ID=6
TERM=xterm
SHELL=/bin/bash
SSH_CLIENT=xxx.xxx.xxx.xxx 2764 22
SSH_TTY=/dev/pts/0
USER=root
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00        ;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga        =00;36:*.spx=00;36:*.xspf=00;36:
MAIL=/var/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/us        r/local/games
PWD=/etc
LANG=en_US.UTF-8
SHLVL=1
HOME=/root
LOGNAME=root
SSH_CONNECTION=xxx.xxx.xxx.xxx 2764 192.168.1.15 22
LESSOPEN=| /usr/bin/lesspipe %s
XDG_RUNTIME_DIR=/run/user/0
LESSCLOSE=/usr/bin/lesspipe %s %s
_=/usr/bin/printenv
OLDPWD=/etc/network
    
por Wouter Mellema 27.10.2015 / 11:57

1 resposta

0

É altamente improvável que as variáveis de ambiente listadas possam afetar apt-get . No entanto, a saída de host não é um indicador confiável de que a resolução de nomes de host está funcionando.

Considere:

$ grep hosts /etc/nsswitch.conf
hosts:          files
$ host google.com
google.com has address 172.217.26.14
google.com has IPv6 address 2404:6800:4004:809::200e
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 50 alt4.aspmx.l.google.com.
google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
google.com mail is handled by 20 alt1.aspmx.l.google.com.
$ sudo apt update
Err:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
  Could not resolve 'security.ubuntu.com'
Err:2 http://jp.archive.ubuntu.com/ubuntu xenial InRelease
  Could not resolve 'jp.archive.ubuntu.com'
Err:3 http://jp.archive.ubuntu.com/ubuntu xenial-updates InRelease
  Could not resolve 'jp.archive.ubuntu.com'
Err:4 http://jp.archive.ubuntu.com/ubuntu xenial-backports InRelease
  Could not resolve 'jp.archive.ubuntu.com'
Err:5 http://archive.canonical.com/ubuntu xenial InRelease
  Could not resolve 'archive.canonical.com'
Reading package lists... Done
Building dependency tree
Reading state information... Done
12 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Failed to fetch http://jp.archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Could not resolve 'jp.archive.ubuntu.com'
W: Failed to fetch http://jp.archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Could not resolve 'jp.archive.ubuntu.com'
W: Failed to fetch http://jp.archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Could not resolve 'jp.archive.ubuntu.com'
W: Failed to fetch http://archive.canonical.com/ubuntu/dists/xenial/InRelease  Could not resolve 'archive.canonical.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Could not resolve 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

apt-get , e a maioria dos aplicativos, usam gethostbyname(3) da glibc para a resolução do nome do host, que é adiada para /etc/nsswitch.conf para decidir quais métodos usar para isso. Se nsswitch.conf estiver configurado incorretamente, host (e nslookup , dig , etc.) funcionará corretamente, mas a maioria dos aplicativos falhará na resolução do nome do host.

Essa é uma causa possível.

    
por muru 09.03.2017 / 08:53