解决Ubuntu下apt-get update无法添加新的CD-ROM的问题
程序员文章站
2024-01-18 11:03:34
这篇文章主要介绍了解决Ubuntu下apt-get update无法添加新的CD-ROM的问题,主要是从软件源中移除cdrom的操作,需要的朋友可以参考下... 15-06-03...
这些天我正在体验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中,找到“软件与更新”:
在ubuntu software的第一个标签中,找到cdrom,如果它是勾选的,那么取消勾选。
关闭软件源并再次运行更新。现在应该可以用了。
进一步故障排除:
上面描述的方法已经修复了这个apt-get update cannot be used to add new cd-roms错误。但是这个方法对我无效,因为cdrom的选项这时是灰色的,因为我使用的live版本。
现在要修复我们的问题了,我们是要采用命令行路线。打开终端并查看软件源中包含了哪些源:
复制代码
代码如下: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
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常见更新错误修复的文章。