TranslateProject/published/201505/20150227 How To Fix--Failed to fetch cdrom apt-get update cannot be used to add new CD-ROMs.md

73 lines
4.0 KiB
Markdown
Raw Permalink Normal View History

如何修复 apt-get update 无法添加新的 CD-ROM 的错误
2015-02-27 19:26:37 +08:00
================================================================================
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/12/elementary_OS_Freya.jpg)
2015-03-08 11:44:25 +08:00
这些天我正在体验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后看上去像这样
2015-02-27 19:26:37 +08:00
> 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.
2015-03-08 11:44:25 +08:00
本篇中,我们会了解如何修复这个错误。
2015-02-27 19:26:37 +08:00
2015-03-08 11:44:25 +08:00
### 修复apt-get update无法添加新的CD-ROM的错误 ###
2015-02-27 19:26:37 +08:00
2015-03-08 11:44:25 +08:00
这个错误的原因是cdrom已经被包含在源之中。要修复这个问题我们需要将它从软件源中移除。
2015-02-27 19:26:37 +08:00
2015-03-08 11:44:25 +08:00
在Ubuntu中找到“软件与更新”
2015-02-27 19:26:37 +08:00
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/08/Software_Update_Ubuntu.jpeg)
2015-03-08 11:44:25 +08:00
在Ubuntu Software的第一个标签中找到cdrom如果它是勾选的那么取消勾选。
2015-02-27 19:26:37 +08:00
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/CDROM_Error_Update_Software_Sources.jpeg)
2015-03-08 11:44:25 +08:00
关闭软件源并再次运行更新。现在应该可以用了。
2015-02-27 19:26:37 +08:00
2015-03-08 11:44:25 +08:00
### 进一步故障排除: ###
2015-02-27 19:26:37 +08:00
2015-03-08 11:44:25 +08:00
上面描述的方法已经修复了这个**apt-get update cannot be used to add new CD-ROMs**错误。但是这个方法对我无效因为cdrom的选项这时是灰色的因为我使用的live版本。
2015-02-27 19:26:37 +08:00
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/CDROM_Update_Error.png)
2015-03-08 11:44:25 +08:00
现在要修复我们的问题了,我们是要采用命令行路线。打开终端并查看软件源中包含了哪些源:
2015-02-27 19:26:37 +08:00
cat /etc/apt/sources.list
2015-03-08 11:44:25 +08:00
我的输出是下面这样:
2015-02-27 19:26:37 +08:00
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
2015-03-08 11:44:25 +08:00
在上面的第一行中。它包含了cdrom。我们需要用#’来注释掉这行:
2015-02-27 19:26:37 +08:00
#deb cdrom:[elementary OS 0.3 _Freya_ Daily amd64 (20150208)]/ trusty main restricted
2015-03-08 11:44:25 +08:00
要用下面的命令来:
2015-02-27 19:26:37 +08:00
sudo gedit /etc/apt/sources.list
2015-03-08 11:44:25 +08:00
在你编辑完软件源后再次运行apt-get update。“apt-get update cannot be used to add new CD-ROMs”这个错误应该已经修复了。如果你还遇到其他的问题看一下这篇收集了大部分[Ubuntu常见更新错误修复][1]的文章。
2015-02-27 19:26:37 +08:00
2015-03-08 11:44:25 +08:00
我希望这篇教程对你有用。如果你还有其他的问题和建议,请在下面留言。
2015-02-27 19:26:37 +08:00
--------------------------------------------------------------------------------
via: http://itsfoss.com/fix-failed-fetch-cdrom-aptget-update-add-cdroms/
作者:[Abhishek][a]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
2015-02-27 19:26:37 +08:00
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/abhishek/
2015-03-08 11:44:25 +08:00
[1]:http://itsfoss.com/fix-update-errors-ubuntu-1404/