這些天我正在體驗(yàn)Elementary OS Freya,在這期間,我遇到了一個(gè)非常常見(jiàn)的更新錯(cuò)誤:Failed to fetch cdrom Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs。完整的錯(cuò)誤在運(yùn)行apt-get update后看上去像這樣:
W: Failed to fetch cdrom://elementary OS 0.3 Freya – Daily amd64 (20150208)/dists/trusty/main/binary-amd64/Packages Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs/p>
p> W: Failed to fetch cdrom://elementary OS 0.3 Freya – Daily amd64 (20150208)/dists/trusty/restricted/binary-amd64/Packages Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs/p>
p> E: Some index files failed to download. They have been ignored, or old ones used instead.
本篇中,我們會(huì)了解如何修復(fù)這個(gè)錯(cuò)誤。
修復(fù)apt-get update無(wú)法添加新的CD-ROM的錯(cuò)誤
這個(gè)錯(cuò)誤的原因是cdrom已經(jīng)被包含在源之中。要修復(fù)這個(gè)問(wèn)題,我們需要將它從軟件源中移除。
在Ubuntu中,找到“軟件與更新”:
在Ubuntu Software的第一個(gè)標(biāo)簽中,找到cdrom,如果它是勾選的,那么取消勾選。
關(guān)閉軟件源并再次運(yùn)行更新?,F(xiàn)在應(yīng)該可以用了。
進(jìn)一步故障排除:
上面描述的方法已經(jīng)修復(fù)了這個(gè)apt-get update cannot be used to add new CD-ROMs錯(cuò)誤。但是這個(gè)方法對(duì)我無(wú)效,因?yàn)閏drom的選項(xiàng)這時(shí)是灰色的,因?yàn)槲沂褂玫膌ive版本。
現(xiàn)在要修復(fù)我們的問(wèn)題了,我們是要采用命令行路線。打開(kāi)終端并查看軟件源中包含了哪些源:
cat /etc/apt/sources.list
我的輸出是下面這樣:
deb cdrom:[elementary OS 0.3 _Freya_ – Daily amd64 (20150208)]/ trusty main restricted
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
在上面的第一行中。它包含了cdrom。我們需要用‘#’來(lái)注釋掉這行:
#deb cdrom:[elementary OS 0.3 _Freya_ – Daily amd64 (20150208)]/ trusty main restricted
要用下面的命令來(lái):
sudo gedit /etc/apt/sources.list
在你編輯完軟件源后,再次運(yùn)行apt-get update。“apt-get update cannot be used to add new CD-ROMs”這個(gè)錯(cuò)誤應(yīng)該已經(jīng)修復(fù)了。如果你還遇到其他的問(wèn)題,看一下這篇收集了大部分Ubuntu常見(jiàn)更新錯(cuò)誤修復(fù)的文章。