
zati@zati-K42JZ:~$ sudo apt-get update [sudo] password for zati: Err http://archive.ubuntu.com precise Release.gpg
昨天我嘗試在我的 12.04 ubuntu 中安裝管理系統。我嘗試使用 sudo gedit /etc/apt/sources.list 編輯 resources.list 中的儲存庫。我不確定我是否輸入正確,我只輸入 debhttp://dms.oscc.org.my/repo二進制/如網站所述。當我想要 apt-get update 時,它執行 -5 錯誤。為什麼會發生這種情況?它也為存檔和安全執行 -5 錯誤。
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]
然後我試圖找出解決方案,但在這樣做時(我遵循其他人發布的一些解決方案),然後我的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 ```