diff --git a/scripts/utils.py b/scripts/utils.py
index a4dd12e..4aa4468 100644
--- a/scripts/utils.py
+++ b/scripts/utils.py
@@ -506,6 +506,7 @@ def setup_tools_tarball(ourconfig, btdir, bttarball, name="buildtools"):
         # previous build.  tarball_updated is set to True whenever the cached
         # download is replaced, which triggers removal of the stale btdir.
         tarball_updated = False
+        tarball_timeout = time.monotonic() + 300  # 5 min, tune as needed
         while True:
             try:
                 with open(btlock, 'a+') as lf:
@@ -548,7 +549,10 @@ def setup_tools_tarball(ourconfig, btdir, bttarball, name="buildtools"):
                 break
             except OSError:
                 # We raced with someone else, try again
-                pass
+                if time.monotonic() > tarball_timeout:
+                    raise
+                time.sleep(1)
+
         # If the underlying tarball changed, remove any stale extraction
         # directory so it is re-extracted below.
         if tarball_updated and os.path.exists(btdir):
