Ubuntu 16.04 apt-get 更新本地存储库失败

Ubuntu 16.04 apt-get 更新本地存储库失败

在我的 Ubuntu 服务器 16.04 上,我有以下条目/etc/apt/sources.list

deb [arch=amd64 trusted=yes] file:/home/discoprodigy /debbin main  

为了保险起见,我还尝试了 restricted、universe 和 multiverse。此文件中没有其他条目。并且/etc/apt/sources.list.d为空。

/home/discoprodigy/debbin

152 miscellaneous .deb files
Packages.gz
Packages (plain text file)

只是为了好玩,我也有/home/discoprodigy/debbin/main/binary-amd64

Packages.gz
Packages (plain text file)

然后我执行:

sudo apt-get update

这就是结果

Get:1 file:/home/discoprodigy /debbin InRelease
Ign:1 file:/home/discoprodigy /debbin InRelease
Get:2 file:/home/discoprodigy /debbin Release
Ign:2 file:/home/discoprodigy /debbin Release
Get:3 file:/home/discoprodigy /debbin/main amd64 Packages
Ign:3 file:/home/discoprodigy /debbin/main amd64 Packages
Get:4 file:/home/discoprodigy /debbin/main all Packages
Ign:4 file:/home/discoprodigy /debbin/main all Packages
  |
etc. etc.
  |
Get:3 file:/home/discoprodigy /debbin/main amd64 Packages
Err:3 file:/home/discoprodigy /debbin/main amd64 Packages
  File not found - /home/discoprodigy/dists//debbin/main/binary-amd64/Packages (2: No such file or directory)
Get:4 file:/home/discoprodigy /debbin/main all Packages
Ign:4 file:/home/discoprodigy /debbin/main all Packages
Reading package lists... Done
N: Ignoring file '20auto-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension
E: Failed to fetch file:/home/discoprodigy/dists//debbin/main/binary-amd64/Packages  File not found - /home/discoprodigy/dists//debbin/main/binary-amd64/Packages (2: No such file or directory)
E: Some index files failed to download. They have been ignored, or old ones used instead.

我也尝试过这里建议的Ubuntu 16.04 apt-get update 不适用于本地存储库但无济于事。

更新:按照 user.dz 的建议,apt-get update“成功”,但现在当我尝试时,apt-get install openssh-server我得到:

Err:1 file:/home/discoprodigy debbin/ ncurses-term 6.0+20160213-1ubuntu1 File not found - /home/discoprodigy/debbin/ncurses-term_6.0+20160213-1ubuntu1‌​_all.deb (2: No such file or directory) 

但文件就在那里。

$ ls -l /home/discoprodigy/debbin/ncurses-term_6.0+20160213-1ubuntu1_all.deb
-rw-rw-r-- 1 discoprodigy discoprodigy 249166 Nov 24 15:08 /home/discoprodigy/debbin/ncurses-term_6.0+20160213-1ubuntu1_all.deb

更新:我清除了文件statusavailable运行/var/lib/dpkg然后apt-get updateapt-get install openssh-server

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 openssh-server : Depends: libaudit1 (>= 1:2.2.1) but it is not installable
                  Depends: libc6 (>= 2.17) but it is not going to be installed
                         | 
                      etc. etc. 
                         | 
                  Recommends: ncurses-term but it is not going to be installed
                  Recommends: ssh-import-id but it is not going to be installed
N: Ignoring file '20auto-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension
E: Unable to correct problems, you have held broken packages.

dpkg --get-selections | grep hold但没有报告任何被扣留的包裹。

更新:根据 user.dz 的要求:

stat -c "%A %G %U %n" /home/ /home/discoprodigy/ /home/discoprodigy/debbin/
drwxrwxr-x discoprodigy discoprodigy /home/
drwxrwxr-x discoprodigy discoprodigy /home/discoprodigy/
drwxrwxr-x discoprodigy discoprodigy /home/discoprodigy/debbin/

答案1

  • 我记得,当我设置我的本地存储库时。我使用了这种形式

    ##LOCAL
    deb file:///path-to-parent-of-packages-folder packages-folder/
    
    ##LAN using HTTP server
    deb http://ip-address packages-folder/
    
    ##LAN using HTTP server & mDNS (Avahi)
    deb http://machine-name.local packages-folder/
    
  • 因此你的设置应该是这样的:

    deb [arch=amd64 trusted=yes] file:///home/discoprodigy debbin/
    

    或者

    deb [arch=amd64 trusted=yes] file:///home/discoprodigy/debbin ./
    

参考: Debian Wiki:如何设置简单档案

相关内容