`apt-get update` ไม่พบเซิร์ฟเวอร์ Ubuntu


50

การทำงานsudo apt-get updateล้มเหลวบนเซิร์ฟเวอร์ของฉัน (ที่มีการเชื่อมต่ออินเทอร์เน็ต) เซิร์ฟเวอร์เสียชั่วคราวหรือ APT ของฉันกำหนดค่าผิดพลาดและใช้เซิร์ฟเวอร์เก่าหรือไม่ กล่าวโดยย่อฉันจะแก้ไขได้อย่างไร

นี่คือผลลัพธ์:

~$ uname -a
Linux nematode 2.6.28-19-server #66-Ubuntu SMP Sat Oct 16 18:41:24 UTC 2010 i686 GNU/Linux

~$ sudo apt-get update
Err http://us.archive.ubuntu.com jaunty Release.gpg
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty/main Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty/restricted Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty/universe Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty/multiverse Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty-updates Release.gpg
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty-updates/main Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty-updates/restricted Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty-updates/universe Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty-updates/multiverse Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://security.ubuntu.com jaunty-security Release.gpg
  Could not resolve 'security.ubuntu.com'
Err http://security.ubuntu.com jaunty-security/main Translation-en_US
  Could not resolve 'security.ubuntu.com'
Err http://security.ubuntu.com jaunty-security/restricted Translation-en_US
  Could not resolve 'security.ubuntu.com'
Err http://security.ubuntu.com jaunty-security/universe Translation-en_US
  Could not resolve 'security.ubuntu.com'
Err http://security.ubuntu.com jaunty-security/multiverse Translation-en_US
  Could not resolve 'security.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/Release.gpg  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/main/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/restricted/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/universe/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/multiverse/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/Release.gpg  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/main/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/restricted/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/universe/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/multiverse/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jaunty-security/Release.gpg  Could not resolve 'security.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jaunty-security/main/i18n/Translation-en_US.bz2  Could not resolve 'security.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jaunty-security/restricted/i18n/Translation-en_US.bz2  Could not resolve 'security.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jaunty-security/universe/i18n/Translation-en_US.bz2  Could not resolve 'security.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jaunty-security/multiverse/i18n/Translation-en_US.bz2  Could not resolve 'security.ubuntu.com'
W: Some index files failed to download, they have been ignored, or old ones used instead.
W: You may want to run apt-get update to correct these problems

1
อะไรคือผลลัพธ์ของcat /etc/resolv.conf?
ændrük

1
ตรวจสอบคำตอบของฉันที่นั่นเพื่อฉัน: askubuntu.com/questions/135932/…
m.alaa8

คำตอบ:


22

คุณสามารถแก้ไขโฮสต์ใด ๆ จากบรรทัดคำสั่งได้หรือไม่

jinx:775 Z$ ping us.archive.ubuntu.com
PING us.archive.ubuntu.com (91.189.92.171) 56(84) bytes of data.
64 bytes from cassava.canonical.com (91.189.92.171): icmp_seq=1 ttl=128 time=104 ms

ถ้าไม่ทำขั้นตอนต่อไปคือลองhost -v:

jinx:776 Z$ host -v us.archive.ubuntu.com
Trying "us.archive.ubuntu.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14243
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;us.archive.ubuntu.com.         IN      A

;; ANSWER SECTION:
us.archive.ubuntu.com.  592     IN      A       91.189.88.31
us.archive.ubuntu.com.  592     IN      A       91.189.88.40
us.archive.ubuntu.com.  592     IN      A       91.189.88.45
us.archive.ubuntu.com.  592     IN      A       91.189.88.46
us.archive.ubuntu.com.  592     IN      A       91.189.92.169
us.archive.ubuntu.com.  592     IN      A       91.189.92.170
us.archive.ubuntu.com.  592     IN      A       91.189.92.171
us.archive.ubuntu.com.  592     IN      A       91.189.88.30

Received 167 bytes from 10.211.55.1#53 in 37 ms
Trying "us.archive.ubuntu.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50130
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;us.archive.ubuntu.com.         IN      AAAA

;; AUTHORITY SECTION:
ubuntu.com.             1800    IN      SOA     ns1.canonical.com. hostmaster.canonical.com. 2011030301 10800 3600 604800 3600

Received 100 bytes from 10.211.55.1#53 in 65 ms
Trying "us.archive.ubuntu.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54875
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;us.archive.ubuntu.com.         IN      MX

;; AUTHORITY SECTION:
ubuntu.com.             1800    IN      SOA     ns1.canonical.com. hostmaster.canonical.com. 2011030301 10800 3600 604800 3600

Received 100 bytes from 10.211.55.1#53 in 62 ms

ค้นหาข้อผิดพลาดที่ส่งคืนโดยเซิร์ฟเวอร์ DNS


1
ฉันควรได้กล่าวpingว่าไม่ได้แก้ไขอย่างใดอย่างหนึ่ง แต่ที่ฉันสามารถ ping ผ่าน IP (แก้ไขในเครื่องแยก) ขอบคุณความช่วยเหลือนี้และความคิดเห็นโดย @ ændrükฉันค้นพบว่ารายการ DNS ของฉันไม่มีประโยชน์อะไรเลย การแก้ไขเหล่านั้นแก้ไขปัญหา
Phrogz

ปัญหาที่น่าสนใจ: "ไม่พบโฮสต์: คำสั่ง" แต่ฉันไม่สามารถติดตั้งได้โดยใช้ apt โดยไม่ยอมรับแพ็คเกจที่ไม่ผ่านการตรวจสอบ
jhaagsma

ไม่มีคำสั่งจริงให้ที่นี่เพื่อแก้ไข เพียงเพื่อระบุเมื่อมันทำงานมันทำงานได้อย่างถูกต้อง ถ้าฉันไม่สามารถ ping และไม่สามารถทำhost -vฉันอีกต่อไป อะไรต่อไป? ไม่ช่วยอะไรเลย
davejal

47

ดูเหมือนว่าปัญหา DNS ในการแก้ไขคุณต้องมั่นใจว่า

/etc/resolv.conf

มีรายการที่ดีสำหรับเซิร์ฟเวอร์ DNS

Google มีเซิร์ฟเวอร์ DNS สาธารณะที่คุณสามารถใช้ได้

ตัวอย่างเช่นคุณสามารถเพิ่ม 2 บรรทัดต่อไปนี้ที่ด้านบนของ/etc/resolv.confไฟล์ของคุณ(จุดเหล่านี้ที่เซิร์ฟเวอร์ Google DNS) ตามรายละเอียดด้านบน:

nameserver 8.8.8.8 
nameserver 8.8.4.4

แน่นอนคุณต้องรูทเพื่อเปลี่ยนแปลงไฟล์นี้และทำการสำรองข้อมูลก่อนทำการเปลี่ยนแปลงใด ๆ !


2
ไม่ใช่แผนที่ดีถ้าคุณต้องการแก้ไขที่อยู่ภายในเครือข่ายของคุณเอง ใช้ได้ถ้าเครื่องทุกเครื่องจำเป็นต้องเข้าถึงด้วยชื่อจะอยู่นอกไฟร์วอลล์ของคุณ
Ceisc

@Ceisc - จุดที่ดี ขอบคุณที่พูดถึงมัน!
สวนสาธารณะแบรด

1
ในไฟล์ดังกล่าวมีข้อความว่า "อย่าแก้ไขไฟล์นี้ด้วยมือ - การเปลี่ยนแปลงของคุณจะถูกทับซ้อน" - คุณสามารถแก้ไขได้ไหม?
jcollum

ฉันไม่สามารถพูดได้อย่างแน่นอน - แต่ก็ยังเป็นสิ่งที่ Google แนะนำว่าเป็นกระบวนการสำหรับการทำสิ่งนี้บนหน้า DNS สาธารณะของ Google
สวนสาธารณะแบรด

1
นี่คือคำตอบที่ดีที่สุด
bademba

15

ฉันรู้ว่าเธรดนี้เก่ามาก แต่สำหรับใครที่ยังคงดูอยู่ฉันจะแก้ไขปัญหานี้ได้โดยการตัดการเชื่อมต่อและเชื่อมต่อกับจุดเชื่อมต่อไร้สายอีกครั้ง


1
นี่คือคำตอบที่ถูกต้องสำหรับคนจำนวนมากที่เห็นข้อผิดพลาดนี้ ... คุณไม่ได้ออนไลน์ ... เชื่อมต่อ WiFi ของคุณและเพียงแค่ออกคำสั่งอัปเดตของคุณอีกครั้ง ... sudo apt-get update && sudo apt-get dist-upgrade
Scott Stensland

ขอบคุณ! สิ่งนี้ได้ผลสำหรับฉัน! คำตอบง่ายๆที่น่ากลัวที่อาจจะเป็นทางออกสำหรับคนส่วนใหญ่ :)
โรเบิร์ตโรท

9

บ่อยครั้งที่ฉันกด 8.8.8.8 ใน /etc/resolv.conf ของฉันเพื่อแก้ไขปัญหานี้ Esp เมื่อจัดการกับสิ่งที่ราคาถูกผู้ให้บริการคลาวด์ราคาถูก (ในกรณีนี้ linode)

cat /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4
#nameserver 72.14.179.5
#nameserver 72.14.188.5

นี่คือเซิร์ฟเวอร์ DNS สาธารณะของ Google ใช่พวกเขาอาจติดตาม heck จากบันทึกเหล่านั้น แต่เว็บไซต์เดียวที่ฉันมักจะโจมตีบนเซิร์ฟเวอร์เหล่านั้นคือคลังข้อมูล git และ ubuntu


3

ฉันมีปัญหาเดียวกันนี้Err on apt-get updateændrükบอกใบ้อย่างถูกต้อง

ฉันแก้ไขปัญหาของฉันด้วยการเปลี่ยนที่อยู่ DNS ด้วยตนเองลงในไฟล์/etc/resolv.confเป็นที่อยู่ DNS ของผู้ให้บริการของฉัน

ก่อนหน้านี้มันถูกตั้งค่า192.168.0.254โดย Ubuntu


ใช่ดังที่ระบุไว้ในความคิดเห็นติดตามผลของฉันไปยังคำตอบที่ยอมรับแล้วปัญหาคือ DNS ของฉันถูก hosed และจำเป็นต้องตั้งค่าที่ดี
Phrogz

3

ฉันมีปัญหาที่คล้ายกันมากซึ่ง: sudo apt-get update ไม่เสร็จและมีข้อผิดพลาด ฉันพยายามรีสตาร์ทเคเบิลโมเด็มและใช้งานได้ คุณสามารถลองรีสตาร์ทเคเบิลโมเด็มได้เช่นกัน


2

ตรวจสอบเว็บเบราว์เซอร์ของคุณเพื่อดูว่าคุณสามารถเปิดหน้าเว็บ "http://us.archive.ubuntu.com" ถ้าใช่แสดงว่ามีปัญหาในการตั้งค่าพร็อกซีเครือข่าย

ทำตามขั้นตอนต่อไปนี้บน Ubuntu Desktop

  1. ไปที่ System-> Preferences-> Network Proxy
  2. เลือก“ กำหนดค่าพร็อกซีด้วยตนเอง”
  3. ตรวจสอบ“ ใช้พร็อกซีเดียวกันสำหรับโปรโตคอลทั้งหมด”
  4. HTTP Proxy:, พอร์ต:
  5. กดปุ่มรายละเอียดและตรวจสอบ“ การตรวจสอบผู้ใช้”
  6. ใส่ชื่อผู้ใช้และรหัสผ่านแล้วปิด

หลังจากทำสิ่งนี้ฉันก็สามารถแก้ไขข้อผิดพลาดเหล่านี้ได้


คุณกำลังบอกว่าคุณแก้ไขปัญหานี้โดยใช้พร็อกซี่?
zinking

2

ฉันเพิ่งมีปัญหาเดียวกันนี้ ทำงานบนเครื่องเสมือนและเบื่อที่จะเปลี่ยนที่อยู่ IP ตลอดเวลา หลังจากตั้งค่าที่อยู่ IP แบบคงที่ฉันไม่ได้ตั้งค่า DNS Nameservers และไม่สามารถอัปเดต apt-get ได้อีกต่อไป ฉันต้องการเพิ่มเนมเซิร์ฟเวอร์ให้กับไฟล์ / etc / network / interfaces พบข้อมูลเกี่ยวกับที่นี่ (ฉันจะตั้งค่าเซิร์ฟเวอร์ชื่อ DNS ได้อย่างไร)

ปัญหาต่อไปที่ฉันพบคือฉันไม่สามารถ ifdown และ ifup เพื่อรีเซ็ตอินเตอร์เฟสเครือข่าย รหัสนี้เหมาะกับฉัน:

sudo ifdown eth0 && sudo ifup --exclude=lo -a

ข้อมูลเพิ่มเติมเกี่ยวกับปัญหานี้สามารถพบได้ที่นี่ (วิธีรีเซ็ตอินเตอร์เฟซเครือข่าย)


2

คุณสามารถแก้ไข/etc/resolvconf/resolv.conf.d/base(ว่างโดยค่าเริ่มต้น) เพิ่ม

nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver YOUR DNS SERVER

1

ง่ายมาก:

  1. ค้นหาที่อยู่ DNS ด้วยตนเองในไฟล์ /etc/resolv.conf
  2. cd / etc / network /
  3. sudo nano interface
  4. เปลี่ยนเนมเซิร์ฟเวอร์
  5. nameservers 8.8.8.8 8.8.4.4 ไม่ทำงานกับเราเตอร์เดียวกัน (ในกรณีของฉัน hitron แย่มาก

การกำหนดเส้นทาง ip ของ บริษัท ไม่ทำงานเลย)

คุณต้องใช้ที่อยู่ IP จาก /etc/resolv.conf

หรือใช้เฉพาะเราเตอร์ ip ของคุณในกรณีของฉัน 192.168.1.1


1

ฉันได้แก้ไขปัญหานี้แล้ว เพียงไปที่: การตั้งค่าระบบ -> เครือข่ายพร็อกซี่ -> วิธีการอัตโนมัติ -> ใช้ SYstem Weide -> และใส่รหัสผ่านผู้ดูแลระบบของคุณ


1

ฉันรู้ว่านี่เป็นโพสต์เก่าจริงๆ แต่ฉันเพิ่งติดตั้ง Ubuntu 16.10 ใน Dell E4310 และฉันพบปัญหาเดียวกัน ฉันลองทำตามคำแนะนำในโพสต์นี้ แต่ก็ไม่ทำงานฉันจึงตัดสินใจลองเปลี่ยนเซิร์ฟเวอร์อัพเดท

ดังนั้นในการตั้งค่าระบบ> ซอฟต์แวร์ & อัปเดตฉันเปลี่ยนเซิร์ฟเวอร์จาก "หลัก" เป็นดังต่อไปนี้: http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive

ตอนนี้การอัปเดตของฉันกำลังกลิ้งไปโดยไม่มีปัญหา หวังว่านี่จะช่วยได้


1

เพื่อหลีกเลี่ยงปัญหา DNS ฉันต้องเพิ่ม/etc/hostsใน IP ของเซิร์ฟเวอร์เช่น

echo "91.189.91.24 security.ubuntu.com" >> /etc/hosts 
echo "91.189.91.24 archive.ubuntu.com" >> /etc/hosts
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.