cliBasedCronUser & Server.php error

After hours of working finally had NC26 running up on a docker environment (dedicated server)

Its a simple stack with MariDB & Redis, installed under user 1000, behind proxy (NPM).

Proxy, Cron etc etc all works fine with some minor bug which everyone else reported (i.e email set up issue which there is a manual fix, and search bar can’t load more result )

However, i’m still encountering a issue which could not figure how to address

There are 2 error messages refreshed in log everytime i’m opening settings (come as a pair)

  • one is a warning:
    no app in context – Invalid cliBasedCronUser data provided to provideInitialState by settings

–another is an error
php – Trying to access array offset on value of type bool at /var/www/html/apps/settings/lib/Settings/Admin/Server.php#76

Open the Server.php and line 76 is as below

	$this->initialStateService->provideInitialState('cliBasedCronUser', function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '');

After trying many options, could not solve the issue so come to the forum asking for help.

Thanks a lot in advance.



Hello, I have exactly the same problem, does anyone know a solution by now?


1 Like

I think I have a lead on this bear with me because I haven’t used PHP a lot before, but I threw an exception with the line of the code that was failing to debug it (there’s probs a better way)
just after comment:
//Background jobs
insert this line:
throw new \Exception(posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))); line before
go to:
then do: cp Server.php ServerBackup.php (in case you mess anything up).
when I bash into my container it warns me that i dont have a name:
I have no name!@, so you either need to setup a name for the account in my case I was using user 1001, but my solution (not fully tested whether this works was to remove the [‘name’] dictonary indexer to look like the following:

$this->initialStateService->provideInitialState('cliBasedCronUser', function_exists('posix_getpwuid') ? fileowner(\OC::$configDir . 'config.php') : '');
then it shows running as system user “1001”

cronjobs were failing prior to me changing to this, so it seems to have worked for me. I can now use recognize app without it waiting forever and doing nothing.

I have the same issue and do not know what’s causing it.

Trying to access array offset on value of type bool at /var/www/html/apps/settings/lib/Settings/Admin/Server.php#76

From what I understand, it is trying to find the user that’s the owner of the config.php file, but it’s unable to, or it’s running into an issue.

What I did was to add www-data as the default user in the ternary operator instead of empty, and that appears to work for me, but that’s not a solution since it would overwritten by an update.

$this->initialStateService->provideInitialState('cliBasedCronUser', function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : 'www-data');

I fixed this issue by adding -v /etc/passwd:/etc/passwd:ro to my docker run. With docker-compose, that would be:

      - /etc/passwd:/etc/passwd:ro
      - ...

Of course, this would mean that the system’s /etc/passwd must contain the UID (i.e. you need to create a system user with that UID, but in all likelihood you already do).

I have this same issue but it is a truenas chart install App Version: 28.0.1 and Chart Version: 28.1.25. Everytime I visit the basic settings page, same two log entries appear. Shell running as no one. Unfountantley the charts don’t have root access to change anything as far as I know.

I reported as bug for truecharts here: Nextcloud Chart Version: 28.1.25 gets 2 errors in log every time clicking basic settings · Issue #17524 · truecharts/charts · GitHub