diff --git a/.buildkite/postgres-config.yaml b/.buildkite/postgres-config.yaml
index 2acbe66f4caf1864e81bbf0317c0c267d3a88d15..67e17fa9d1de49cd13f220652825fd2856e7fdd5 100644
--- a/.buildkite/postgres-config.yaml
+++ b/.buildkite/postgres-config.yaml
@@ -3,7 +3,7 @@
 # CI's Docker setup at the point where this file is considered.
 server_name: "localhost:8800"
 
-signing_key_path: "/src/.buildkite/test.signing.key"
+signing_key_path: ".buildkite/test.signing.key"
 
 report_stats: false
 
@@ -16,6 +16,4 @@ database:
     database: synapse
 
 # Suppress the key server warning.
-trusted_key_servers:
-  - server_name: "matrix.org"
-suppress_key_server_warning: true
+trusted_key_servers: []
diff --git a/.buildkite/scripts/test_synapse_port_db.sh b/.buildkite/scripts/test_synapse_port_db.sh
index a7e2454769374cd9fa5a18d92682961dc46c3723..82d7d56d4e9fa3b9f9418a4aa2b6fa7d58f15914 100755
--- a/.buildkite/scripts/test_synapse_port_db.sh
+++ b/.buildkite/scripts/test_synapse_port_db.sh
@@ -33,6 +33,10 @@ scripts-dev/update_database --database-config .buildkite/sqlite-config.yaml
 echo "+++ Run synapse_port_db against test database"
 coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml
 
+# We should be able to run twice against the same database.
+echo "+++ Run synapse_port_db a second time"
+coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml
+
 #####
 
 # Now do the same again, on an empty database.
diff --git a/.buildkite/sqlite-config.yaml b/.buildkite/sqlite-config.yaml
index 6d9bf80d844b2828a4947e59bb60137edcedfd22..d16459cfd9473eccd037297da775b26e050d13d6 100644
--- a/.buildkite/sqlite-config.yaml
+++ b/.buildkite/sqlite-config.yaml
@@ -3,7 +3,7 @@
 # schema and run background updates on it.
 server_name: "localhost:8800"
 
-signing_key_path: "/src/.buildkite/test.signing.key"
+signing_key_path: ".buildkite/test.signing.key"
 
 report_stats: false
 
@@ -13,6 +13,4 @@ database:
     database: ".buildkite/test_db.db"
 
 # Suppress the key server warning.
-trusted_key_servers:
-  - server_name: "matrix.org"
-suppress_key_server_warning: true
+trusted_key_servers: []
diff --git a/changelog.d/9991.bugfix b/changelog.d/9991.bugfix
new file mode 100644
index 0000000000000000000000000000000000000000..665ff04dea846358314506ab5179a705171b8027
--- /dev/null
+++ b/changelog.d/9991.bugfix
@@ -0,0 +1 @@
+Fix a bug introduced in v1.26.0 which meant that `synapse_port_db` would not correctly initialise some postgres sequences, requiring manual updates afterwards.
diff --git a/scripts/synapse_port_db b/scripts/synapse_port_db
index 7c7645c05a63b7a8d0eca28faf370263df43879e..86eb76cbca7ab8e3620980f5a3daf710b59809ac 100755
--- a/scripts/synapse_port_db
+++ b/scripts/synapse_port_db
@@ -959,7 +959,7 @@ class Porter(object):
         def r(txn):
             txn.execute(
                 "ALTER SEQUENCE event_auth_chain_id RESTART WITH %s",
-                (curr_chain_id,),
+                (curr_chain_id + 1,),
             )
 
         if curr_chain_id is not None: