A good enhancement in Drupal 8 is having list of yml file to import via installation in mymodule_root\config\install, but this means I can not reinstall a module because the configuration settings already exist in the active configuration.

Actually the problem is when uninstalling the module: The imported configuration settings, imported during installation, aren't waived.


Test scenario

Put this sample .yml file in yourmodule_root\config\install\systme.site.yml.

name: 'Admissions at Adelaide'
mail: admin22@example.com
slogan: ''
  403: ''
  404: ''
  front: caslogin
admin_compact_mode: false
weight_select_max: 100
langcode: en
default_langcode: en

closed as unclear what you're asking by kiamlaluno Aug 3 '17 at 6:11

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I deleted the values in config table directly. – digitaldonkey Dec 3 '15 at 18:39

I'm quite sure it's not best practice, but you may try to add a yourmodule.install file and add something like this:

function yourmodule_migrate_uninstall() {

  // Delete Configuration generated at at activation.
  $dir = DRUPAL_ROOT . DIRECTORY_SEPARATOR . drupal_get_path('module', 'yourmodule') . DIRECTORY_SEPARATOR . 'config/install';
  $files = file_scan_directory($dir, '/.*\.yml$/');

  foreach ($files as $file) {
      ->condition('name', $file->name)

Better answers's are welcome ;)


See How to remove mymodule configurations on uninstall for a best-practice solution.

Basically, you can enforce the dependency on your module in your configuration files. So when the module is uninstalled, it's associated configuration will be uninstalled as well.

Not the answer you're looking for? Browse other questions tagged or ask your own question.