package: debootstrap version: 1.0.28 severity: important tags: patch debootstrap's current download error handling isn't very robust. It declares success just for the presence of a downloaded file, which may be a partial download, or one for which the checksum doesn't match. Eventually those conditions will lead to unhandled failures elsewhere within debootstrap.
This can make d-i very rocky on certain mirrors since one bad package download ultimately lead to a complete failure of the debootstrap process, and thus a failed install. An expert can recover from this, but an average user will get rather frustrated (especially since the dialogs for debootstrap errors are rather confusing). It may also be useful to expand a bit on these d-i debootstrap error messages: when an error happens, the right answer that the user wants is to hit 'go back' twice in a row to start the debootstrap all over again, but the dialogs are confusing, and 'continue' seems to be the obvious choice, but that will lead to the broken debootstrap continuing to completion with various brokenness. Anyway, that maybe should be submitted as another bug. So, back to the original issue, I've created a patch that will retry downloads whenever anything in the "get" routine fails, which I believe is much more robust than the current situation. Please see attached patch. Best wishes, Mike
--- newhd/source/debootstrap-1.0.28/functions 2011-02-21 19:25:08.000000000 -0500 +++ /usr/share/debootstrap/functions 2011-03-19 10:58:57.000000000 -0400 @@ -1,3 +1,5 @@ +MAXATTEMPTS="10" + ############################################################### smallutils smallyes() { @@ -241,6 +243,13 @@ } get () { + for iters in $(seq 1 $MAXATTEMPTS); do + if single_get "$@"; then break; fi + warning RETRYING "Retrying failed download." + done +} + +single_get () { # args: from dest 'nocache' # args: from dest [checksum size] [alt {checksum size type}] local displayname @@ -331,13 +340,6 @@ # http/ftp mirror if wgetprogress -O "$dest" "$from"; then return 0 - elif [ -s "$dest" ]; then - local iters=0 - while [ "$iters" -lt 3 ]; do - warning RETRYING "Retrying failed download of %s" "$from" - if wgetprogress -c -O "$dest" "$from"; then break; fi - iters="$(($iters + 1))" - done else rm -f "$dest" return 1 @@ -346,13 +348,6 @@ # http/ftp mirror if wgetprogress $CHECKCERTIF $CERTIFICATE $PRIVATEKEY -O "$dest" "$from"; then return 0 - elif [ -s "$dest" ]; then - local iters=0 - while [ "$iters" -lt 3 ]; do - warning RETRYING "Retrying failed download of %s" "$from" - if wgetprogress $CHECKCERTIF $CERTIFICATE $PRIVATEKEY -c -O "$dest" "$from"; then break; fi - iters="$(($iters + 1))" - done else rm -f "$dest" return 1