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

[QA] occ produces misleading 'Invalid Database' error when run as root #38418

Open
jnweiger opened this issue Feb 16, 2021 · 3 comments
Open
Labels

Comments

@jnweiger
Copy link
Contributor

Seen with 10.6.0 on ubuntu 20.04 where the apache user is www-data:

The correct way to call occ, according to e.g. the /usr/bin/occ script shipped in our docker images is

su-exec www-data php /var/www/owncloud/occ ...

If a user runs occ as root, a misleading error message occurs: (The database type is not invalid, the occ invocation is at fault)

cd /var/www/owncloud
./occ app:enable metrics
An unhandled exception has been thrown:
OC\DatabaseException: Invalid database type in /var/www/owncloud/lib/private/Server.php:533
Stack trace:
#0 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}()
#1 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet()
#2 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query()
#3 /var/www/owncloud/lib/private/Server.php(1239): OC\ServerContainer->query()
#4 /var/www/owncloud/lib/private/Server.php(412): OC\Server->getDatabaseConnection()

Expected behaviour: occ should print a proper error message, and would refuse to run when called as root user.

(Not sure if this is a regression, didn't we catch that in the past?)

@stale
Copy link

stale bot commented Sep 19, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status/STALE label Sep 19, 2021
@stale
Copy link

stale bot commented Sep 20, 2021

This issue has been automatically closed.

@stale stale bot closed this as completed Sep 20, 2021
@ksydalack
Copy link

Im having this issue now but my command is:

root@Owncloud2022:/var/www/owncloud# sudo -u www-data php occ maintenance:mode --off
An unhandled exception has been thrown:
OC\DatabaseException: Invalid database type in /var/www/owncloud/lib/private/Server.php:549
Stack trace:

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

No branches or pull requests

2 participants