---
author: Abhishek
category: 技术
comments_data:
- date: '2015-05-08 16:54:36'
  message: 看了本文，逆向思维，我大概知道了，要是在无法联网情况下，如何配置apt本地源
  postip: 221.238.32.162
  username: 来自 - 天津 的 Firefox/Windows 用户
count:
  commentnum: 1
  favtimes: 0
  likes: 0
  sharetimes: 0
  viewnum: 13823
date: '2015-05-08 10:29:34'
editorchoice: false
excerpt: '这些天我正在体验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 fetc'
fromurl: http://itsfoss.com/fix-failed-fetch-cdrom-aptget-update-add-cdroms/
id: 5409
islctt: true
largepic: /images/p/201505/08/102935lutcjkyukbzjb0cl.jpg
permalink: /article-5409-1.html
pic: /data/attachment/album/201505/08/102935lutcjkyukbzjb0cl.jpg.thumb.jpg
related: []
reviewer: ''
selector: ''
summary: '这些天我正在体验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 fetc'
tags:
- apt-get
thumb: false
title: 如何修复 apt-get update 无法添加新的 CD-ROM 的错误
titlepic: false
translator: geekpi
updated: '2015-05-08 10:29:34'
---

![](/data/attachment/album/201505/08/102935lutcjkyukbzjb0cl.jpg)


这些天我正在体验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中，找到“软件与更新”：


![](/data/attachment/album/201505/08/102935i955dp0ujgtuuu6u.jpg)


在Ubuntu Software的第一个标签中，找到cdrom，如果它是勾选的，那么取消勾选。


![](/data/attachment/album/201505/08/102936kg7s7ktfa7aflkde.jpg)


关闭软件源并再次运行更新。现在应该可以用了。


### 进一步故障排除：


上面描述的方法已经修复了这个**apt-get update cannot be used to add new CD-ROMs**错误。但是这个方法对我无效，因为cdrom的选项这时是灰色的，因为我使用的live版本。


![](/data/attachment/album/201505/08/102936jewm54skws4am4os.png)


现在要修复我们的问题了，我们是要采用命令行路线。打开终端并查看软件源中包含了哪些源：



```
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常见更新错误修复](http://itsfoss.com/fix-update-errors-ubuntu-1404/)的文章。


我希望这篇教程对你有用。如果你还有其他的问题和建议，请在下面留言。




---


via: <http://itsfoss.com/fix-failed-fetch-cdrom-aptget-update-add-cdroms/>


作者：[Abhishek](http://itsfoss.com/author/abhishek/) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译，[Linux中国](http://linux.cn/) 荣誉推出