Installation fails with "Drupal is already installed" translated in the chosen language.

Created on 6 February 2018, almost 7 years ago
Updated 9 February 2023, almost 2 years ago

Problem/Motivation

Drupal 8 offers a distribution-key in the distro.info.yml file to use and let users skip the profile selection screen. The value of this key replaces the "Drupal"-string and the user is saving time by jumping to the module installation progress screen in case there is a db-connection available.

Choosing another language lets the web installer fail with "Drupal is already installed" translated in the chosen language.
Tracing this behavior leads to the following error:

RuntimeException: Failed to start the session because headers have already been sent by "/app/vendor/symfony/http-foundation/Response.php" at line 412. in /app/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php on line 139 #0 /app/web/core/lib/Drupal/Core/Session/SessionManager.php(163): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() #1 /app/web/core/lib/Drupal/Core/Session/SessionManager.php(118): Drupal\Core\Session\SessionManager->startNow() #2 /app/vendor/symfony/http-foundation/Session/Session.php(71): Drupal\Core\Session\SessionManager->start() #3 /app/web/core/includes/install.core.inc(1482): Symfony\Component\HttpFoundation\Session\Session->start() #4 /app/web/core/includes/install.core.inc(671): install_bootstrap_full(Array) #5 /app/web/core/includes/install.core.inc(549): install_run_task(Array, Array) #6 /app/web/core/includes/install.core.inc(117): install_run_tasks(Array) #7 /app/web/core/install.php(44): install_drupal(Object(Composer\Autoload\ClassLoader))

This error can be reproduced only by choosing a different language

  1. Empty the database
  2. Run the installer again with the same language:

Result: Installation process starts as usual.

  1. Empty the database.
  2. Choose another "non-english" language.

    Result: Error can be reproduced.

It seems that the immediate request for downloading the translation files is causing the error.

The code to skip the profile selection can be found in web/core/includes/install.core.inc:1243

// Check for a distribution profile.
  foreach ($install_state['profiles'] as $profile) {
    $profile_info = install_profile_info($profile->getName());
    if (!empty($profile_info['distribution'])) {
      return $profile->getName();
    }
  }

Proposed resolution

Installing via drush and choosing english as language in the web installer works fine.
As a temporary fix for distribution maintainers, who let their distribution deploy to cloud based services where you already have pre-configured datatabase connection: Remove the distribution key from your profiles info.yml.

🐛 Bug report
Status

Closed: outdated

Version

9.5

Component
Install 

Last updated 7 days ago

No maintainer
Created by

🇩🇪Germany markaspot

Live updates comments and jobs are added and updated live.
  • distributions

    Used in Documentation issues for documentation of distributions

  • Needs manual testing

    The change/bugfix cannot be fully demonstrated by automated testing, and thus requires manual testing in a variety of environments.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand quietone

    I tested this on Drupal 10.1.x. I copied the minimal profile to /profiles and changed the name to minimalx. I added a core_version_requirement key to the info.yml file. I then dropped the db and installed minimalx in English from the UI. All went well. I then dropped the db and installed in minimalx in Italian. And again the install was successful. The translations were downloaded during the install process and updated again at the end.

    And for fun, I dropped the db and installed in Basa Java, a language I had never installed before. Again, the install proceeded as expected, with translations being downloaded and I had a working site at the end of the process.

    I am closing this as outdated.

Production build 0.71.5 2024