Drupal CMS Installation Fails due to Trash

Created on 13 December 2024, 8 days ago

Problem/Motivation

When I attempt to install Drupal CMS in a production environment (that is utilizing a network / shared file system), the install of Drupal fails. It does work locally and in non-production environments that do not utilize network (Gluster) file systems.

As far as I can tell, the drupal_cms_content_type_base recipe adds the Trash module. Trash makes a request into the PhpStorageFactory to get the location of trash, and Drupal returns a relative path to the public file system. In this case, it's looking for a multisite called sjs3prnolztg and the directory lives in sites/sjs3prnolztg/files/php/trash. This director is on the server (I've confirmed its presence) but something about the relative pathing is causing the directory to not be found. Which causes the install to fail.

While I could technically override the PhpStorage method, this feels like a pretty critical issue (and I can't imagine I'll be the only person to run into such an issue).

The stack trace from the server looks like:

[12-Dec-2024 19:47:49 UTC] UnexpectedValueException: DirectoryIterator::__construct(sites/sjs3prnolztg/files/php/trash): Failed to open directory: No such file or directory in /var/www/html/docroot/core/lib/Drupal/Component/PhpStorage/FileStorage.php on line 173 #0 /var/www/html/docroot/core/lib/Drupal/Component/PhpStorage/FileStorage.php(173): DirectoryIterator->__construct()
#1 /var/www/html/docroot/core/lib/Drupal/Component/PhpStorage/FileStorage.php(151): Drupal\Component\PhpStorage\FileStorage->unlink()
#2 /var/www/html/docroot/modules/contrib/trash/src/TrashEntityTypeManager.php(28): Drupal\Component\PhpStorage\FileStorage->deleteAll()
#3 /var/www/html/docroot/core/lib/Drupal/Core/Plugin/CachedDiscoveryClearer.php(56): Drupal\trash\TrashEntityTypeManager->clearCachedDefinitions()
#4 /var/www/html/docroot/core/lib/Drupal/Core/Extension/ModuleInstaller.php(281): Drupal\Core\Plugin\CachedDiscoveryClearer->clearCachedDefinitions()
#5 /var/www/html/docroot/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install()
#6 /var/www/html/docroot/core/lib/Drupal/Core/Recipe/RecipeRunner.php(262): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install()
#7 [internal function]: Drupal\Core\Recipe\RecipeRunner::installModule()
#8 /var/www/html/docroot/core/includes/batch.inc(296): call_user_func_array()
#9 /var/www/html/docroot/core/includes/batch.inc(138): _batch_process()
#10 /var/www/html/docroot/core/includes/batch.inc(94): _batch_do()
#11 /var/www/html/docroot/core/includes/install.core.inc(664): _batch_page()
#12 /var/www/html/docroot/core/includes/install.core.inc(572): install_run_task()
#13 /var/www/html/docroot/core/includes/install.core.inc(121): install_run_tasks()
#14 /var/www/html/docroot/core/install.php(53): install_drupal()
#15 {main} request_id="v-f74cec36-b8c1-11ef-b36a-7b387d7068b5"

The AJAX error I get in the UI looks like this:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /aqci2j5thae1/core/install.php?rewrite=ok&profile=drupal_cms_installer&langcode=en&recipes%5B0%5D=drupal_cms_starter&recipes%5B1%5D=drupal_cms_accessibility_tools&recipes%5B2%5D=drupal_cms_blog&recipes%5B3%5D=drupal_cms_events&recipes%5B4%5D=drupal_cms_forms&recipes%5B5%5D=drupal_cms_multilingual&recipes%5B6%5D=drupal_cms_seo_tools&site_name=My%20awesome%20site&id=1&op=do_nojs&op=do
StatusText: parsererror
ResponseText: UnexpectedValueException: DirectoryIterator::__construct(sites/aqci2j5thae1/files/php/trash): Failed to open directory: No such file or directory in DirectoryIterator->__construct() (line 181 of /var/www/html/docroot/core/lib/Drupal/Component/PhpStorage/FileStorage.php).

Steps to reproduce

Install Drupal CMS (with or without recipes selected from the Install Screen) in a production style environment that utilizes network storage for the filesystem.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Component

Track: Installer

Created by

πŸ‡ΊπŸ‡ΈUnited States mikemadison Seattle, WA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024