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

texlive: mirroring is bad #10026

Closed
utdemir opened this issue Sep 23, 2015 · 57 comments
Closed

texlive: mirroring is bad #10026

utdemir opened this issue Sep 23, 2015 · 57 comments
Labels
0.kind: bug Something is broken

Comments

@utdemir
Copy link
Member

utdemir commented Sep 23, 2015

I can not build dblatex(a dependency of nix) on nixpkgs master. It can't download some required archives. Changing mirror to ftp.math.utah.edu in pkgs/tools/typesetting/tex/texlive-new/default.nix also doesn't solve the problem.

It's not a specific dependency, on every run, a different dependency fails(depends on download order).

Steps to reproduce:

  • nix-shell -I ~/nixpkgs -p dblatex on nixpkgs/master
trying ftp://tug.ctan.org/pub/tex/historic/systems/texlive/2015/tlnet-final/archive/hyph-utf8.tar.xz

trying ftp://tug.ctan.org/pub/tex/historic/systems/texlive/2015/tlnet-final/archive/gsftopk.tar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  % Total    % Received % Xferd  Average Speed   Time    Tim
e     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  % Total    % Received % Xferd  Average Speed   Time    Tim
e     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  % Total    % Received % Xferd  Average Speed   Time    Tim
e     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
trying ftp://tug.ctan.org/pub/tex/historic/systems/texlive/2015/tlnet-final/archive/glyphlist.tar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0curl: (67) Access denied: 530
error: cannot download hyph-utf8.tar.xz from any mirror
builder for ‘/nix/store/w9rz6n1wrixby1mycs6fck0sywj8vz71-hyph-utf8.tar.xz.drv’ failed with exit code 1
building path(s) ‘/nix/store/4l2xs6chhhzsa23g796ypbm2734lv16v-hyphen-base.tar.xz’
cannot build derivation ‘/nix/store/v7hq3p4pqgy2b1g2knhy448l5hwn73sq-texlive-hyph-utf8-687.drv’: 1 dependencies couldn't be built
building path(s) ‘/nix/store/nmnggnvhi43z4mzh3v7m2jd4xa9227y1-texlive-scripts.tar.xz’
building path(s) ‘/nix/store/swaad1cc905fh3l5lb9hid74d7f1hzxc-times.tar.xz’
building path(s) ‘/nix/store/d9pvb1fvdm6l7ax8w3760calnz21f4dp-titlesec.tar.xz’
building path(s) ‘/nix/store/2fmwf45srfqi3bgg6629k7ns0062iq34-tools.tar.xz’
building path(s) ‘/nix/store/2icg1a4x23bs7w5y63rbxbcq09rl7m05-url.tar.xz’
building path(s) ‘/nix/store/wcqf6cdilc55v4bxlwf531f0mnik1r1x-wasysym.tar.xz’
building path(s) ‘/nix/store/22yfj7scwl6a9vvzk5i8k8x83252aiih-zapfding.tar.xz’
cannot build derivation ‘/nix/store/byhr95n2lq68pciq3npiqcf5xma20rfk-texlive-combined-2015.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/byhr95n2lq68pciq3npiqcf5xma20rfk-texlive-combined-2015.drv’ failed
/run/current-system/sw/bin/nix-shell: failed to build all dependencies
@peti
Copy link
Member

peti commented Sep 23, 2015

I just built dblatex on 0d0be13, and it downloaded and compiled everything just fine:

$ nix-build --no-out-link -A dblatex
/nix/store/wxmw9fmg8sxq3wvph3bmbyrik396hwzm-dblatex-0.3.7

@utdemir
Copy link
Member Author

utdemir commented Sep 23, 2015

It was giving me "Access denied", a little investigation revealed that some DOS protection mechanism on the servers was getting in my way. It's also weird that the two mirrors I tried had that exact behavior. Probably some default configuration on their FTP servers.

Giving -j 1(build-max-jobs) fixed the problem.

This is rather annoying that increasing build-max-jobs breaks something irrelevant like this, probably an option like "max. number of parallel requests per host" would be useful, but given the current implementation this is pretty hard to implement(I think).

I'm closing this issue, thanks @peti .

@utdemir utdemir closed this as completed Sep 23, 2015
@utdemir
Copy link
Member Author

utdemir commented Sep 23, 2015

Or, I'll just rephrase the issue as "Can't compile dblatex when build-max-jobs is 24".

Can we do anything about this?

@utdemir utdemir reopened this Sep 23, 2015
@vcunat vcunat changed the title Can't build "dblatex" texlive: mirroring is bad Sep 24, 2015
@vcunat
Copy link
Member

vcunat commented Sep 24, 2015

As I noted in #287, we would have to mirror it ourselves. TAN only decently mirrors the latest TeX Live packages, not yearly releases.

@vcunat
Copy link
Member

vcunat commented Sep 24, 2015

  • I now tested and both upstream URLs resolve to the same IP (v4), so switching is meaningless.
  • Dependencies and dblatex itself should get into binary cache soon – you reported just hour or two after I pushed it to master 9bd0bac.

@vcunat
Copy link
Member

vcunat commented Sep 24, 2015

probably an option like "max. number of parallel requests per host" would be useful

Maybe, but not all hosts behave the same, e.g. for cache.nixos.org we do want to utilize many more parallel requests. (At least for checking whether paths are in the cache, though there is a separate setting for that already, binary-caches-parallel-connections = 150.)

@vcunat
Copy link
Member

vcunat commented Sep 30, 2015

Now the generic URL doesn't work anymore but http://ftp.math.utah.edu still does (pushed commits to use that). I'm afraid they might be taking action as a result of nixpkgs causing lots of downloads from them, which might end up in this sole source being cut away in future.

I believe I still have the full archive on some computer if that happens (in nix store, after I was generating the hashes after unpacking).

@Mathnerd314
Copy link
Contributor

We could just update the package list daily-ish and use the CTAN mirror system; TeXLive holds back most of the updates to core packages, so at least the minimal set will work on old channel versions (and probably more).
One commit per day wouldn't be any more often than Haskell: https://github.com/NixOS/nixpkgs/commits/master?author=peti

@vcunat
Copy link
Member

vcunat commented Oct 10, 2015

I would prefer to avoid updating faster than once a year, perhaps except some important bug fixes.

Well, the core stuff should be mirrored by us already. I think the critical point was between committing and getting to channels (and hashed-mirror, perhaps), so we might be good in that already, but I haven't really checked, I think. There's also the advantage that the unpacked stuff is made fixed-output, so updates are no-op even if stdenv changes (except for the binaries, but those are small and from a single tarball).

@utdemir
Copy link
Member Author

utdemir commented Nov 15, 2015

It occured to me again:

curl: (7) Failed to connect to tug.org port 21: Connection timed out
error: cannot download texlive-20150521-source.tar.xz from any mirror

@vcunat
Copy link
Member

vcunat commented Apr 8, 2016

No working mirror anymore

Now the situation got much worse. The upstream package archive was recently overwritten by the final state of TeX Live 2015, so there is nowhere to download from, except for the packages that are in our binary cache (mainly the closure of texlive.combined.scheme-small). People will be getting broken hashes.

I suppose we would best import it all into our binary cache. Upstream just mirrors the daily-changing state and expects distros to solve anything else on their own. Even the unpacked packages are fixed-output derivations (by sha1); I found locally all packages required for running but not those with documentation or sources.

@edolstra: is it acceptable to mirror these at least? They're not too big:

$ nix-push --dest ~/texlive-cache/ (nix-build -Q -E 'with import ./. {}; lib.filter (p: p.tlType == "run") texlive.scheme-full.pkgs')
[...]
total compressed size 589.87 MiB, 34.4%

It's likely other users have the other types of packages as well. We all know the fixed hashes, so trust shouldn't be an issue in this step...

Any other ideas?

@edolstra
Copy link
Member

edolstra commented Apr 8, 2016

Hm, I tried mirroring to the tarball cache, but copy-tarballs.pl can't find any files to mirror:

$ DRY_RUN=1 ./maintainers/scripts/copy-tarballs.pl --expr 'with import ./. {}; lib.filter (p: p.tlType == "run") texlive.scheme-full.pkgs'
evaluation returned 0 tarballs
mirrored 0 files, already have 0 files

Uploading to the binary cache won't work very well, because the tarballs will probably get garbage-collected (not being referenced by a release).

@vcunat
Copy link
Member

vcunat commented Apr 8, 2016

The expression assumed you're in a nixpkgs tree. I assume that's the problem. Otherwise you can substitute with import <nixpkgs> {};.

@edolstra
Copy link
Member

edolstra commented Apr 8, 2016

The actual problem appears to be that the unpackPkg derivations don't include the source tarball as a derivation attribute, so find-tarballs can't find them.

@vcunat
Copy link
Member

vcunat commented Apr 8, 2016

Ah, well, I don't/didn't know how copy-tarballs.pl works. These would go to tarballs.nixos.org that is only checked by fetchurl and not during substitution, right? I now checked and I don't even have all these tarballs, only the unpacked and pruned /nix/store outputs.

@vcunat
Copy link
Member

vcunat commented Apr 8, 2016

Anyway, if someone has the tarballs, I composed:

These are fixed-output by their md5.

@vcunat
Copy link
Member

vcunat commented Apr 12, 2016

@edolstra: do you have those tarballs and can upload them? Or should we be searching for someone who has them?

@edolstra
Copy link
Member

No, I don't think so. I checked the old Hydra server (lucifer), hoping it still has them, but that's apparently not the case.

@vcunat
Copy link
Member

vcunat commented Apr 12, 2016

If noone here has a better idea, I suppose I'll post a question on the mailing-list to find if someone still has the original tarballs, as uploading them seems the easiest way to fix stuff including all old branches. (EDITed: readability)

@peti
Copy link
Member

peti commented Apr 12, 2016

I have the following ~3800 tarballs available at hydra.cryp.to: http://pastebin.com/Q8SEyr5P. It's not much, but I hope it helpls.

@edolstra
Copy link
Member

@peti Thanks! I'll try to use those.

@edolstra
Copy link
Member

@peti Trying to use hydra.cryp.to as binary cache gives:

Caught exception in Hydra::View::NARInfo->process "cannot open file ‘/etc/nix/hydra.cryp.to-1/secret’: Permission denied at /nix/store/5rrmjacsls56gjlgm0ydx85kbksnxfva-hydra-perl-deps/lib/perl5/site_perl/5.20.3/x86_64-linux-thread-multi/Nix/Utils.pm line 37."

@peti
Copy link
Member

peti commented Apr 12, 2016

Oops. I broke access to the key file when I fixed the uid collision between hydra and nscd a few weeks ago. It's fixed now.

@domenkozar
Copy link
Member

I'm also hitting this on 16.03, are there any workarounds until we have mirrored the old tarballs?

@michalrus
Copy link
Member

This is really unfortunate. 😿

@peti
Copy link
Member

peti commented May 4, 2016

@namore, please do.

@sorpaas
Copy link
Member

sorpaas commented May 8, 2016

@namore, can you share the commit? I'm in need of installing the texlive packages, which is apparently broken now.

@namore
Copy link
Contributor

namore commented May 11, 2016

@sorpaas, @peti, I pushed the commit to my fork [1]. I'm not sure if it contains all missing hashes, but the changes allow me to build texlive.combined.scheme-full.
[1] [https://github.com/namore/nixpkgs/commit/a07b7bb2637a97facae55cf8837c2a27ce1892ed]

peti pushed a commit that referenced this issue May 11, 2016
This commits mitigates #10026.
Thanks to @namore for contributing most of the update!
@peti
Copy link
Member

peti commented May 11, 2016

I've committed a (slightly modified) patch in 7abe192. These hashes get out of sync fast! I just hope that our source tarball mirroring works now or we'll have the exact same problem again in a couple of days.

@vcunat
Copy link
Member

vcunat commented May 11, 2016

I just hope that our source tarball mirroring works now

I don't think it works in this case: #10026 (comment)

BTW, over the long term, we might better use a combination of package versions as close as possible to what's released upstream, instead of a snapshot at some random moment.

@sorpaas
Copy link
Member

sorpaas commented May 11, 2016

Hi @namore, can you share the code you used to generate fixedHashes.nix?

@vcunat
Copy link
Member

vcunat commented May 11, 2016

Note: the source files in master contain shell fragments I used to get all the generated stuff. They're in comments at the point where the generated file is included from the rest.

@namore
Copy link
Contributor

namore commented May 12, 2016

@vcunat, I could not successfully use the commands in the comments and gave up trying after a while. I had the impression that they were out of date, but I may be wrong.
@sorpaas, the script I used to fix the hashes is as follows:

#!/bin/sh
set -u
set -e

function fh { sed -i "s/$1/$2/" pkgs.nix; }
function fh2 { sed -i "s/$1/$2/" fixedHashes.nix; }

TMP=`mktemp`
set +e
nix-env -f ~/nixpkgs --keep-going -i -A texlive.combined.scheme-full > $TMP 2>&1
cat $TMP >&2
set -e
grep '^output path.*md5 hash' $TMP |\
    awk '{ print $9 " " $7 }'|\
    sed -r 's/[‘’]//g' |\
    tee /dev/stderr |\
    while read f; do
        fh $f
    done
grep '^output path.*r:sha1 hash' $TMP |\
    awk '{ print $9 " " $7 }'|\
    sed -r 's/[‘’]//g' |\
    tee /dev/stderr |\
    while read f; do
        fh2 $f
    done
rm -f $TMP

I ran the script a few times until all hash related errors were resolved.

@vcunat
Copy link
Member

vcunat commented May 12, 2016

Well, yes, it is possible they changed the format of tlpdb.

barrucadu added a commit to barrucadu/nixfiles that referenced this issue May 26, 2016
Texlive is broken in nixos currently, see:

- NixOS/nixpkgs#15039
- NixOS/nixpkgs#10026

Best solution is to just locally copy things needed until this gets
fixed.
@vcunat
Copy link
Member

vcunat commented Jun 21, 2016

Interested parties can pre-test texlive-2016: #16391

@vcunat
Copy link
Member

vcunat commented Apr 6, 2017

Let's close this texlive 2015 discussion. Problems around mirroring the current 2016 version can be discussed on #24683.

@vcunat vcunat closed this as completed Apr 6, 2017
bhipple added a commit to bhipple/nixpkgs that referenced this issue May 20, 2018
This commit rebuilds texlive 2017 with the final release of 2017. As described
in these issues [1][2][3], the upstream CTAN mirrors are a continuously moving
rolling release without historical archives.

This particular FTP server is also a rolling release folling CTAN for the latest
version, but it has snapshots of the final texlive releases; it appears that the
2017 distribution has been unmodified since texlive-2018 was released earlier
this year.

Along the way, we needed to fix several issues:
- xindy: if $HOME is unset, it will try to mkdir /homeless-shelter, which fails
  due to insufficient permissions.
- scheme-infraonly: this scheme had symlinks into other releases that were
  read-only, so it couldn't patch and modify the scripts. This commit removes it
  for now, but that's not a particularly satisfying solution. Ideas?

This also adds some documentation on the upgrade process to prepare for
texlive-2018 [4].

This commit also replaces the sha1 hashes with upstream's standard sha512 hashes.
It appears the motivation for the shorter hashes was to save disk space in the
derivations; in master, the size of this directory is 1012K; in this commit it
is 1600K. The difference is not particularly large, and the downsides to using
our own sha1 hashes are:

- More nix code to maintain
- Multi-step upgrade process for maintainers: the maintainer first has to
  download all upstream tarballs by sha512 hash, then run the fix script, then
  rebuild with sha1 hashes.
- Less transparent. If we use the upstream sha512 hashes, any user can
  immediately verify that the hashes we're providing match upstream, or match
  the snapshot in time.
- Easier to debug. Since upstream is rolling and packages may disappear or fail
  to build, it's useful to be able to determine if the sha mismatch is because
  of an update or not; if we have a sha1 mismatch and no tarball to pull, we
  can't figure out which sha512sum would have produced that sha1.
- Less trust required. Due to the above, users don't have to trust the
  content-addressed mirrors on IPFS and @veprbl's servers as much.
- Easier to cobble together a source distribution from a variety of sources. It
  seems some FTP servers have more/less than others, or older/newer packages. If
  we know what we're looking for beforehand and we're just missing a few
  packages whose hashes match the advertised hashes upstream, it's easier to find.

[1] NixOS#24683
[2] NixOS#10026
[3] NixOS#34490
[4] NixOS#40232
xeji pushed a commit to bhipple/nixpkgs that referenced this issue Aug 9, 2018
This commit rebuilds texlive 2017 with the final release of 2017. As described
in these issues [1][2][3], the upstream CTAN mirrors are a continuously moving
rolling release without historical archives.

This particular FTP server is also a rolling release folling CTAN for the latest
version, but it has snapshots of the final texlive releases; it appears that the
2017 distribution has been unmodified since texlive-2018 was released earlier
this year.

Along the way, we needed to fix several issues:
- xindy: if $HOME is unset, it will try to mkdir /homeless-shelter, which fails
  due to insufficient permissions.
- scheme-infraonly: this scheme had symlinks into other releases that were
  read-only, so it couldn't patch and modify the scripts. This commit removes it
  for now, but that's not a particularly satisfying solution. Ideas?

This also adds some documentation on the upgrade process to prepare for
texlive-2018 [4].

This commit also replaces the sha1 hashes with upstream's standard sha512 hashes.
It appears the motivation for the shorter hashes was to save disk space in the
derivations; in master, the size of this directory is 1012K; in this commit it
is 1600K. The difference is not particularly large, and the downsides to using
our own sha1 hashes are:

- More nix code to maintain
- Multi-step upgrade process for maintainers: the maintainer first has to
  download all upstream tarballs by sha512 hash, then run the fix script, then
  rebuild with sha1 hashes.
- Less transparent. If we use the upstream sha512 hashes, any user can
  immediately verify that the hashes we're providing match upstream, or match
  the snapshot in time.
- Easier to debug. Since upstream is rolling and packages may disappear or fail
  to build, it's useful to be able to determine if the sha mismatch is because
  of an update or not; if we have a sha1 mismatch and no tarball to pull, we
  can't figure out which sha512sum would have produced that sha1.
- Less trust required. Due to the above, users don't have to trust the
  content-addressed mirrors on IPFS and @veprbl's servers as much.
- Easier to cobble together a source distribution from a variety of sources. It
  seems some FTP servers have more/less than others, or older/newer packages. If
  we know what we're looking for beforehand and we're just missing a few
  packages whose hashes match the advertised hashes upstream, it's easier to find.

[1] NixOS#24683
[2] NixOS#10026
[3] NixOS#34490
[4] NixOS#40232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.