diff --git a/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-livepxe-rootfs.sh b/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-livepxe-rootfs.sh index 0bc4e893bc..483587efa5 100755 --- a/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-livepxe-rootfs.sh +++ b/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-livepxe-rootfs.sh @@ -34,20 +34,24 @@ elif [[ -n "${rootfs_url}" ]]; then # First, reach out to the server to verify connectivity before # trying to download and pipe content through other programs. # Doing this allows us to retry all errors (including transient - # "no route to host" errors during startup), without using the - # --retry-all-errors, which is problematic (see curl man page) - # when piping the output. - curl_common_args="--silent --show-error --insecure --location --retry 5" - if ! curl --head --retry-all-errors $curl_common_args "${rootfs_url}" >/dev/null; then + # "no route to host" errors during startup). Note we can't use + # curl's --retry-all-errors here because it's not in el8's curl yet. + # We retry forever, matching Ignition's semantics. + curl_common_args="--silent --show-error --insecure --location" + while ! curl --head $curl_common_args "${rootfs_url}" >/dev/null; do echo "Couldn't establish connectivity with the server specified by coreos.live.rootfs_url=" >&2 - echo "Check that the URL is correct and can be reached." >&2 - exit 1 - fi + echo "Retrying in 5s..." >&2 + sleep 5 + done + # We don't need to verify TLS certificates because we're checking the # image hash. # bsdtar can read cpio archives and we already depend on it for # coreos-liveiso-persist-osmet.service, so use it instead of cpio. - if ! curl $curl_common_args "${rootfs_url}" | \ + # We shouldn't need a --retry here since we've just successfully HEADed the + # file, but let's add one just to be safe (e.g. if the connection just went + # online and flickers or something). + if ! curl $curl_common_args --retry 5 "${rootfs_url}" | \ rdcore stream-hash /etc/coreos-live-want-rootfs | \ bsdtar -xf - -C / ; then echo "Couldn't fetch, verify, and unpack image specified by coreos.live.rootfs_url=" >&2