Ubuntu 16.04 apt-get update fails with local repository

5,630
  • As I remember, when I have setup my trivial local repository. I used this form

    ##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/
    
  • Hence your setup should be with this line:

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

    or

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

Reference: Debian Wiki: How to setup a trivial archive

Share:
5,630

Related videos on Youtube

G.Flemming
Author by

G.Flemming

Updated on September 18, 2022

Comments

  • G.Flemming
    G.Flemming over 1 year

    On my Ubuntu server 16.04 I have following entries in /etc/apt/sources.list

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

    For good measure, I have also tried restricted, universe and multiverse. There are no other entries in this file. And /etc/apt/sources.list.d is empty.

    In /home/discoprodigy/debbin

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

    Just for fun, I also have in /home/discoprodigy/debbin/main/binary-amd64

    Packages.gz
    Packages (plain text file)
    

    Then I execute:

    sudo apt-get update
    

    And this is the result

    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.
    

    I have also tried what is suggested here Ubuntu 16.04 apt-get update doesn't work with local repository but to no avail.

    Update: Following user.dz's suggestion, apt-get update is "successful", but now when I try apt-get install openssh-server I get:

    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) 
    

    But the file is there.

    $ 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
    

    Update: I cleared the files status and available in /var/lib/dpkg and ran apt-get update and then apt-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 did however not report any held packages.

    Update: As per user.dz's request:

    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/
    
  • G.Flemming
    G.Flemming over 7 years
    Thank you. You are the best, I was staring myself blind on this. And on ubuntu "///" vs "/" seems to make no difference.
  • G.Flemming
    G.Flemming over 7 years
    After trying to apt-get install openssh-server i now get: 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) But the file is there.
  • user.dz
    user.dz over 7 years
    Could you edit the question and add updates there, that's more cleaner then using comment, and coming reader can follow easily. Also add the output of ls -l /home/discoprodigy/debbin/ncurses-term_6.0+20160213-1ubuntu1‌​‌​_all.deb . BTW, for /// I just like the canonical form file:// protocol + / root folder. If it was helpful, no need to thank comment, just vote it up :), see why askubuntu.com/help/why-vote
  • G.Flemming
    G.Flemming over 7 years
    I have edited as per your suggestion. It was helpful in the sense that apt-get update retorted "success", but I don't believe it since it can't find the dependency files. I would like to vote you up, but I'm told by the system I'm still a low-life and therefore not allowed to vote :-(
  • user.dz
    user.dz over 7 years
    @G.Flemming , :) no problem i forget the threshold for voting is 15, never mind. Could you add this output to check parent folders permissions. stat -c "%A %G %U %n" /home/ /home/discoprodigy/ /home/discoprodigy/debbin/
  • G.Flemming
    G.Flemming over 7 years
    as per your request, kindly see above update
  • user.dz
    user.dz over 7 years
    :/ seems fine, just a note about /home it should be owned by root. Anyway could post output of this command in this link to paste.ubuntu.com
  • G.Flemming
    G.Flemming over 7 years
    please find the output here. Regarding root ownership, I know, but I'm working on a custom preseed for the server, and since it doesn't install openssh-server it's a pain to work with. So I'm working off my Desktop, the problems are the same, but it's easier to copy/paste etc.
  • user.dz
    user.dz over 7 years
    @G.Flemming Why you have cleared /var/lib/dpkg/status? Now, your system does not which packages are already installed and which are not. To dpkg now, it has nothing installed
  • G.Flemming
    G.Flemming over 7 years
    i cleared exactly for that reason, but obviously I have the original file which will be reinstated when this works i.e. installing openssh-server. I don't understand what you mean by "To dpkg now, it has nothing installed" ?
  • user.dz
    user.dz over 7 years
    @G.Flemming, I mean that's why you get those errors for unmet dependencies. After removing /var/lib/dpkg/status, apt/dpkg has nothing installed in the list, so apt will try to download not just additional dependencies of openssh-server but all dependencies (even the ones installed previously when you install ubuntu). However, those are not in your local repo (and of course, official repo's are disabled)
  • G.Flemming
    G.Flemming over 7 years
    it works now, the key was when u said "but all dependencies" i.e. dependencies of dependencies of...etc.. which is a new concept to me coming from a MS world. To show my appreciation, ping me anytime if you need help with preseeding, I have done it a couple of hundred times by now :) And when I get my merit badge here, I will vote you up.
  • user.dz
    user.dz over 7 years
    @G.Flemming, thank you. I encourage you too to help others in that by following that tag , many question were passed unanswered . askubuntu.com/questions/tagged/… . Also you may create self-answered question for the issues you have solved yourself. They will help many users that don't even try to ask, help raise you rep, and your questions get importance. Have nice time.