尽管已连接到互联网但无法浏览

尽管已连接到互联网但无法浏览

zati@zati-K42JZ:~$ sudo apt-get update [sudo] password for zati: Err http://archive.ubuntu.com precise Release.gpg
Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://security.ubuntu.com precise-security Release.gpg
Something wicked happened resolving 'security.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.canonical.com precise Release.gpg
Something wicked happened resolving 'archive.canonical.com:http' (-5 - No address associated with hostname) Err http://extras.ubuntu.com precise Release.gpg
Something wicked happened resolving 'extras.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com precise-updates Release.gpg
Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Ign http://security.ubuntu.com precise-security Release
Ign http://archive.canonical.com precise Release
Ign http://extras.ubuntu.com precise Release
Err http://archive.ubuntu.com precise-backports Release.gpg
Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Ign http://archive.canonical.com precise/partner i386 Packages/DiffIndex
Ign http://extras.ubuntu.com precise/main i386 Packages/DiffIndex
Ign http://archive.ubuntu.com precise Release
Ign http://security.ubuntu.com precise-security/restricted i386 Packages/DiffIndex Ign http://archive.canonical.com precise/partner TranslationIndex
Ign http://extras.ubuntu.com precise/main TranslationIndex
Ign http://archive.ubuntu.com precise-updates Release
Ign http://security.ubuntu.com precise-security/universe i386 Packages/DiffIndex Ign http://security.ubuntu.com precise-security/multiverse i386 Packages/DiffIndex Ign http://archive.ubuntu.com precise-backports Release
Ign http://archive.ubuntu.com precise/main i386 Packages/DiffIndex
Ign http://security.ubuntu.com precise-security/main TranslationIndex
Ign http://archive.ubuntu.com precise/restricted i386 Packages/DiffIndex
Ign http://security.ubuntu.com precise-security/multiverse TranslationIndex
Ign http://security.ubuntu.com precise-security/restricted TranslationIndex
Ign http://security.ubuntu.com precise-security/universe TranslationIndex
Ign http://archive.ubuntu.com precise/main TranslationIndex
Ign http://archive.ubuntu.com precise/multiverse TranslationIndex
Ign http://archive.ubuntu.com precise/restricted TranslationIndex
Ign http://archive.ubuntu.com precise/universe TranslationIndex
Err http://archive.canonical.com precise/partner i386 Packages
Something wicked happened resolving 'archive.canonical.com:http' (-5 - No address associated with hostname) Err http://extras.ubuntu.com precise/main i386 Packages
Something wicked happened resolving 'extras.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.canonical.com precise/partner Translation-en_US
Something wicked happened resolving 'archive.canonical.com:http' (-5 - No address associated with hostname) Err http://extras.ubuntu.com precise/main Translation-en_US
Something wicked happened resolving 'extras.ubuntu.com:http' (-5 - No address associated with hostname) Ign http://archive.ubuntu.com precise-updates/main TranslationIndex
Err http://archive.canonical.com precise/partner Translation-en
Something wicked happened resolving 'archive.canonical.com:http' (-5 - No address associated with hostname) Err http://extras.ubuntu.com precise/main Translation-en
Something wicked happened resolving 'extras.ubuntu.com:http' (-5 - No address associated with hostname) Ign http://archive.ubuntu.com precise-updates/multiverse TranslationIndex
Ign http://archive.ubuntu.com precise-updates/restricted TranslationIndex Ign http://archive.ubuntu.com precise-updates/universe TranslationIndex
20% [Connecting to archive.ubuntu.com] [Connecting to security.ubuntu.com]
昨天我尝试在我的 12.04 ubuntu 中安装一个管理系统。我尝试使用 sudo gedit /etc/apt/sources.list 编辑 sources.list 中的存储库。我不确定我是否输入正确,我只输入了 debhttp://dms.oscc.org.my/repo二进制/如网站所述。当我想要 apt-get 更新时,它会执行一个 -5 错误。为什么会这样?它也会对存档和安全执行 -5 错误。

然后我尝试找出解决方案,但是在这样做的时候(我遵循其他人发布的一些解决方案),我的 sources.list 只剩下两行。所以它被损坏了,对吗?

接下来,我尝试访问互联网,但它说找不到服务器。当我尝试 ping google.com 时,它说未知主机。我可以成功 ping 我的路由器,但除此之外,它都失败了。

我真的是一个使用 ubuntu 的新手,我希望你们能帮助我,这对我意义重大,因为我目前正在实习。提前谢谢你们

答案1

好吧,鉴于你可能在几个地方修改了文件,所以给你正确的建议有些棘手。至少我是这么理解你的问题的。

步骤1 追溯你的步骤并撤消你所做的一切。

sources.list具有特定的语法,我认为您不能将任何 URL 附加到其中。看起来像是一份很好的指南,供将来参考,关于如何添加链接sources.list。请注意,编辑您的第一步sources.list备份当前版本

第二步

我只需要保存目录中的所有数据/home/$USER(即你的主目录)并重新安装 ubuntu(最好安装最新的稳定版本Ubuntu 14.04.2 LTS。Ubuntu 安装只需不到 30 分钟。对我来说,这是修复多个位置的所有损坏文件的最简单方法(不是最复杂的解决方案)

tar -zcvf backup.tar.gz /home/$USER是最简单的方法。这将在主目录中生成包含您所有内容的单个文件(生成此类文件可能需要一段时间)

第三步

这是一个解决方案-5 - No address associated with hostname

从这个答案来看,你需要做的-5 - No address associated with hostname就是清理你的/etc/hosts文件

这是我的/etc/hosts文件在 Ubuntu 14.04 中的样子

``` 127.0.0.1 本地主机
127.0.1.1 你的计算机名称

# 以下几行适用于支持 IPv6 的主机
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouter ```

相关内容