apt-get update 异常 Temporary failure resolving

1.问题描述

需要重装一下vim,执行操作提示:

root@ubuntu-novotech-dev:~# apt-get install vim
错误:
Err:1 http://ports.ubuntu.com/ubuntu-ports xenial/main armhf vim-runtime all 2:7.4.1689-3ubuntu1
  Temporary failure resolving 'ports.ubuntu.com'
Err:2 http://ports.ubuntu.com/ubuntu-ports xenial/main armhf vim armhf 2:7.4.1689-3ubuntu1
  Temporary failure resolving 'ports.ubuntu.com'
E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/v/vim/vim-runtime_7.4.1689-3ubuntu1_all.deb  Temporary failure resolving 'ports.ubuntu.com'


E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/v/vim/vim_7.4.1689-3ubuntu1_armhf.deb  Temporary failure resolving 'ports.ubuntu.com'


E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

再执行apt-get update 还是提示错误

2. 解决办法

百度了下:

使用cat命令追加nameserver设置

cat  >> /etc/resolv.conf << EOF

>nameserver 8.8.8.8
>nameserver 8.8.4.4

>EOF

或 

echo nameserver 8.8.8.8 > /etc/resolv.conf还不知道如何换行。。。)

设置完毕查看:

cat /etc/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 8.8.8.8
nameserver 8.8.4.4

但是这种方法在我的开发板上不生效。。。。


设置网关

查了下PC机的ip,在板子上设置路由默认网关为PC同一个

 route add default gw 192.168.2.1 

apt-get update 异常 Temporary failure resolving_第1张图片

接下来就可以安装软件了 。

3. 可能用到的命令如下

Linux Force DHCP client (dhclient) to renew ip address

Linux renew ip command
$ sudo dhclient -r //release ip 释放IP
$ sudo dhclient //获取IP


参考文章:http://www.cyberciti.biz/faq/how ... -client-ip-address/

Now obtain fresh IP:
$ sudo dhclient
There is no need to restart network service. Above command should work with any Linux distro such as RHEL, Fedora, CentOS, Ubuntu and others. On a related note you can also try out the following commands:
# ifdown eth0
# ifup eth0
# /etc/init.d/network restart

OR
# /etc/init.d/networking restart

你可能感兴趣的:(ARM-linux)