歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> 解決Ubuntu下apt-get update無法添加新的CD-ROM的問題

解決Ubuntu下apt-get update無法添加新的CD-ROM的問題

日期:2017/3/1 17:44:36   编辑:Linux技術

這些天我正在體驗Elementary OS Freya,在這期間,我遇到了一個非常常見的更新錯誤: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。完整的錯誤在運行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.

本篇中,我們會了解如何修復這個錯誤。
修復apt-get update無法添加新的CD-ROM的錯誤

這個錯誤的原因是cdrom已經被包含在源之中。要修復這個問題,我們需要將它從軟件源中移除。

在Ubuntu中,找到“軟件與更新”:
201563180519871.jpg (512×220)

在Ubuntu Software的第一個標簽中,找到cdrom,如果它是勾選的,那麼取消勾選。
201563180541449.jpg (597×468)

關閉軟件源並再次運行更新。現在應該可以用了。
進一步故障排除:

上面描述的方法已經修復了這個apt-get update cannot be used to add new CD-ROMs錯誤。但是這個方法對我無效,因為cdrom的選項這時是灰色的,因為我使用的live版本。
201563180601359.png (503×406)

現在要修復我們的問題了,我們是要采用命令行路線。打開終端並查看軟件源中包含了哪些源:


復制代碼代碼如下: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。我們需要用‘#’來注釋掉這行:


復制代碼代碼如下:#deb cdrom:[elementary OS 0.3 _Freya_ – Daily amd64 (20150208)]/ trusty main restricted

要用下面的命令來:


復制代碼代碼如下:sudo gedit /etc/apt/sources.list

在你編輯完軟件源後,再次運行apt-get update。“apt-get update cannot be used to add new CD-ROMs”這個錯誤應該已經修復了。如果你還遇到其他的問題,看一下這篇收集了大部分Ubuntu常見更新錯誤修復的文章。

Copyright © Linux教程網 All Rights Reserved