Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use apt-file with an aptly repository #667

Closed
mtmr opened this issue Nov 8, 2017 · 12 comments
Closed

Unable to use apt-file with an aptly repository #667

mtmr opened this issue Nov 8, 2017 · 12 comments
Labels

Comments

@mtmr
Copy link

mtmr commented Nov 8, 2017

apt-file is a tool that gives information about packages that provide a specific file

Detailed Description

aptly generates a Contents-arch.tgz, but it is not being recognized by apt-file.

@smira
Copy link
Contributor

smira commented Nov 8, 2017

@mtmr could you please provide more details or some steps to reproduce?

@smira smira added the bug label Nov 8, 2017
@mtmr
Copy link
Author

mtmr commented Nov 16, 2017 via email

@nordri
Copy link

nordri commented Feb 20, 2018

Hello there,
We are struggling with something similar.
The Contents-amd64.gz is generated in http://S3_bucket/dists/xenial/component/Contents-amd64.gz but apt-file tries to download it from http://S3_bucket/dists/xenial/Contents-amd64.gz_ so it returns 403 forbidden.
If I upload manually the file to that specific location it works fine.
Any idea how to change this behavior?

aptly version 1.2.0

Thanks in advance.

@smira
Copy link
Contributor

smira commented Feb 22, 2018

Official documentation:

https://wiki.debian.org/DebianRepository/Format#A.22Contents.22_indices

The files dists/$DIST/$COMP/Contents-$SARCH.gz (and dists/$DIST/$COMP/Contents-udeb-$SARCH.gz for udebs) are so called Contents indices. The variable $SARCH means either a binary architecture or the pseudo-architecture "source" that represents source packages. They are optional indices describing which files can be found in which packages. Prior to Debian wheezy, the files were located below "dists/$DIST/Contents-$SARCH.gz".

Which version of Debian/Ubuntu are you using?

@mtmr
Copy link
Author

mtmr commented Feb 23, 2018 via email

@smira
Copy link
Contributor

smira commented Feb 27, 2018

Even official Debian mirror doesn't have Contents indices in distribution folder, only per-component ones: http://ftp.us.debian.org/debian/dists/stretch/

@smira
Copy link
Contributor

smira commented Feb 27, 2018

I'm closing this one unless there's some additional info on that, if there's anything else we should do on aptly side to support it better.

@smira smira closed this as completed Feb 27, 2018
@j1elo
Copy link

j1elo commented Apr 2, 2018

Hi @smira, I'm working with @nordri and we faced this issue. After doing my research, it turns out that Ubuntu does still use on this day the traditional mirror layout that Debian modified some time ago. It is easy to see by checking on their repos:

Ubuntu: http://archive.ubuntu.com/ubuntu/dists/xenial/ -> Contents-* file located in the root dir.
Debian: http://ftp.debian.org/debian/dists/stretch/ -> Contents-* file(s) located in $COMPONENT subdirs (which in case of Debian, are "main", "contrib", "non-free").

On each system, apt-file is configured to work with their corresponding (incompatible) repo layouts. In Ubuntu at least, it is also possible to configure the download URL, in /etc/apt/apt-file.conf.

I have empirically tested this, on Ubuntu 16.04 (Xenial):

  • With the default settings in /etc/apt/apt-file.conf, it fails accessing a Debian-style layout:
http = diffindex-download -i "<uri>/dists/<dist>/Contents-<arch>.gz" <cache>/<dest>
# apt-file --verbose --sources-list /etc/apt/sources.list.d/debian.list update
D: Using cache directory /var/cache/apt/apt-file
D: reading sources file /etc/apt/sources.list.d/debian.list
D: got 'deb http://deb.debian.org/debian stretch main contrib non-free'
D: kept 'deb http://deb.debian.org/debian stretch main contrib non-free'
D: diffindex-download -i "http://deb.debian.org/debian/dists/stretch/Contents-amd64.gz" /var/cache/apt/apt-file/deb.debian.org_debian_dists_stretch_Contents-amd64.gz
+ diffindex-download -i http://deb.debian.org/debian/dists/stretch/Contents-amd64.gz /var/cache/apt/apt-file/deb.debian.org_debian_dists_stretch_Contents-amd64.gz
Downloading Index http://deb.debian.org/debian/dists/stretch/Contents-amd64.diff/Index:
No Index available.
Ignoring source without Contents File:
  http://deb.debian.org/debian/dists/stretch/Contents-amd64.gz
  • With the modified settings in /etc/apt/apt-file.conf (manually adding the component "contrib", as an example), access is successful:
http = diffindex-download -i "<uri>/dists/<dist>/contrib/Contents-<arch>.gz" <cache>/<dest>
# apt-file --verbose --sources-list /etc/apt/sources.list.d/debian.list update
D: Using cache directory /var/cache/apt/apt-file
D: reading sources file /etc/apt/sources.list.d/debian.list
D: got 'deb http://deb.debian.org/debian stretch main contrib non-free'
D: kept 'deb http://deb.debian.org/debian stretch main contrib non-free'
D: diffindex-download -i "http://deb.debian.org/debian/dists/stretch/contrib/Contents-amd64.gz" /var/cache/apt/apt-file/deb.debian.org_debian_dists_stretch_Contents-amd64.gz
+ diffindex-download -i http://deb.debian.org/debian/dists/stretch/contrib/Contents-amd64.gz /var/cache/apt/apt-file/deb.debian.org_debian_dists_stretch_Contents-amd64.gz
Downloading Index http://deb.debian.org/debian/dists/stretch/contrib/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://deb.debian.org/debian/dists/stretch/contrib/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   327  100   327    0     0   4691      0 --:--:-- --:--:-- --:--:--  4739
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.

Regarding what can be done in the aptly side to better support this situation, I would guess that supporting both traditional (Ubuntu) and modern (Debian) repo layout styles would do it. I don't know if that would introduce too much complexity to aptly, though.

Related:

@smira smira reopened this Apr 2, 2018
@smira
Copy link
Contributor

smira commented Apr 2, 2018

@j1elo thanks for researching it, it makes sense to add support for Ubuntu (legacy) layout

@j1elo
Copy link

j1elo commented Apr 2, 2018

Yes I think it would make sense. There is a bit more to know: apt-file has been reworked lately and in the latest version (to be included in the still unreleased Ubuntu 18.04 LTS) it is now more "intelligent" and able to use the Apt subsystem in order to detect what is the repo layout. Not sure about Debian, but it probably does the same in the most up-to-date versions.

However for aptly I think this would be solving the issue by staying too much on the tip of the latest releases; the current Ubuntu 16.04 is officially supported until year 2021, and even the older 14.04 will still be around for one whole year until April 2019 (see the Ubuntu Releases page).

(I'm talking here only about Long Term Support releases, because in my opinion those are the only ones for which it makes sense the effort of building tools and providing support)

@smira smira added the 1.3.0 label Apr 2, 2018
@smira
Copy link
Contributor

smira commented Apr 4, 2018

I've got the implementation ready, now I need to update tests for the changes, and we should be good to go

@smira
Copy link
Contributor

smira commented Apr 11, 2018

Nightly build aptly_1.2.0+36+g4d3b42e contains the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants