diff --git a/base/database/dbmodule/db.go b/base/database/dbmodule/db.go
index fc36cba0..e975355b 100644
--- a/base/database/dbmodule/db.go
+++ b/base/database/dbmodule/db.go
@@ -5,7 +5,6 @@ import (
 	"sync/atomic"
 
 	"github.com/safing/portmaster/base/database"
-	"github.com/safing/portmaster/base/dataroot"
 	"github.com/safing/portmaster/base/utils"
 	"github.com/safing/portmaster/service/mgr"
 )
@@ -36,13 +35,7 @@ func SetDatabaseLocation(dirStructureRoot *utils.DirStructure) {
 	}
 }
 
-// GetDatabaseLocation returns the initialized database location.
-func GetDatabaseLocation() string {
-	return databaseStructureRoot.Path
-}
-
 func prep() error {
-	SetDatabaseLocation(dataroot.Root())
 	if databaseStructureRoot == nil {
 		return errors.New("database location not specified")
 	}
diff --git a/base/database/main.go b/base/database/main.go
index 9c9aa1ed..cbf2460c 100644
--- a/base/database/main.go
+++ b/base/database/main.go
@@ -9,9 +9,8 @@ import (
 	"github.com/safing/portmaster/base/utils"
 )
 
-const (
-	databasesSubDir = "databases"
-)
+// DatabasesSubDir defines the sub directory where the databases are stored.
+const DatabasesSubDir = "databases"
 
 var (
 	initialized = abool.NewBool(false)
@@ -34,7 +33,7 @@ func Initialize(dirStructureRoot *utils.DirStructure) error {
 		rootStructure = dirStructureRoot
 
 		// ensure root and databases dirs
-		databasesStructure = rootStructure.ChildDir(databasesSubDir, utils.AdminOnlyPermission)
+		databasesStructure = rootStructure.ChildDir(DatabasesSubDir, utils.AdminOnlyPermission)
 		err := databasesStructure.Ensure()
 		if err != nil {
 			return fmt.Errorf("could not create/open database directory (%s): %w", rootStructure.Path, err)
diff --git a/service/core/base/databases.go b/service/core/base/databases.go
index 98c587a1..68e7819b 100644
--- a/service/core/base/databases.go
+++ b/service/core/base/databases.go
@@ -4,8 +4,8 @@ import (
 	"path/filepath"
 
 	"github.com/safing/portmaster/base/database"
-	"github.com/safing/portmaster/base/database/dbmodule"
 	_ "github.com/safing/portmaster/base/database/storage/bbolt"
+	"github.com/safing/portmaster/base/dataroot"
 	"github.com/safing/portmaster/base/utils"
 )
 
@@ -17,7 +17,7 @@ var (
 func registerDatabases() error {
 	// If there is an existing bbolt core database, use it instead.
 	coreStorageType := DefaultDatabaseStorageType
-	if utils.PathExists(filepath.Join(dbmodule.GetDatabaseLocation(), "core", "bbolt")) {
+	if utils.PathExists(filepath.Join(dataroot.Root().Path, database.DatabasesSubDir, "core", "bbolt")) {
 		coreStorageType = "bbolt"
 	}
 
@@ -33,7 +33,7 @@ func registerDatabases() error {
 
 	// If there is an existing cache bbolt database, use it instead.
 	cacheStorageType := DefaultDatabaseStorageType
-	if utils.PathExists(filepath.Join(dbmodule.GetDatabaseLocation(), "cache", "bbolt")) {
+	if utils.PathExists(filepath.Join(dataroot.Root().Path, database.DatabasesSubDir, "cache", "bbolt")) {
 		cacheStorageType = "bbolt"
 	}
 
diff --git a/service/core/base/global.go b/service/core/base/global.go
index fa67048f..fbc81dcd 100644
--- a/service/core/base/global.go
+++ b/service/core/base/global.go
@@ -6,6 +6,7 @@ import (
 	"fmt"
 
 	"github.com/safing/portmaster/base/api"
+	"github.com/safing/portmaster/base/database/dbmodule"
 	"github.com/safing/portmaster/base/dataroot"
 	"github.com/safing/portmaster/base/info"
 	"github.com/safing/portmaster/base/utils"
@@ -59,6 +60,9 @@ func prep(instance instance) error {
 		if err != nil {
 			return err
 		}
+
+		// Set root dir for the databases.
+		dbmodule.SetDatabaseLocation(dataroot.Root())
 	}
 
 	// set api listen address