diff --git a/core/modules/system/src/Form/ModulesUninstallConfirmForm.php b/core/modules/system/src/Form/ModulesUninstallConfirmForm.php
index 159959d..a4c9479 100644
--- a/core/modules/system/src/Form/ModulesUninstallConfirmForm.php
+++ b/core/modules/system/src/Form/ModulesUninstallConfirmForm.php
@@ -135,7 +135,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
 
     // Prevent this page from showing when the module list is empty.
     if (empty($this->modules)) {
-      return new RedirectResponse('/admin/modules/uninstall');
+      drupal_set_message($this->t('The selected modules could not be uninstalled, either due to a website problem or due to the uninstall confirmation form timing out. Please try again.'), 'error');
+      return new RedirectResponse($this->getCancelUrl()->setAbsolute()->toString());
     }
 
     $data = system_rebuild_module_data();
diff --git a/core/modules/system/src/Form/ModulesUninstallForm.php b/core/modules/system/src/Form/ModulesUninstallForm.php
index 153e2ca..3231c26 100644
--- a/core/modules/system/src/Form/ModulesUninstallForm.php
+++ b/core/modules/system/src/Form/ModulesUninstallForm.php
@@ -171,7 +171,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
   public function validateForm(array &$form, FormStateInterface $form_state) {
     // Form submitted, but no modules selected.
     if (!array_filter($form_state->getValue('uninstall'))) {
-      drupal_set_message($this->t('No modules selected.'), 'error');
+      $form_state->setErrorByName('uninstall', $this->t('No modules selected.'));
       $form_state->setRedirect('system.modules_uninstall');
     }
   }
@@ -184,7 +184,10 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
     $modules = $form_state->getValue('uninstall');
     $uninstall = array_keys(array_filter($modules));
     $account = $this->currentUser()->id();
-    $this->keyValueExpirable->setWithExpire($account, $uninstall, 60);
+    // Store the values for one week. This is also the default expiration time
+    // used in TempStore for instance, and gives users plenty of time to be away
+    // from their screen and submitting later.
+    $this->keyValueExpirable->setWithExpire($account, $uninstall, 604800);
 
     // Redirect to the confirm form.
     $form_state->setRedirect('system.modules_uninstall_confirm');
diff --git a/core/modules/system/src/Tests/Module/UninstallTest.php b/core/modules/system/src/Tests/Module/UninstallTest.php
index 337258c..197799e 100644
--- a/core/modules/system/src/Tests/Module/UninstallTest.php
+++ b/core/modules/system/src/Tests/Module/UninstallTest.php
@@ -106,5 +106,10 @@ function testUninstallPage() {
     // Make sure our unique cache entry is gone.
     $cached = \Drupal::cache()->get('uninstall_test');
     $this->assertFalse($cached, 'Cache entry not found');
+
+    // Make sure we get an error message when we try to confirm uninstallation
+    // of an empty list of modules.
+    $this->drupalGet('admin/modules/uninstall/confirm');
+    $this->assertText(t('The selected modules could not be uninstalled, either due to a website problem or due to the uninstall confirmation form timing out. Please try again.'), 'Module uninstall confirmation form displays error message');
   }
 }
