Moving modules breaks system

Created on 15 January 2016, over 8 years ago
Updated 18 January 2024, 5 months ago

Problem/Motivation

Moving modules into contrib/custom after install doesn't seem to work. According to the documentation, all one has to do if one wants to move modules into a custom or contrib directory structure is mv the directory, and clear the cache. This does not work. In fact uninstalling a module, and installing it in one of these directories doesn't work.

Workaround: truncate the cache_container table manually.

Proposed resolution

Ultimately fix this if it can be fixed, but presently updating the documentation would help alleviate the 'oh crap' feeling of a broken site.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
ExtensionΒ  β†’

Last updated 3 days ago

No maintainer
Created by

πŸ‡ΊπŸ‡ΈUnited States StevenPatz Alexandria VA

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

    Primarily changes documentation, not code. For Drupal core issues, select the Documentation component instead of using this tag. In general, component selection is preferred over tag selection.

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.

  • πŸ‡¬πŸ‡§United Kingdom joachim

    I just tried moving some contrib submodules πŸ“Œ Move submodules to a /modules folder Fixed , and I didn't hit this bug at all -- I tried `drush cr`, the Extend page, the Uninstall page, update.php - all fine.

    Are there any particular conditions for this bug? The modules I moved had services and routes, but didn't have any update hooks, for instance.

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    Maybe a related issue?

  • None of these above work for me sadly, yet didn't try anything with manually adding code to db to flush all caches. Tried moving for example ctools from /modules to /modules/contrib and doing cache reload with drush. Still getting error:

    Error: Class "Drupal\ctools\ParamConverter\TempstoreConverter" not found in .../core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 #0 .../core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
    #1 .../core/lib/Drupal/Component/DependencyInjection/Container.php(440): Drupal\Component\DependencyInjection\Container->get()
    #2 .../core/lib/Drupal/Component/DependencyInjection/Container.php(273): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
    #3 .../core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
    #4 .../core/lib/Drupal/Component/DependencyInjection/Container.php(440): Drupal\Component\DependencyInjection\Container->get()
    #5 .../core/lib/Drupal/Component/DependencyInjection/Container.php(237): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
    #6 .../core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
    #7 .../core/lib/Drupal/Component/DependencyInjection/Container.php(440): Drupal\Component\DependencyInjection\Container->get()
    #8 .../core/lib/Drupal/Component/DependencyInjection/Container.php(237): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
    #9 .../core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
    #10.../core/lib/Drupal/Component/DependencyInjection/Container.php(440): Drupal\Component\DependencyInjection\Container->get()
    #11 .../core/lib/Drupal/Component/DependencyInjection/Container.php(273): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
    #12.../core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
    #13 .../vendor/drush/drush/src/Commands/core/CacheCommands.php(63): Drupal\Component\DependencyInjection\Container->get()
    #14 .../vendor/drush/drush/src/Runtime/ServiceManager.php(321): Drush\Commands\core\CacheCommands::create()
    #15 .../vendor/drush/drush/src/Boot/DrupalBoot8.php(310): Drush\Runtime\ServiceManager->instantiateServices()
    #16 .../vendor/drush/drush/src/Boot/DrupalBoot8.php(238): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands()
    #17 .../vendor/drush/drush/src/Boot/BootstrapManager.php(236): Drush\Boot\DrupalBoot8->bootstrapDrupalFull()
    #18 .../vendor/drush/drush/src/Boot/BootstrapManager.php(422): Drush\Boot\BootstrapManager->doBootstrap()
    #19 .../vendor/drush/drush/src/Boot/BootstrapManager.php(357): Drush\Boot\BootstrapManager->bootstrapMax()
    #20 .../vendor/drush/drush/src/Boot/BootstrapManager.php(329): Drush\Boot\BootstrapManager->bootstrapToPhaseIndex()
    #21 .../vendor/drush/drush/src/Boot/BootstrapHook.php(36): Drush\Boot\BootstrapManager->bootstrapToPhase()
    #22 .../vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(44): Drush\Boot\BootstrapHook->initialize()
    #23 .../vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(36): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->doInitializeHook()
    #24 .../vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(29): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook()
    #25 .../vendor/consolidation/annotated-command/src/CommandProcessor.php(145): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize()
    #26 .../vendor/consolidation/annotated-command/src/AnnotatedCommand.php(376): Consolidation\AnnotatedCommand\CommandProcessor->initializeHook()
    #27 .../vendor/symfony/console/Command/Command.php(292): Consolidation\AnnotatedCommand\AnnotatedCommand->initialize()
    #28 .../vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run()
    #29 .../vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand()
    #30 .../public/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun()
    #31 .../public/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
    #32 .../public/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
    #33 .../vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
    #34 .../vendor/drush/drush/drush(4): require('...')
    #35 .../vendor/bin/drush(120): include('...')
    #36 {main}
    
  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    I tried this on Drupal 11.x, on a test site that I have been using for a few hours. I tested with project_browser which was installed and in /modules and got the following error. I repeated the test on a fresh install with the same results.

    $ ddev drush cr
     [success] Cache rebuild complete.
    $ mv modules/project_browser/ modules/contrib/
    $ ddev drush cr
     [error]  AssertionError: The file specified by the given app root, relative path and file name (/var/www/html/modules/project_browser/project_browser.info.yml) do not exist. in assert() (line 73 of /var/www/html/core/lib/Drupal/Core/Extension/Extension.php) #0 /var/www/html/core/lib/Drupal/Core/Extension/Extension.php(73): assert(false, 'The file specif...')
    #1 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(114): Drupal\Core\Extension\Extension->__construct('/var/www/html', 'module', 'modules/project...', 'project_browser...')
    #2 /var/www/html/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\Core\Extension\ModuleHandler->__construct('/var/www/html', Array, Object(Drupal\Core\Cache\ChainedFastBackend))
    #3 /var/www/html/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'module_handler')
    #4 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(588): Drupal\Component\DependencyInjection\Container->get('module_handler')
    #5 /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php(234): Drupal\Core\DrupalKernel->preHandle(Object(Symfony\Component\HttpFoundation\Request))
    #6 /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php(236): Drush\Boot\DrupalBoot8->bootstrapDrupalFull(Object(Drush\Boot\BootstrapManager), NULL)
    #7 /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php(422): Drush\Boot\BootstrapManager->doBootstrap(5, 6, NULL)
    #8 /var/www/html/vendor/drush/drush/src/Application.php(228): Drush\Boot\BootstrapManager->bootstrapMax()
    #9 /var/www/html/vendor/drush/drush/src/Application.php(194): Drush\Application->bootstrapAndFind('cr')
    #10 /var/www/html/vendor/symfony/console/Application.php(262): Drush\Application->find('cr')
    #11 /var/www/html/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #12 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #13 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
    #14 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
    #15 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
    #16 /var/www/html/vendor/bin/drush(119): include('/var/www/html/v...')
    #17 {main}. 
    
    AssertionError: The file specified by the given app root, relative path and file name (/var/www/html/modules/project_browser/project_browser.info.yml) do not exist. in assert() (line 73 of /var/www/html/core/lib/Drupal/Core/Extension/Extension.php).
     [warning] Drush command terminated abnormally.
    Failed to run drush cr: exit status 1
    

    I don't think this meets the criteria for Major status β†’ . This isn't caused by normal use of the site and the workaround is to leave the module in the existing directly.

  • Status changed to Active 11 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand
  • πŸ‡¬πŸ‡§United Kingdom joachim

    > the workaround is to leave the module in the existing directly

    Not doing the thing you want to do does not count as a workaround!

    And it's not uncommon for a module to start life in /custom, and then get released as a contrib project and end up in /contrib.

  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    @joachim, yes. I seem to have not typed what I was thinking. The workaround is as stated in the Issue Summary, to manually truncate the cache tables.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    #36 drush updb -y; drush cr; didn't work for me.
    I tried manually truncating all of the cache_[name] tables and that didn't help either.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    I also tried uninstalling updb , cr, cr, updb, and re-installing the module , cr, updb , no difference, still same issue.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    ok there are solutions above.

    rebuilding cache (drush cr)

    then restart:
    apache2

    I also restarted:
    php8.1-fpm

    after restarting these service, the error went away.

  • πŸ‡¨πŸ‡­Switzerland Mistrae

    restarting apache did the trick for me

  • πŸ‡¨πŸ‡ΏCzech Republic Bohus Ulrych Pilsen (Czechia)

    In my case this was enough just reload PHP
    service php8.2-fpm reload

  • πŸ‡·πŸ‡ΊRussia urix

    I finally found a way to safely move working modules to 'contrib' folder.
    It's not possible to restart apache in my working environment, and 'drush cr' is not enough to tell Drupal that module is another place.
    I can't control APC cache.
    So there's a workaround:

    1. Uncomment
    $settings['class_loader_auto_detect'] = FALSE;
    string in settings.php, which disables APC cache detection.
    2. Delete module's folder from 'modules'
    3. Install module via Composer
    4. 'drush cr'
    5. You're done, module works without data loss!

    I've transferred Paragraphs and Entity Reference Revisions this way.

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    Fantastic, thanks for sharing @urix!

    It would be awesome if you could add it under "You moved the module inside your Drupal installation" on How to fix "The following module is missing from the file system..." warning messages β†’ .

  • πŸ‡·πŸ‡ΊRussia urix

    @ressa, I've posted solution there.
    Thanks for your suggestion.

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    Thanks! But I meant that you should edit the page. I have now added a resumΓ© under "You moved the module inside your Drupal installation" on How to fix "The following module is missing from the file system..." warning messages β†’ .

  • πŸ‡ΊπŸ‡ΈUnited States lrjanda

    Thanks for this fix. Very helpful! Uncommented class_loader_auto_detect in the settings.php, removed the module's folder, added it back, and ran drush to rebuild the site's cache.

Production build 0.69.0 2024