[问题] sudo 与 apt-get问题

楼主: FrankWOO (喵!就是这样!)   2014-08-13 15:13:08
我的系统是ubuntu server 12.04
因为公司网络关系有使用proxy (设在/etc/environment)
现在问题是,如果我不是root,我打sudo apt-get update
会发生下列事情:
Err http://security.ubuntu.com precise-security InRelease
Err http://free.nchc.org.tw precise InRelease
Err http://free.nchc.org.tw precise-updates InRelease
Err http://security.ubuntu.com precise-security Release.gpg
Temporary failure resolving 'security.ubuntu.com'
Err http://free.nchc.org.tw precise-backports InRelease
Err http://free.nchc.org.tw precise Release.gpg
Temporary failure resolving 'free.nchc.org.tw'
Err http://free.nchc.org.tw precise-updates Release.gpg
Temporary failure resolving 'free.nchc.org.tw'
Err http://free.nchc.org.tw precise-backports Release.gpg
Temporary failure resolving 'free.nchc.org.tw'
Reading package lists... Done
W: Failed to fetch http://free.nchc.org.tw/ubuntu/dists/precise/InRelease
W: Failed to fetch http://free.nchc.org.tw/ubuntu/dists/precise-updates/InRelease
W: Failed to fetch http://free.nchc.org.tw/ubuntu/dists/precise-backports/InRelease
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://free.nchc.org.tw/ubuntu/dists/precise/Release.gpg Temporary failure resolving 'free.nchc.org.tw'
W: Failed to fetch http://free.nchc.org.tw/ubuntu/dists/precise-updates/Release.gpg Temporary failure resolving 'free.nchc.org.tw'
W: Failed to fetch http://free.nchc.org.tw/ubuntu/dists/precise-backports/Release.gpg Temporary failure resolving 'free.nchc.org.tw'
W: Some index files failed to download. They have been ignored, or old ones used instead.
但是如果我用root,我直接打apt-get update
就会正常的get,get,get,get......
但是如果我用root,指令是打sudo apt-get update
又会出现上述的error
请问这是什么情况??
看起来像dns解析的问题,要怎么改??
楼主: FrankWOO (喵!就是这样!)   2014-08-13 15:19:00
自问自答,用root帐号执行apt-get install sudo
作者: goldie (阿良)   2014-08-13 23:52:00
应该是你的 proxy 环境变量没被 sudo 继承下去请打 sudo visudo 后,键入一行:Defaultsenv_keep+="http_proxy https_proxy ftp_proxy"Defaults env_keep+="http_proxy https_proxy ftp_proxy"Sorry, 第一个少一个空白,请忽略。引号内请换成你真正新增的proxy变量,空白格开。

Links booklink

Contact Us: admin [ a t ] ucptt.com