diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 896b2858e8e3da0ac615f5f349c8cf97baf9b077..3999b645b1ac6848867944ffb36ea3ce2fe14dc4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -456,6 +456,7 @@ test-cabal-reinstall-x86_64-linux-deb10:
     TEST_ENV: "x86_64-linux-deb10-cabal-install"
   rules:
     - if: $NIGHTLY
+    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*test-reinstall.*/'
 
 ########################################
 # Testing ABI is invariant across builds
diff --git a/cabal.project-reinstall b/cabal.project-reinstall
index 1886bcb29787259b29e69d04f0be45194221c8f1..181efe48a61811909d709d2a0cf7bde487556c97 100644
--- a/cabal.project-reinstall
+++ b/cabal.project-reinstall
@@ -12,7 +12,7 @@ packages: ./compiler
           -- ./libraries/deepseq/
           ./libraries/directory/
           ./libraries/exceptions/
-          -- ./libraries/filepath/
+          ./libraries/filepath/
           -- ./libraries/ghc-bignum/
            ./libraries/ghc-boot/
           -- ./libraries/ghc-boot-th/
@@ -55,7 +55,6 @@ constraints: ghc +internal-interpreter +dynamic-system-linke,
              any.array installed,
              any.base installed,
              any.deepseq installed,
-             any.filepath installed,
              any.ghc-bignum installed,
              any.ghc-boot-th installed,
              any.integer-gmp installed,
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
index 4373ee7b75d106d8343f1e2183a4b1e31a215bdf..98cc71dde2d8a26aa576a1512be174322dae7eaf 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -39,7 +39,7 @@ extra-source-files:
 
 
 custom-setup
-    setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.9, directory, process, filepath
+    setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.10, directory, process, filepath
 
 Flag internal-interpreter
     Description: Build with internal interpreter support.
diff --git a/hadrian/src/Rules/CabalReinstall.hs b/hadrian/src/Rules/CabalReinstall.hs
index c34362171a8e155a756a84211fc81ed43178fd98..2bfc8f92b07c2d9200a278da19e622f7c35c9a82 100644
--- a/hadrian/src/Rules/CabalReinstall.hs
+++ b/hadrian/src/Rules/CabalReinstall.hs
@@ -11,6 +11,7 @@ import qualified System.Directory.Extra as IO
 import Data.Either
 import Rules.BinaryDist
 import Hadrian.Haskell.Cabal (pkgIdentifier)
+import Oracles.Setting
 
 {-
 Note [Testing reinstallable GHC]
@@ -26,18 +27,11 @@ The libdir of the reinstalled GHC points to the libdir of the stage 2 compiler (
 cabalExcludedPackages :: [Package]
 cabalExcludedPackages = [array, base, deepseq, filepath, ghcBignum, ghcBootTh, ghcPrim, integerGmp, integerSimple, pretty, templateHaskell]
 
-findCabalPackageDb :: String -> FilePath
-findCabalPackageDb env = go $ map (\l -> (words l, l)) (lines env)
-  where
-    go [] = error $ "Couldn't find installed package db in " ++ show env
-    go (("package-db":_, l):_) = drop 11 l
-    go (_:xs) = go xs
-
 
 cabalBuildRules :: Rules ()
 cabalBuildRules = do
     root <- buildRootRules
-    root -/- "stage-cabal" -/- "cabal-packages" %> \_ -> do
+    root -/- "stage-cabal" -/- "cabal-packages" %> \outpath -> do
       -- Always rerun to pass onto cabal's own recompilation logic
       alwaysRerun
       all_pkgs <- stagePackages Stage1
@@ -45,6 +39,7 @@ cabalBuildRules = do
         withVerbosity Diagnostic $
           buildWithCmdOptions [] $
             target (vanillaContext Stage2 pkg) (Cabal Install Stage2) [] []
+      liftIO $ writeFile outpath "done"
 
     phony "build-cabal" $ need [root -/- "stage-cabal" -/- "bin" -/- ".stamp"]
 
@@ -73,8 +68,11 @@ cabalBuildRules = do
         createDirectory outputDir
 
         need [root -/- "stage-cabal" -/- "cabal-packages"]
-        env <- liftIO $ readFile $ root -/- "stage-cabal" -/- "cabal-packages"
-        let cabal_package_db = findCabalPackageDb env
+
+        cwd <- liftIO $ IO.getCurrentDirectory
+        version        <- setting ProjectVersion
+
+        let cabal_package_db = cwd -/- root -/- "stage-cabal" -/- "dist-newstyle" -/- "packagedb" -/- "ghc-" ++ version
 
         forM_ (filter ((/= iserv) . fst) bin_targets) $ \(bin_pkg,_bin_path) -> do
             let pgmName pkg
diff --git a/hadrian/src/Settings/Builders/Cabal.hs b/hadrian/src/Settings/Builders/Cabal.hs
index 03e1f1c5ac7894af6ebf2d53a42055e8bad234cb..2e421857e5074bc0de8f8a7ce0b6dc0a6f4d3954 100644
--- a/hadrian/src/Settings/Builders/Cabal.hs
+++ b/hadrian/src/Settings/Builders/Cabal.hs
@@ -27,9 +27,10 @@ cabalInstallArgs = builder (Cabal Install) ?  do
         | otherwise     = pkgName pkg
   assertNoBuildRootLeak $
     mconcat [ arg $ "--store-dir="   ++ (root -/- "stage-cabal" -/- "cabal-store")
-            , arg "install"
-            , if isProgram pkg then arg $ "exe:" ++ pgmName else mconcat [arg "--lib", arg $ pkgName pkg]
+            , if isProgram pkg then arg "install" else arg "build"
+            , if isProgram pkg then (arg $ "exe:" ++ pgmName) else (arg $ pkgName pkg)
             , commonReinstallCabalArgs
+            , if isProgram pkg then extraInstallArgs else mempty
             ]
 
 -- | Checks that _build/stageN/lib/* doesn't leak into the arguments for
@@ -45,6 +46,13 @@ assertNoBuildRootLeak args = do
                                        | libPath <- libPaths]) xs)
                 xs
 
+extraInstallArgs :: Args
+extraInstallArgs = do
+    root      <- getBuildRoot
+    mconcat [ arg $ "--install-method=copy"
+            , arg $ "--overwrite-policy=always"
+            , arg $ "--installdir="  ++ (root -/- "stage-cabal" -/- "cabal-bin") ]
+
 commonReinstallCabalArgs :: Args
 commonReinstallCabalArgs = do
     top       <- expr topDirectory
@@ -56,12 +64,7 @@ commonReinstallCabalArgs = do
             , arg $ top -/- "cabal.project-reinstall"
             , arg "--distdir"
             , arg $ root -/- "stage-cabal" -/- "dist-newstyle"
-            , arg ("--ghc-option=-j" ++ show threads)
-            , arg $ "--install-method=copy"
-            , arg $ "--overwrite-policy=always"
             , arg $ "--with-compiler=" ++ top -/- compiler
-            , arg $ "--installdir="  ++ (root -/- "stage-cabal" -/- "cabal-bin")
-            , arg $ "--package-env=" ++ (root -/- "stage-cabal" -/- "cabal-packages")
             , arg "--enable-executable-dynamic"
             , arg "--enable-library-vanilla"
             ]
diff --git a/libraries/ghc-boot/ghc-boot.cabal.in b/libraries/ghc-boot/ghc-boot.cabal.in
index 0b1569c9cf8344c847cc67c9cbf4d3dd5d4b4560..990f7d3adf73ae4e9f1f51c1ebcbf07bf84eb537 100644
--- a/libraries/ghc-boot/ghc-boot.cabal.in
+++ b/libraries/ghc-boot/ghc-boot.cabal.in
@@ -28,7 +28,7 @@ build-type:     Custom
 extra-source-files: changelog.md
 
 custom-setup
-    setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.9, directory, filepath
+    setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.10, directory, filepath
 
 source-repository head
     type:     git
diff --git a/linters/lint-commit-msg/lint-commit-msg.cabal b/linters/lint-commit-msg/lint-commit-msg.cabal
index 8020a925a4973c9bddbbfbfeb375f2ba2617c50c..7d1dbd0fcb24ab0f061c3db9d14ca8ca2bf192ca 100644
--- a/linters/lint-commit-msg/lint-commit-msg.cabal
+++ b/linters/lint-commit-msg/lint-commit-msg.cabal
@@ -22,7 +22,7 @@ executable lint-commit-msg
   build-depends:
     linters-common,
     mtl
-      >=2.1 && <2.3,
+      >=2.1 && <2.4,
     base
        >= 4.14 && < 5,
     text
diff --git a/linters/lint-whitespace/lint-whitespace.cabal b/linters/lint-whitespace/lint-whitespace.cabal
index e3d2aa3a06c2237d064aa54ec7434afd32f5841a..61e376d1f96ef3faa857735e173ad9eb6d03966b 100644
--- a/linters/lint-whitespace/lint-whitespace.cabal
+++ b/linters/lint-whitespace/lint-whitespace.cabal
@@ -20,7 +20,7 @@ executable lint-whitespace
   build-depends:
     linters-common,
     mtl
-      >=2.1 && <2.3,
+      >=2.1 && <2.4,
     process
       ^>= 1.6,
     containers