Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If CLI user does not have permissions on Backdrop folders then Bootstrap commands show configuration directory error #428

Open
marcus-leonard opened this issue Aug 30, 2024 · 4 comments

Comments

@marcus-leonard
Copy link

I'm not sure if this is a Bee issue or something else, but the issue only happens when running Bee.

Running Bd 1.28.2, Bee 1.x-1.0.2.
The site runs fine without problems afaik.

bee st works fine.

bee cron and bee pml throw this error:

Exception: The configuration directory in settings.php is specified as './files/config_9c5e4e5663bfc5ea8eca0ce92b9bca01/active', but this directory is either empty or missing crucial files. Check that the $config_directories variable is correct in settings.php. in _backdrop_bootstrap_configuration() (line 3064 of /srv/www/profess/backdrop/core/includes/bootstrap.inc).

There's nothing in the recent log messages.

Calling cron with curl or in a browser also has no issues.

@yorkshire-pudding
Copy link
Collaborator

Hi @marcus-leonard
The error message you see is a backdrop error message which normally occurs if there is a mismatch between the configured $config_directories in settings.php or settings.local.php and what is actually in the folders, but that would normally stop the site working.
There is a difference between bee status and the other two. bee status does not load up Backdrop (i.e. does not invoke any level of bootstrap with Backdrop). However, bee cron and bee projects both load Backdrop in full (i.e. invoke full bootstrap) so are then somehow causing this issue.

I've tested with this release and can't reproduce as it stands, so we may need to delve deeper. I can't see any recent fixes that might be related to this.
Does bee status show the same path for config active as it shows here?
Do you have $config_directories in settings.php or settings.local.php?
Would you be willing to share a bit more about your environment? What is the OS and PHP version?

@marcus-leonard
Copy link
Author

Hi @yorkshire-pudding

Thanks for the quick reply. I dug a bit further and it looks like permissions. I should have realised sooner, but bee st seemed normal so I didn't spot it.

I've got Bd chown'd to apache, but I ran bee as me. When I su to apache, it runs fine. And bee st reported twice as much information.

I could suggest bee noticing if it doesn't have the right permissions, since the directory error sent me in the wrong direction, but it's a bit Unix 101 running something under a directory without proper permissions, so I'll take the blame. Unless you think the suggestion is worth pursuing, maybe close this.

Having done this, I'm now getting another error, but I'll log that separately.

Cheers.

@yorkshire-pudding yorkshire-pudding changed the title Configuration directory error If CLI user does not have permissions on Backdrop folders then Bootstrap commands show configuration directory error Sep 2, 2024
@yorkshire-pudding
Copy link
Collaborator

yorkshire-pudding commented Sep 2, 2024

Hi @marcus-leonard
Thanks for reporting back.
Where I run bee on a server, then I ensure my user is part of the www-data group (may be different group names) which seems to work and doesn't require su to the web server user.

I've changed the title of this issue. I think it would make sense to add some checks for file permissions so that error messages can be more meaningful.

@yorkshire-pudding
Copy link
Collaborator

yorkshire-pudding commented Sep 2, 2024

Needs a bit of thought about where to put this as will not be relevant to all commands in all scenarios: for example bee help can run outside a Backdrop installation and it won't be possible to test file readability before Backdrop is installed.

EDIT: Another thought: If the user is using database config storage then we don't want to rely on checking the readability or writability of config files.

Wider feedback please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants