2019年11月18日 星期一

apt-get update異常處理

1. 問題描述

系統環境:Ubuntu 18.04.3 LTS

執行apt-get update更新時遇到如下狀況

錯誤訊息:
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Could not resolve 'security.ubuntu.com'
Err:2 http://tw.archive.ubuntu.com/ubuntu bionic InRelease               
  Could not resolve 'tw.archive.ubuntu.com'
Err:3 http://packages.ros.org/ros/ubuntu bionic InRelease                
  Could not resolve 'packages.ros.org'
Err:4 http://tw.archive.ubuntu.com/ubuntu bionic-updates InRelease
  Could not resolve 'tw.archive.ubuntu.com'
Err:5 http://tw.archive.ubuntu.com/ubuntu bionic-backports InRelease
  Could not resolve 'tw.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://tw.archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Could not resolve 'tw.archive.ubuntu.com'
W: Failed to fetch http://tw.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Could not resolve 'tw.archive.ubuntu.com'
W: Failed to fetch http://tw.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Could not resolve 'tw.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Could not resolve 'security.ubuntu.com'
W: Failed to fetch http://packages.ros.org/ros/ubuntu/dists/bionic/InRelease  Could not resolve 'packages.ros.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.


2. 解決方法

Linux Force DHCP client (dhclient) to renew ip address

Linux renew ip command
$ sudo dhclient -r //release ip 釋出IP
$ sudo dhclient //獲取IP


Now obtain fresh IP:
$ sudo dhclient

$ sudo ifdown eth0
$ sudo ifup eth0
$ sudo /etc/init.d/network restart
OR
$ sudo /etc/init.d/networking restart

參考資料


沒有留言:

張貼留言

apt-get update異常處理

1. 問題描述 系統環境:Ubuntu 18.04.3 LTS 執行apt-get update更新時遇到如下狀況 錯誤訊息: Err:1 http://security.ubuntu.com/ubuntu bionic-security InRe...