diff --git a/scripts/replace-tar-coreutils-for-build.sh b/scripts/replace-tar-coreutils-for-build.sh
index 076ae44da04383ef33330f8fac26b2e809f4db62..82365af9338eb3fa245ab4bf0fbead08154dd08f 100755
--- a/scripts/replace-tar-coreutils-for-build.sh
+++ b/scripts/replace-tar-coreutils-for-build.sh
@@ -3,6 +3,7 @@ set -e
 
 cp /bin/rm /bin/tar /usr/local/bin
 apt-get update
-apt-get -y install coreutils tar
+DPKGPATH=/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+apt-get -y -o Dpkg::Path="$DPKGPATH" install coreutils tar
 rm /usr/local/bin/rm /usr/local/bin/tar