如何修複 apt-get update 無法添加新的 CD-ROM 的錯誤

來源:互聯網
上載者:User

如何修複 apt-get update 無法添加新的 CD-ROM 的錯誤

這些天我正在體驗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

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

E: Some index files failed to download. They have been ignored, or old ones used instead.

本篇中,我們會瞭解如何修複這個錯誤。

 

修複apt-get update無法添加新的CD-ROM的錯誤

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

在Ubuntu中,找到“軟體與更新”:

在Ubuntu Software的第一個標籤中,找到cdrom,如果它是勾選的,那麼取消勾選。

關閉軟體源並再次運行更新。現在應該可以用了。

 

進一步故障排除:

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

現在要修複我們的問題了,我們是要採用命令列路線。開啟終端並查看軟體源中包含了哪些源:

cat /etc/apt/sources.list

我的輸出是下面這樣:

  1. deb cdrom:[elementary OS 0.3_Freya_–Daily amd64 (20150208)]/ trusty main restricted
  2. deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
  3. deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
  4. deb http://security.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
  5. deb-src http://security.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
  6. deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
  7. deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse

在上面的第一行中。它包含了cdrom。我們需要用‘#’來注釋掉這行:

  1. #deb cdrom:[elementary OS 0.3 _Freya_ – Daily amd64 (20150208)]/ trusty main restricted

要用下面的命令來:

  1. sudo gedit /etc/apt/sources.list

在你編輯完軟體源後,再次運行apt-get update。“apt-get update cannot be used to add new CD-ROMs”這個錯誤應該已經修複了。

我希望這篇教程對你有用。如果你還有其他的問題和建議,請在下面留言。

本文永久更新連結地址:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.