Fix lỗi "Temporary failure resolving..." trên Ubuntu Server 5
Linux

Fix lỗi “Temporary failure resolving…” trên Ubuntu Server

Hôm qua mình có cài đặt EasyEngine trên VPS Ubuntu 16.04.

Sau khi cài đặt OS cho VPS xong là mình cập nhật các gói phần mềm liền ngay lập tức, với Ubuntu thì dùng lệnh apt-get update, sau khi chạy lệnh thì gặp thông báo lỗi “Temporary failure resolving…”

xxx@xxx:~# apt-get update
Err:1 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu xenial InRelease
  Temporary failure resolving 'sfo1.mirrors.digitalocean.com'
Err:2 http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/xUbuntu_16.04  InRelease
  Temporary failure resolving 'download.opensuse.org'
Err:3 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease
  Temporary failure resolving 'ppa.launchpad.net'
Err:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:5 http://vn.archive.ubuntu.com/ubuntu xenial InRelease
  Temporary failure resolving 'vn.archive.ubuntu.com'
Err:6 http://vn.archive.ubuntu.com/ubuntu xenial-updates InRelease
  Temporary failure resolving 'vn.archive.ubuntu.com'
Err:7 http://vn.archive.ubuntu.com/ubuntu xenial-backports InRelease
  Temporary failure resolving 'vn.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://vn.archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'vn.archive.ubuntu.com'
W: Failed to fetch http://vn.archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Temporary failure resolving 'vn.archive.ubuntu.com'
W: Failed to fetch http://vn.archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Temporary failure resolving 'vn.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'sfo1.mirrors.digitalocean.com'
W: Failed to fetch http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/xUbuntu_16.04/InRelease  Temporary failure resolving 'download.opensuse.org'
W: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'ppa.launchpad.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Fix lỗi "Temporary failure resolving..." trên Ubuntu Server 6

Theo kinh nghiệm thì mình đoán là VPS không thể kết nối đến các máy chủ cập nhật vn.archive.ubuntu.com…

Lỗi này hiểu đơn giản là server/vps không thể phân giải được địa chỉ do DNS bị sự cố nào đó. Có thể do chưa khai báo, khai báo sai, dns chết hoặc dns ở nước ngoài nhưng chết quốc tế (Nguồn Anh Thịnh Văn Hạnh)

Thường thì lỗi nãy chỉ cần cho máy chủ sử dụng các Name Server trung gian là sẽ fix được. Ok, tiến hành nào

Tiến hành mở file /etc/resolv.conf để thêm name server thì gặp thông báo như sau

# 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

Đại loại là nếu chỉnh sửa file này thì có khả năng bị ghi đè, chúng ta chỉnh sửa cũng được, nhưng có khả năng nếu reboot VPS thì sẽ bị xoá hết.

Mày mò 1 lúc trên Google thì được hướng dẫn thêm name server vào file /etc/resolvconf/resolv.conf.d/tail nếu chưa có file tail thì tạo mới nhé các bạn, sau đó thêm vào nội dung sau

nameserver 8.8.8.8
nameserver 8.8.4.4

Khởi động lại VPS bằng lệnh reboot

Chạy lệnh apt-get update, nếu không còn thông báo lỗi thì đã fix thành công 😀

Fix lỗi "Temporary failure resolving..." trên Ubuntu Server 7

Avatar of jamesblackvn

Tui là jamesblackvn!

One Comment

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

Website này sử dụng Akismet để hạn chế spam. Tìm hiểu bình luận của bạn được duyệt như thế nào.