apt-get non è in grado di connettersi "risoluzione degli errori 'archive.ubuntu.com'"


10

Ho appena ottenuto un nuovo VPS con Ubuntu 11.04 e ho provato ad aggiornarlo. Ho ricevuto questo errore. Ottengo lo stesso errore ogni volta che utilizzo apt-get

login as: root
root@199.193.248.80's password:
Welcome to Ubuntu 11.04 (GNU/Linux 2.6.38-8-generic-pae i686)

 * Documentation:  https://help.ubuntu.com/
Last login: Mon May  7 19:55:45 2012 from 108.192.44.54
root@Rx:~# apt-get update
Err http://security.ubuntu.com natty-security InRelease

Err http://archive.ubuntu.com natty InRelease

Err http://security.ubuntu.com natty-security Release.gpg
  Temporary failure resolving 'security.ubuntu.com'
Err http://archive.ubuntu.com natty-updates InRelease

Err http://archive.ubuntu.com natty Release.gpg
  Temporary failure resolving 'archive.ubuntu.com'
Err http://archive.ubuntu.com natty-updates Release.gpg
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/natty/InRelease

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

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

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/Release.gpg  Temporary failure resolving 'security.ubuntu.com'

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/natty/Release.gpg  Temporary failure resolving 'archive.ubuntu.com'

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/natty-updates/Release.gpg  Temporary failure resolving 'archive.ubuntu.com'

W: Some index files failed to download. They have been ignored, or old ones used instead.
root@Rx:~#

Se necessario, ecco la mia /etc/apt/sources.list

root@Rx:/etc# more /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu natty main
deb http://archive.ubuntu.com/ubuntu natty-updates main
deb http://security.ubuntu.com/ubuntu natty-security main
deb http://archive.ubuntu.com/ubuntu natty universe
deb http://archive.ubuntu.com/ubuntu natty-updates universe

E se necessario, ho fatto un test ping:

root@Rx:~# ping -n 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=56 time=13.3 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=56 time=13.2 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=56 time=13.4 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=56 time=13.3 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 13.243/13.326/13.428/0.066 ms
root@Rx:~#

Questo è /etc/resolv.conf

root@Rx:~# more /etc/resolv.conf
nameserver 199.193.248.1

Questo è un problema DNS. Cosa c'è nel tuo /etc/resolv.conf?
— NathanG,

@NathanG ha aggiornato la mia domanda
— dukevin

Prova ad aggiungere una riga in resolv.conf con nameserver 8.8.8.8.
— NathanG,

Ho ricevuto questi messaggi durante l'esecuzione apt-get upgrade cryptsetup: WARNING: failed to detect canonical device of /dev/xvda1 cryptsetup: WARNING: could not determine root device from /etc/fstabma per il resto sembra funzionare bene
— dukevin

Risposte:


19

Il problema è che il server DNS che avevi originariamente non risponde alle tue domande. Puoi aggiungerne un altro all'elenco per verificare. 8.8.8.8 (fornito da Google) è il più facile da ricordare.

Aggiungi la linea nameserver 8.8.8.8al tuo /etc/resolv.conf per interrogare quel server.

Se il server originale è quello che ti ha fornito il provider VPS, potresti volerlo presentare al loro team di supporto: è possibile che esista una sorta di strumento di gestione che dipende da esso. Oltre a ciò, puoi utilizzare 8.8.8.8 come DNS primario per sempre.


Non ne so molto ma l'indirizzo IP del mio VPS è diverso da quello in resolv.conf, anche questo è un problema?
— dukevin,

2
Gli indirizzi nel tuo /etc/resolv.confsono i risolutori DNS. Hanno poca o nessuna relazione con l'indirizzo IP del tuo server.
— EEAA

> Aggiungi il nameserver di linea 8.8.8.8 al tuo /etc/resolv.conf per interrogare quel server. sudoedit /etc/resolv.conf Grazie !!! Questo ha funzionato perfettamente.

-2

Sembra che la risoluzione DNS non funzioni. Puoi farlo:

ping 199.193.248.1
nslookup any_site_name 199.193.248.1

PS In Ubuntu 18.04 /etc/resolv.conf il file è gestito da systemd-risolto e non deve essere modificato. È necessario aggiungere il nameserver corretto, ad esempio (8.8.8.8) a /etc/netplan/*.yaml qui:

nameservers:
    addresses: [..., 8.8.8.8]

Manualmente, o da questo oneliner, se la stringa "indirizzi:" è solo una nel file

    sed -r 's/(addresses: \[.*)\]/\1, 8.8.8.8\]/g' /etc/netplan/01-netcfg.yaml | 
    sudo tee /etc/netplan/01-netcfg.yaml && 
    sudo netplan apply

(Questo è Ubuntu Server e un file 01-netcfg.yaml)

Naturalmente, se lavori nell'organizzazione, non devi usare 8.8.8.8, usare i tuoi server DNS.


2
fai attenzione a tali azioni di sostituzione, potrebbe sostituire più file IP nel file di quanto desideri, rendendo il tuo sistema inutile. Se hai spiegato perché è meglio configurare il server DNS nel file di configurazione netplan nelle versioni più recenti di Ubuntu, questa potrebbe essere una buona risposta.
— Gerald Schneider,
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.