diff --git a/core/lib/Drupal/Core/Extension/Extension.php b/core/lib/Drupal/Core/Extension/Extension.php
index 3c765fe..e1e9b3d 100644
--- a/core/lib/Drupal/Core/Extension/Extension.php
+++ b/core/lib/Drupal/Core/Extension/Extension.php
@@ -166,8 +166,9 @@ public function __call($method, array $args) {
    * Serializes the Extension object in the most optimized way.
    */
   public function serialize() {
+    // Don't serialize the app root, since this could change if the install is
+    // moved..
     $data = array(
-      'root' => $this->root,
       'type' => $this->type,
       'pathname' => $this->pathname,
       'filename' => $this->filename,
@@ -188,7 +189,8 @@ public function serialize() {
    */
   public function unserialize($data) {
     $data = unserialize($data);
-    $this->root = $data['root'];
+    // Get the app root from the container.
+    $this->root = DRUPAL_ROOT;
     $this->type = $data['type'];
     $this->pathname = $data['pathname'];
     $this->filename = $data['filename'];
diff --git a/core/lib/Drupal/Core/Update/UpdateKernel.php b/core/lib/Drupal/Core/Update/UpdateKernel.php
index 6c5de73..04c4668 100755
--- a/core/lib/Drupal/Core/Update/UpdateKernel.php
+++ b/core/lib/Drupal/Core/Update/UpdateKernel.php
@@ -10,10 +10,13 @@
 use Drupal\Core\DrupalKernel;
 use Drupal\Core\Session\AnonymousUserSession;
 use Drupal\Core\Site\Settings;
+use Drupal\system\Tests\Routing\MockRouteProvider;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 use Symfony\Component\HttpFoundation\ParameterBag;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
+use Symfony\Component\Routing\Route;
+use Symfony\Component\Routing\RouteCollection;
 
 /**
  * Defines a kernel which is used primarily to run the update of Drupal.
@@ -57,6 +60,26 @@ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch =
   }
 
   /**
+   * {@inheritdoc}
+   */
+  protected function initializeContainer() {
+    $container = parent::initializeContainer();
+
+    $routes = new RouteCollection();
+
+    $routes->add('<front>', new Route('/', ['_title' => 'Home'], ['_access' => 'TRUE']));
+    $routes->add('<none>', new Route('', [], ['_access' => 'TRUE'], ['_no_path' => TRUE]));
+    $routes->add('<current>', new Route('<current>'));
+    $routes->add('system.db_update', new Route('/update.php/{op}', ['op' => 'info'], ['_access' => 'TRUE']));
+
+    $mock_route_provider = new MockRouteProvider($routes);
+    $container->set('@router.route_provider', $mock_route_provider);
+
+    return $container;
+  }
+
+
+  /**
    * Generates the actual result of update.php.
    *
    * The actual logic of the update is done in the db update controller.
diff --git a/core/modules/block/src/Tests/Update/BlockContextMappingUpdateTest.php b/core/modules/block/src/Tests/Update/BlockContextMappingUpdateTest.php
index da03fa0..582a8e1 100644
--- a/core/modules/block/src/Tests/Update/BlockContextMappingUpdateTest.php
+++ b/core/modules/block/src/Tests/Update/BlockContextMappingUpdateTest.php
@@ -32,7 +32,10 @@ protected function setUp() {
     $this->databaseDumpFiles = [
       __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
       __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php',
+      __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.language-enabled.php',
+      __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.block-test-enabled.php',
     ];
+
     parent::setUp();
   }
 
diff --git a/core/modules/system/src/Controller/DbUpdateController.php b/core/modules/system/src/Controller/DbUpdateController.php
index 28ab72b..cde11f7 100644
--- a/core/modules/system/src/Controller/DbUpdateController.php
+++ b/core/modules/system/src/Controller/DbUpdateController.php
@@ -210,9 +210,7 @@ protected function info(Request $request) {
     );
 
     $info[] = $this->t("<strong>Back up your code</strong>. Hint: when backing up module code, do not leave that backup in the 'modules' or 'sites/*/modules' directories as this may confuse Drupal's auto-discovery mechanism.");
-    $info[] = $this->t('Put your site into <a href="@url">maintenance mode</a>.', array(
-      '@url' => Url::fromRoute('system.site_maintenance_mode')->toString(TRUE)->getGeneratedUrl(),
-    ));
+    $info[] = $this->t('Put your site into maintenance mode.');
     $info[] = $this->t('<strong>Back up your database</strong>. This process will change your database values and in case of emergency you may need to revert to a backup.');
     $info[] = $this->t('Install your new files in the appropriate location, as described in the handbook.');
     $build['info'] = array(
@@ -228,7 +226,7 @@ protected function info(Request $request) {
       '#type' => 'link',
       '#title' => $this->t('Continue'),
       '#attributes' => array('class' => array('button', 'button--primary')),
-      '#url' => Url::fromUri($request->getUriForPath('/selection')),
+      '#url' => Url::fromUri('base://selection'),
     );
     return $build;
   }
@@ -484,7 +482,7 @@ protected function results(Request $request) {
    */
   public function requirements($severity, array $requirements, Request $request) {
     $options = $severity == REQUIREMENT_WARNING ? array('continue' => 1) : array();
-    $try_again_url = Url::fromUri($request->getUriForPath(''))->setOptions(['query' => $options])->toString(TRUE)->getGeneratedUrl();
+    $try_again_url = Url::fromUri('base://')->setOptions(['query' => $options])->toString(TRUE)->getGeneratedUrl();
 
     $build['status_report'] = array(
       '#theme' => 'status_report',
@@ -580,7 +578,7 @@ protected function triggerBatch(Request $request) {
     );
     batch_set($batch);
 
-    return batch_process(Url::fromUri($request->getUriForPath('/results')), Url::fromUri($request->getUriForPath('/start')));
+    return batch_process(Url::fromUri('base://results'), Url::fromUri('base://start'));
   }
 
   /**
diff --git a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
index d3d103d..dd22488 100644
--- a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
+++ b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
@@ -173,9 +173,6 @@ protected function setUp() {
     // Add the config directories to settings.php.
     drupal_install_config_directories();
 
-    // Install any additional modules.
-    $this->installModulesFromClassProperty($container);
-
     // Restore the original Simpletest batch.
     $this->restoreBatch();
 
@@ -183,6 +180,7 @@ protected function setUp() {
     $this->rebuildAll();
 
     // Replace User 1 with the user created here.
+    // @todo: do this without saving the user account.
     /** @var \Drupal\user\UserInterface $account */
     $account = User::load(1);
     $account->setPassword($this->rootUser->pass_raw);
@@ -260,7 +258,9 @@ protected function rebuildAll() {
     // We know the rebuild causes notices, so don't exit on failure.
     $die_on_fail = $this->dieOnFail;
     $this->dieOnFail = FALSE;
-    parent::rebuildAll();
+
+    // Initialize the container. parent::rebuildall() is not safe to call here.
+    $this->container = \Drupal::getContainer();
 
     // Remove the notices we get due to the menu link rebuild prior to running
     // the system updates for the schema change.
diff --git a/core/modules/system/src/Tests/Update/UpdatePathTestBaseTest.php b/core/modules/system/src/Tests/Update/UpdatePathTestBaseTest.php
index fb01ecf..fa2b96b 100644
--- a/core/modules/system/src/Tests/Update/UpdatePathTestBaseTest.php
+++ b/core/modules/system/src/Tests/Update/UpdatePathTestBaseTest.php
@@ -25,7 +25,10 @@ class UpdatePathTestBaseTest extends UpdatePathTestBase {
    * {@inheritdoc}
    */
   protected function setUp() {
-    $this->databaseDumpFiles = [__DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz'];
+    $this->databaseDumpFiles = [
+      __DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz',
+      __DIR__ . '/../../../tests/fixtures/update/drupal-8.update-test-schema-enabled.php',
+    ];
     parent::setUp();
   }
 
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index ce06b7a..653cb5a 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -1265,6 +1265,9 @@ function system_update_8004() {
   // ensure they match the currently expected status.
   $manager = \Drupal::entityDefinitionUpdateManager();
   foreach (array_keys(\Drupal::entityManager()->getDefinitions()) as $entity_type_id) {
+    if (is_null($manager->getEntityType($entity_type_id))) {
+      $manager->getEntityType($entity_type_id);
+    }
     $manager->updateEntityType($manager->getEntityType($entity_type_id));
   }
 }
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 865e101..e07fa56 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -249,7 +249,7 @@ function system_theme_suggestions_html(array $variables) {
     $path_args = [''];
   }
   else {
-    $path_args = explode('/', Url::fromRoute('<current>')->getInternalPath());
+    $path_args = explode('/', ltrim(\Drupal::service('path.current')->getPath(), '/'));
   }
   return theme_get_suggestions($path_args, 'html');
 }
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.block-test-enabled.php b/core/modules/system/tests/fixtures/update/drupal-8.block-test-enabled.php
new file mode 100644
index 0000000..d26b379
--- /dev/null
+++ b/core/modules/system/tests/fixtures/update/drupal-8.block-test-enabled.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * @file
+ * Partial database to mimic the installation of the update_test_schema module.
+ */
+
+use Drupal\Core\Database\Database;
+
+$connection = Database::getConnection();
+
+// Set the schema version.
+$connection->insert('key_value')
+  ->fields([
+    'collection' => 'system.schema',
+    'name' => 'block_test',
+    'value' => 'i:8000;',
+  ])
+  ->execute();
+
+// Update core.extension.
+$extensions = $connection->select('config')
+  ->fields('config', ['data'])
+  ->condition('collection', '')
+  ->condition('name', 'core.extension')
+  ->execute()
+  ->fetchField();
+$extensions = unserialize($extensions);
+$extensions['module']['block_test'] = 8000;
+$connection->update('config')
+  ->fields([
+    'data' => serialize($extensions),
+  ])
+  ->condition('collection', '')
+  ->condition('name', 'core.extension')
+  ->execute();
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.language-enabled.php b/core/modules/system/tests/fixtures/update/drupal-8.language-enabled.php
new file mode 100644
index 0000000..2306ade
Binary files /dev/null and b/core/modules/system/tests/fixtures/update/drupal-8.language-enabled.php differ
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.update-test-schema-enabled.php b/core/modules/system/tests/fixtures/update/drupal-8.update-test-schema-enabled.php
new file mode 100644
index 0000000..16042a4
--- /dev/null
+++ b/core/modules/system/tests/fixtures/update/drupal-8.update-test-schema-enabled.php
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * @file
+ * Partial database to mimic the installation of the update_test_schema module.
+ */
+
+use Drupal\Core\Database\Database;
+
+$connection = Database::getConnection();
+
+// Create the table.
+$connection->schema()->createTable('update_test_schema_table', array(
+  'fields' => array(
+    'a' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+    ),
+    'b' => array(
+      'type' => 'blob',
+      'not null' => FALSE,
+      'size' => 'normal',
+    ),
+  ),
+));
+
+// Set the schema version.
+$connection->insert('key_value')
+  ->fields([
+    'collection' => 'system.schema',
+    'name' => 'update_test_schema',
+    'value' => 'i:8000;',
+  ])
+  ->execute();
+
+// Update core.extension.
+$extensions = $connection->select('config')
+  ->fields('config', ['data'])
+  ->condition('collection', '')
+  ->condition('name', 'core.extension')
+  ->execute()
+  ->fetchField();
+$extensions = unserialize($extensions);
+$extensions['module']['update_test_schema'] = 8000;
+$connection->update('config')
+  ->fields([
+    'data' => serialize($extensions),
+  ])
+  ->condition('collection', '')
+  ->condition('name', 'core.extension')
+  ->execute();
