How to fix the sources list

Sometimes the apt-get may not work, it is often caused by the misspelled sources list. In most cases, you can fix it by yourself.

In this guide, I will tell you where is sources list, and how to fix it.

WHERE IS SOURCES LIST
Sources list is located at “/etc/apt/” (File System->etc->apt), the main sources list is “sources.list”. And there will be other sources list under /etc/apt/sources.list.d/, all valid list should be end with “.list”.

HOW DOES SOURCES LIST LOOK LIKE
If you open your sources.list, a typical line will look like this:

deb http://archive.ubuntu.com/ubuntu natty main restricted

It is called an “Entry”, sources list is consists of a numbers of entries.

Every entry is made by four sections, these sections are separated by “space”. I used different color to distinguish difference sections.

The first section is represent the “Entry type”. “deb” means the list contains deb packages. Another value is “deb-src”, it means the deb packages’ source code.

The second section is the URL, it must be accessible.

The third is distribution code name, it depends on your current distribituion.

The forth section is the “components”, it can be several items.

So a complete and valid source entry will look like this:

Type: must be “deb” or “deb-src”
URL: must be an accessible url
Code name: “karmic”, “lucid”, “maverick” or ther Ubuntu code names.
Component name: if the entry is PPA, so it will always be “main”.
Now you know how to fix the sources list! Open your terminal, try to edit and correct it with root like this:

sudo gedit /etc/apt/sources.list (or other path)

If you have any other problem, please leave a comment to let me know.

How to fix the sources list的更多相关文章

  1. How to fix “Duplicate sources.list entry …” issue

    The correct format of repository source line is <type of repository>  <location>  <di ...

  2. Ubuntu 14.04.4官方默认更新源sources.list

    Ubuntu 14.04.4官方默认更新源sources.list # deb cdrom:[Ubuntu LTS _Trusty Tahr_ - Release amd64 (20160217.1) ...

  3. 关于ubuntu的sources.list总结

    一.作用 文件/etc/apt/sources.list是一个普通可编辑的文本文件,保存了ubuntu软件更新的源服务器的地址.和sources.list功能一样的是/etc/apt/sources. ...

  4. [转] 关于ubuntu的sources.list总结

    点击阅读原文 一.作用 文件/etc/apt/sources.list是一个普通可编辑的文本文件,保存了ubuntu软件更新的源服务器的地址.和sources.list功能一样的是/etc/apt/s ...

  5. 【转】关于Ubuntu的sources.list 的总结

    一.作用 文件/etc/apt/sources.list是一个普通可编辑的文本文件,保存了ubuntu软件更新的源服务器的地址.和sources.list功能一样的是/etc/apt/sources. ...

  6. Ubuntu14.04和16.04官方默认更新源sources.list和第三方源推荐(干货!)

    不多说,直接上干货! 写在前面:笔者由于还在学校学习,学校没有开发给Linux用的上网客户端,所以只能用在windows系统中通过安装虚拟机运行linux比较方便,但没有外网,只有学校的教育网,所以我 ...

  7. buntu14.04和16.04官方默认更新源sources.list和第三方源推荐(干货!)转

    配置完成后: sudo apt-get update 安装和删除软件: sudo apt-get install sudo apt-get remove buntu14.04和16.04官方默认更新源 ...

  8. 【转】stropts.h: No such file or directory – How to Fix

    原文地址:stropts.h: No such file or directory – How to Fix 作者:xjc2694 It is a known issue that modern Li ...

  9. Could not find modernizr-2.6.2 in any of the sources GitLab: API is not accessible

    Could not find modernizr-2.6.2 in any of the sources GitLab: API is not accessible bundle exec rake ...

随机推荐

  1. centos7 安装拼音输入法(转载)

    http://m.blog.csdn.net/article/details?id=52137523

  2. Python的高级特性4:函数式编程

    函数式编程的核心就是把函数当成对象来进行编程. 有两个常用到的方法:map/reduce,filter,其中map和filter是内建方法,而reduce不是,所以需要import相关模块. map接 ...

  3. 10 Things Every Java Programmer Should Know about String

    String in Java is very special class and most frequently used class as well. There are lot many thin ...

  4. xpath 参考

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Te ...

  5. Openjudge 1.3-04 垂直直方图

    04:垂直直方图 查看 总时间限制: 1000ms 内存限制: 65536kB 描述 输入4行全部由大写字母组成的文本,输出一个垂直直方图,给出每个字符出现的次数.注意:只用输出字符的出现次数,不用输 ...

  6. 关于Microsoft Visual Studio 2010系统自带的数据库

    转自:http://blog.sina.com.cn/s/blog_a570cca601012x5w.html 1.Visual studio Tools>命令提示 2.aspnet_regsq ...

  7. JBOSS只能本机localhost和127.0.0.1能访问的解决

    一句话: %jboss_home%\bin>standalone.bat -Djboss.bind.address=0.0.0.0 也可以直接编辑standalone.xml,将里面所有127. ...

  8. Servlet学习之web服务器Tomcat 详解

    Web服务器是什么 Web服务器是指驻留于因特网上某种类型计算机的程序.当Web浏览器(客户端)连到服务器上并请求文件时,服务器将处理该请求并将文件发送到该浏览器上,附带的信息会告诉浏览器如何查看该文 ...

  9. JQuery 图片略缩与弹出预览 jqthumb fancybox

    弹出框插件-FANCYBOXhttp://www.jq22.com/jquery-info28 jqthumb.js缩略图插件 http://www.ijquery.cn/?p=798

  10. 一些实用的sublime快捷键以及初始设置

    一些常用快捷键 Ctrl + N-------------------新建 Ctrl + F-------------------查找 Ctrl+Shift +k -----------删除一行 Ct ...