【问题标题】:Raspberry Pi etc/apt/sources.list is missing树莓派 etc/apt/sources.list 丢失
【发布时间】:2016-12-03 05:09:45
【问题描述】:

我可能不小心删除了 etc/apt/sources.list,现在每次我尝试在我的 Raspberry Pi 上安装一些东西时,我都会收到以下错误消息

包 phpmyadmin 不可用,但被另一个包引用。 这可能意味着包丢失、已过时或 只能从其他来源获得

E: 包 'phpmyadmin' 没有安装候选者

如何取回 /etc/apt/sources.list 文件

【问题讨论】:

    标签: linux raspberry-pi raspbian raspberry-pi2


    【解决方案1】:

    首先,检查您是否真的删除了它,或者您是否有源文件的副本,例如 /etc/apt/sources.list.save(某些程序在使用时会自动创建这样的副本)。运行以下代码以查找可能的副本:

    ls /etc/apt/ | grep -ie "sources.list"
    

    如果在那里找不到副本,则必须重新创建源文件。为此,这将取决于您运行的 Linux 发行版——搜索“sources.list myLinuxDistribution”,看看会出现什么。对于 Debian 8,它可能是这样的:

    deb http://ftp.us.debian.org/debian/ jessie main contrib non-free
    deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free
    deb http://security.debian.org/ jessie/updates main contrib non-free
    deb-src http://security.debian.org/ jessie/updates main contrib non-free
    deb http://ftp.us.debian.org/debian/ jessie-updates main contrib non-free
    deb-src http://ftp.us.debian.org/debian/ jessie-updates main contrib non-free
    deb http://ftp.debian.org/debian jessie-backports main contrib non-free
    deb-src http://ftp.debian.org/debian jessie-backports main contrib non-free
    

    找到合适的sources.list 代码后,您可以运行您喜欢的文本编辑器(例如:gksudo leafpad /etc/apt/sources.list),将sources.list 内容粘贴到那里,然后保存新文件。

    【讨论】:

      【解决方案2】:

      Raspbian Jessie Lite 的标准 /etc/apt/sources.list 如下所示:

      deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
      # Uncomment line below then 'apt-get update' to enable 'apt-get source'
      #deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi
      

      我认为 phpmyadmin 不需要其他条目。

      此外还有一个文件 /etc/apt/sources.list.d/raspi.list 看起来像这样:

      deb http://archive.raspberrypi.org/debian/ jessie main ui
      # Uncomment line below then 'apt-get update' to enable 'apt-get source'
      #deb-src http://archive.raspberrypi.org/debian/ jessie main ui
      

      以下是/etc/apt 包含文件权限设置中所有文件的完整列表。我没有包含空目录。

      pi@raspberrypi:~ $ ls -alR /etc/apt
      /etc/apt:
      total 40
      drwxr-xr-x  6 root root 4096 Nov 25 17:28 .
      drwxr-xr-x 88 root root 4096 Dec 16 20:25 ..
      drwxr-xr-x  2 root root 4096 Dec 16 20:10 apt.conf.d
      -rw-r--r--  1 root root   99 Nov 25 17:28 listchanges.conf
      drwxr-xr-x  2 root root 4096 Apr  2  2016 preferences.d
      -rw-r--r--  1 root root  234 Nov 25 17:22 sources.list
      drwxr-xr-x  2 root root 4096 Nov 25 17:55 sources.list.d
      -rw-r--r--  1 root root 2424 Nov 25 17:22 trusted.gpg
      -rw-r--r--  1 root root 1233 Nov 25 17:22 trusted.gpg~
      drwxr-xr-x  2 root root 4096 Apr  2  2016 trusted.gpg.d
      
      /etc/apt/apt.conf.d:
      total 28
      drwxr-xr-x 2 root root 4096 Dec 16 20:10 .
      drwxr-xr-x 6 root root 4096 Nov 25 17:28 ..
      -rw-r--r-- 1 root root  643 Apr  2  2016 01autoremove
      -rw-r--r-- 1 root root  981 Nov 25 17:24 01autoremove-kernels
      -rw-r--r-- 1 root root  141 Oct 12  2014 20listchanges
      -rw-r--r-- 1 root root  161 Nov 25 17:30 50raspi
      -rw-r--r-- 1 root root  182 Mar 19  2015 70debconf
      
      /etc/apt/sources.list.d:
      total 12
      drwxr-xr-x 2 root root 4096 Nov 25 17:55 .
      drwxr-xr-x 6 root root 4096 Nov 25 17:28 ..
      -rw-r--r-- 1 root root  193 Nov 25 17:55 raspi.list 
      

      【讨论】:

        猜你喜欢
        • 2015-02-01
        • 1970-01-01
        • 2021-06-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多