You'll probably notice this because of a series of errors like the ones below on the status report at /admin/reports/status
:
Notice: Undefined index: name in system_requirements() (line 59 of core/modules/system/system.install).
Notice: Undefined index: version in system_requirements() (line 61 of core/modules/system/system.install).
To fix this...
-
Check
settings.php
andsettings.local.php
in the order they are parsed for lines that look like$settings['install_profile']
This is just a sanity check to figure out if it is getting set properly earlier in the file, but unset or emptied ("stomped") later. If you find it's being unset or stomped, delete the line that stomps it.
Drupal 8.5 and earlier shipped
settings.php
with an empty template line (this was removed in 8.6). The Drupal installer is supposed to set it, but sometimes fails to do so, which is often how this problem starts. -
Determine what install profile we want to set the site to use (we will call it $PROFILE in the rest of this document).
drush -y sqlq "SELECT name FROM key_value WHERE collection = 'system.schema' AND name IN ('standard', 'minimal');"
... will check if Drupal had one at some point, but forgot about it.
That command might return
standard
,minimal
, or nothing (i.e.: an empty line).Note that if you suspect that Drupal was installed from a distribution like Umami, Thunder, Lightning, Commerce Kickstart, Panopoly, WETkit, etc. you'll have to add the distributions you suspect to the SQL IN clause.
If it returns nothing, or you're otherwise unsure, then it's usually safe to assume
minimal
. The minimal profile only has the bare minimum modules and config required to run Drupal. Since you already have a (mostly-) working site, you already have a lot of other config making it work, so basing it on minimal won't break existing things. -
Optional: export config to be on the safe side:
drush -y config-export
... you may also want to commit this to version control.
-
Set the profile manually:
drush -y ev "\Drupal::configFactory()->getEditable('core.extension')->set('profile', '$PROFILE')->save();"
... remember to replace $PROFILE with whatever you decided was going to be the new install profile in step 2.
-
Set the profile weight:
drush -y ev "\Drupal::configFactory()->getEditable('core.extension')->set('module.minimal', 1000)->save();"
... note that Installation profiles are like modules. 1000 is the default weight for the
minimal
andstandard
profiles on Drupal 8 sites whose installation finishes successfully.You can change
'module.minimal'
to'module.standard'
(or any other install profile) if you prefer. Note, however, that install profiles are able to modify the behavior of the site (i.e.: by defining custom event handlers, implementing hooks, etc. as well as with default configuration). So, if you aren't certain which install profile was used, I recommend sticking withminimal
, because it has the least amount of starting config and doesn't implement any hooks, define any event handlers, etc., and is therefore least likely to modify the behavior of your existing site. -
Ensure Drupal's database-update mechanism knows about the installation profile, so if future updates provide database updates for it, they are not skipped:
drush -y sqlq "INSERT INTO key_value (collection, name, value) VALUES ('system.schema', '$PROFILE', 'i:8000;');"
... remember to replace $PROFILE with whatever you decided was going to be the new install profile in step 2.
Unlike D7, update #8000 is the default when a module is installed, regardless of whether it implements any
hook_update_N()
. Also unlike D7, a value MUST be in this table in order for update.php to figure out that something needs to be updated! -
Edit
settings.php
(NOTsettings.local.php
orsettings.pantheon.php
, etc.) to specify the install profile:$settings['install_profile'] = '$PROFILE';
... remember to replace $PROFILE with whatever you decided was going to be the new install profile in step 2.
Recall that best practice nowadays is to put sensitive / machine-specific credentials in
settings.local.php
, and commitsettings.php
so that settings like this one,hash_salt
, etc. can be shared by all copies of this site. So you probably want to commit this change. In version control systems like Git where it is possible to commit something then ignore future changes, you may need to explicitlygit add
the file. -
Optional, export configuration again, then import it:
drush -y config-export drush -y config-import
-
Clear caches from
/admin/config/development/performance
, or by runningdrush -y cr
-
Visit
/admin/reports/status
to check that you don't have any errors. In particular, you should see an item in the "Checked" section that looks like:Installation profile: $LABEL ($PROFILE-$VERSION)
... where $PROFILE is whatever you decided was going to be the new install profile in step 2, $LABEL is the human-readable name for that install profile, and $VERSION is the version of that install profile (i.e.: the Drupal version for
minimal
andstandard
)
After performing the above steps, you may get errors that look like:
Warning: The following module is missing from the file system: in /app/core/includes/bootstrap.inc on line 268
... note the empty string between "system:" and "in" (the string template is 'The following @type is missing from the file system: @name'
).
This can happen because, if no install profile is set, then newer versions of Drupal 8 will assume the install profile is named NULL or an empty string, and certain operations will result in that empty profile being added to the list of things to load on bootstrap. This is likely to happen if a newer version of Drupal 8 ran for a bit without an install profile.
To fix this, all you need to do is delete Drupal's knowledge of it:
drush -y sqlq "DELETE FROM key_value WHERE collection = 'system.schema' AND name = '';"
... and clear caches from /admin/config/development/performance
, or by running drush -y cr
Thanks very much for this. Got rid of the last of my updating troubles. Some minor points (I had to apply these to get my site back into a fully operational state) :
Shouldn't (in step 5)
->set('module.minimal')
be->set('module.[$PROFILE])'
?Also in step 9 :
drush -y cr all
<-- this gives my install errors ( Too many arguments, expected arguments "command". )Why not just:
drush cr
?