Problem/Motivation
None.
Steps to reproduce
As administrator i try a create a subtheme.
After clicking 'create' i get error
'The website encountered an unexpected error. Please try again later.'
There are two error messages in the logs:
1)
Drupal\Core\File\Exception\DirectoryNotReadyException: The specified file 'themes/contrib/bootstrap5/css/style.css.map' could not be copied because the destination directory '/var/www/vhosts/phano.de/httpdocs/drupal/web/themes/custom/b5subtheme/css' is not properly configured. This may be caused by a problem with file or directory permissions. in Drupal\Core\File\FileSystem->prepareDestination() (line 476 of /var/www/vhosts/xxxxxxxxx.com/httpdocs/drupal/web/core/lib/Drupal/Core/File/FileSystem.php).
2)
The specified file 'themes/contrib/bootstrap5/css/style.css.map' could not be copied because the destination directory '/var/www/vhosts/xxxxxxxxx.com/httpdocs/drupal/web/themes/custom/b5subtheme/css' is not properly configured. This may be caused by a problem with file or directory permissions.
Proposed resolution
None.
Comments
Comment #2
vladimirausThanks for the report.
I can add extra checks when creating the direcotries but it seems like youe system permissions are the issue.
Comment #3
collin howell commentedI had a similar error trying to create a subtheme with 1.0.0-beta5. - The website encountered an unexpected error. Please try again later.
Subtheme name
Belwest B5 subtheme
Subtheme machine name
belwest_b5_subtheme
Error Log reports
Location http://localhost/admin/appearance/settings/bootstrap5
Referrer http://localhost/admin/appearance/settings/bootstrap5
Message Drupal\Core\File\Exception\FileNotExistsException: File 'themes/contrib/bootstrap5\style-guide\bootstrap.rtl.min.css' could not be copied because it does not exist. in Drupal\Core\File\FileSystem->prepareDestination() (line 472 of B:\Dev\publichtml\core\lib\Drupal\Core\File\FileSystem.php).
The Directory Structure created
B:\Dev\publichtml\themes\custom\belwest_b5_subtheme>dir /s
Directory of B:\Dev\publichtml\themes\custom\belwest_b5_subtheme
05/07/2021 04:38 PM css
05/07/2021 04:38 PM style-guide
0 File(s) 0 bytes
Directory of B:\Dev\publichtml\themes\custom\belwest_b5_subtheme\css
05/07/2021 04:38 PM 204,359 style.css
05/07/2021 04:38 PM 52,938 style.css.map
2 File(s) 257,297 bytes
Directory of B:\Dev\publichtml\themes\custom\belwest_b5_subtheme\style-guide
0 File(s) 0 bytes
Total Files Listed:
2 File(s) 257,297 bytes
8 Dir(s) 20,302,741,504 bytes free
Hope this helps.
Comment #4
panditvarun20 commentedDear Team,
I am also facing the same issue. I have checked the permission of folder
recent log:
1- Drupal\Core\File\Exception\FileNotExistsException: File 'themes/contrib/bootstrap5\style-guide\bootstrap.rtl.min.css' could not be copied because it does not exist. in Drupal\Core\File\FileSystem->prepareDestination() (line 459 of C:\xampp\htdocs\drupal9c\web\core\lib\Drupal\Core\File\FileSystem.php).
2- File 'themes/contrib/bootstrap5\style-guide\bootstrap.rtl.min.css' could not be copied because it does not exist.
Comment #5
ben25 commentedI'm also experiencing issues when creating sub theme
for e.g.
File 'themes/contrib/bootstrap5/style-guide/bootstrap.rtl.min.css' could not be copied.....Comment #6
Mark.Devon commentedSimilar problem:
Drupal\Core\File\Exception\FileNotExistsException: File 'themes/contrib/bootstrap5\style-guide\bootstrap.rtl.min.css' could not be copied because it does not exist. in Drupal\Core\File\FileSystem->prepareDestination()
Created subtheme manually.
Comment #7
kroh commentedThis original issue indeed looks like a permission problem, but the other comments here are related to 3223704: php error when trying to create subtheme from UI
Comment #8
afeijoThat file is present in a subfolder, you can fix the problem and run the copy button by copying the file first, run this:
cp themes/contrib/bootstrap5/style-guide/bootstrap.rtl.min.css themes/contrib/bootstrap5/style-guide/index-rtl_filesComment #9
Ralf Eisler commented#7 worked for me.
Comment #13
vladimirausReady to test in dev.
Comment #14
vladimirausComment #15
gisleThe latest 1.0.x-dev snapshot solves both the permission issue (i.e. it provides a sensible error message if the site builder has not configured the right permissions for the web server), and the file copying issue (see #3223704: php error when trying to create subtheme from UI).
Creating a subtheme now works. Clicking "Create" results in a subtheme being created that is populated with all the right files.
Comment #16
vladimirausComment #18
nigelwhiteOn clicking 'Create' for the subtheme in GUI I'm still getting the error 'Subtheme cannot be created. Check permissions.'
Steps I took -
composer require 'drupal/bootstrap5:1.0.x-dev@dev'
Enabled Bootstrap 5
Ran permissions.sh which is available to our site
Create subtheme in GUI
Comment #19
gisleDoes it do the right thing? (Since it is only exists on your site, we have no way to know.)
The error message you cite indicates that it doesn't.
Since the subtheme is created by the web server user, the directory where you want to create the subtheme (default:
/themes/custom/below the webroot) must be writeable by the web server account. If it isn't, you get this error.Comment #20
vladimirausIf you cannot write to
themes/customtry to write toweb/sites/default/filesor whereever your public files folder is.Comment #21
nigelwhiteThat did it, thanks for the steer to specific directories
Cd /web/themes
Mkdir custom. This produced - custom 0755 root root
chown root:www-data custom
Subtheme cannot be created. Check permissions.
chmod 0777 custom
Subtheme created at /var/src/drupal/site/web/themes/custom/b5subtheme
Maybe the web server account had been unable to create the 'custom' directory? The 'themes' directory was at 0750 root www-data.
Comment #22
2flower commentedIs there solution for version 1.1.1?
It does not have 'style-guide' directory and creating theme in public directory does not work either.
Comment #23
szymmszy commentedI have the same problems as 2flower with version 1.1.2.
Comment #24
Rafael Cansinosdrupal 9.3.2 fresh install with composer
composer require 'drupal/bootstrap5:1.1.x-dev@dev'
SUBTHEME create
ERROR: Subtheme cannot be created. Check permissions.
directory themes (drwxrwxr-x) change a chmod 777 themes
ERROR: Subtheme cannot be created. Check permissions.
mkdir custom
chmod 777 custom
SUBTHEME create
ERROR: The website encountered an unexpected error. Please try again later.
Comment #25
Rafael CansinosI think this problem is due to security measures on the server where Drupal runs. In order not to touch anything in the server, what I have done:
chown -Rf myuser:myuser subthemenameIt works perfectly.
Comment #26
rmcf commentedI have the same issues with Drupal 9 and Bootstrap 5 on shared hosting:
"ERROR: Subtheme cannot be created. Check permissions." and "ERROR: The website encountered an unexpected error. Please try again later."
Is there any instruction how to create this subtheme manually like in Bootstrap 3? I will highly appreciate help with this – because it is a blocker for me to use Boostrap 5 theme :(
Comment #27
bloomt commentedFresh D9 install I get this error. Set custom folder to 777.
AH01071: Got error 'PHP message: Uncaught PHP Exception Drupal\\Core\\File\\Exception\\DirectoryNotReadyException: "The specified file 'themes/contrib/bootstrap5/css/style-50.css' could not be copied because the destination directory '/var/www/vhosts/website/web/themes/custom/b5subtheme/css' is not properly configured. This may be caused by a problem with file or directory permissions." at /var/www/vhosts/website/web/core/lib/Drupal/Core/File/FileSystem.php line 476', referer: https://website/admin/appearance/settings/bootstrap5
Is there a fix for this or a way to manually create the subtheme?
Comment #28
gislebloomt, do you have SELinux (Security-Enhanced Linux) enabled?
It is mostly used on RHEL and CentOS (and orther Red Hat derived flavours of Gnu/Linux), but I think he can be enabled on other platforms as well.
Comment #29
bloomt commentedSELinux is enabled, I temporarily disabled but the issue was the same.
Comment #30
drupgirl commented+1 for instructions on how to manually create a subtheme for this module.
Comment #31
gisleJust for the record, the built-in "Create" command works fine (I just tested it) provided you're able to set the permissions correctly so that the web server are allowed to copy and edit all required files. If you're desperate, go with 777 and make sure SELinux is disabled.
A newly created subtheme looks like the tree shown below, where the files (except
b5subtheme.info.yml– see below) are first copied from Bootstrap5 (sob5subtheme.breakpoints.ymlare copied frombootstrap5.breakpoints.yml). After the files has been copied and renamed, all ocurrences of "boostrap5" is changed to "b5subtheme" (e.g. "bootstrap5.screen.xs-max:" becomes "b5subtheme.screen.xs-max:").You should have this tree:
b5subtheme/ ├── b5subtheme.breakpoints.yml ├── b5subtheme.info.yml ├── b5subtheme.libraries.yml ├── b5subtheme.theme ├── config │ └── optional │ ├── block.block.b5subtheme_account_menu.yml │ ├── block.block.b5subtheme_branding.yml │ ├── block.block.b5subtheme_breadcrumbs.yml │ ├── block.block.b5subtheme_content.yml │ ├── block.block.b5subtheme_footer.yml │ ├── block.block.b5subtheme_help.yml │ ├── block.block.b5subtheme_local_actions.yml │ ├── block.block.b5subtheme_local_tasks.yml │ ├── block.block.b5subtheme_main_navigation.yml │ ├── block.block.b5subtheme_messages.yml │ ├── block.block.b5subtheme_page_title.yml │ ├── block.block.b5subtheme_powered_by_drupal.yml │ └── block.block.b5subtheme_search_form.yml ├── css │ ├── style-50.css │ ├── style-50.css.map │ ├── style.css │ └── style.css.map ├── favicon.ico ├── logo.svg ├── README.md ├── screenshot.png └── scss ├── style.scss ├── _variables_bootstrap.scss └── _variables_drupal.scssThis is the content of the subtheme's
b5subtheme.info.yml:Comment #32
slawomir commentedWe've a server running Plesk. with its psacln and psaserv groups for public webfiles. The sub-theme creator is coming back with "wrong permissions." I tried a few things around file permissions including 777 and using the OS' group / owner for the theme paths. No luck.
Now working on recreating the file structure given by @Gisle in #31. If I don't post a repo of the final in a few days, someone give me a nudge. ;)
Comment #33
dtamajon commentedIn my case, it is related to #2799635
Comment #34
bcobin commentedI've tried all of the above on a fresh D9 install and nothing happens. I get a success message, but nothing is created - no error message in the UI nor in the logs. I tried to manually create the subtheme - no dice.
Thanks in advance for any guidance here...
UPDATE: I am a (fill in expletive here). Rather than clicking "Create," I was clicking on the Save button. Duh.
So the creation works great... but the subtheme doesn't work. It's as if there's no theme at all.
No errors - could I be missing something? Thanks in advance for any suggestions...
FURTHER UPDATE: After updating core and fixing a problem with a "missing" module, all seems to be working as advertised... thanks!
Comment #35
calbasiIn my case, the issue is due opendir restrictions. If disabled it in my web account (ispconfig) and then I have not issue at all.
Comment #36
Videtes commentedI'm still getting the "Subtheme cannot be created. Check permissions." error despite having allowed everything for the /themes directory and the root it is located into.
Even adding permission to the normal /bootstrap5 theme directory (which makes no sense, but I tried because you never know) yelded no result.
I have no idea what other permissions I should change.
Comment #37
dtamajon commented@Videtes, try with the following patch: https://www.drupal.org/project/drupal/issues/2799635
We are using nginx and we had the same problem, given the way in which the core manages the file creation. With that patch, the problem is solved without the need to provide unsecure permissions to the filesystem.
Comment #38
Videtes commented@dtamajon, that patch worked for me, thanks a lot!
Comment #39
montogro commentedStill got permission issues with creating B5 subtheme, tried on nginx and local repositories, no result for me