Error running Nextcloud on Clear Linux

I am trying to install Nextcloud on Clear Linux. This is more playing around to learn about Clear Linux than anything else.

I can get to the Nextcloud installation wizard page and it will let me enter the admin user and database info and will accept it. However, when I try to do anything after that I get the “Internal Server Error, the server was unable to complete your request.” page. When I check the file system Nextcloud was install; i.e. the config.php was updated, there is data in the data directory, and most importantly there was a nextcloud.log. Blow is the log:

{"reqId":"4A0ilJ4b7bubr7tOj1GN","level":3,"time":"2021-06-06T18:06:02+00:00","remoteAddr":"*** sensitive parameter replaced ***","user":"--","app":"PHP","method":"GET","url":"/cron.php","message":{"Exception":"Error","Message":"filesize(): stat failed for /var/lib/nextcloud/data/flow.log at /var/www/nextcloud/lib/public/Log/RotationTrait.php#62","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"filesize(): stat failed for /var/lib/nextcloud/data/flow.log","/var/www/nextcloud/lib/public/Log/RotationTrait.php",62]},{"file":"/var/www/nextcloud/lib/public/Log/RotationTrait.php","line":62,"function":"filesize","args":["/var/lib/nextcloud/data/flow.log"]},{"file":"/var/www/nextcloud/apps/workflowengine/lib/BackgroundJobs/Rotate.php","line":49,"function":"shouldRotateBySize","class":"OCA\\WorkflowEngine\\BackgroundJobs\\Rotate","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/Job.php","line":52,"function":"run","class":"OCA\\WorkflowEngine\\BackgroundJobs\\Rotate","type":"->","args":[null]},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/TimedJob.php","line":59,"function":"execute","class":"OC\\BackgroundJob\\Job","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]},{"file":"/var/www/nextcloud/cron.php","line":150,"function":"execute","class":"OC\\BackgroundJob\\TimedJob","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36","version":"21.0.2.1"} {"reqId":"DTXtSfQ3m8Ricw0DrvAl","level":3,"time":"2021-06-06T18:06:13+00:00","remoteAddr":"*** sensitive parameter replaced ***","user":"morgan","app":"no app in context","method":"POST","url":"/login","message":"Something is wrong with your openssl setup: error:02001002:system library:fopen:No such file or directory, error:2006D080:BIO routines:BIO_new_file:no such file, error:0E064002:configuration file routines:CONF_load:system lib, error:02001002:system library:fopen:No such file or directory, error:2006D080:BIO routines:BIO_new_file:no such file, error:0E064002:configuration file routines:CONF_load:system lib","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36","version":"21.0.2.1"} {"reqId":"DTXtSfQ3m8Ricw0DrvAl","level":3,"time":"2021-06-06T18:06:13+00:00","remoteAddr":"*** sensitive parameter replaced ***","user":"morgan","app":"index","method":"POST","url":"/login","message":{"Exception":"RuntimeException","Message":"OpenSSL reported a problem","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Authentication/Token/PublicKeyTokenProvider.php","line":88,"function":"newToken","class":"OC\\Authentication\\Token\\PublicKeyTokenProvider","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"/var/www/nextcloud/lib/private/Authentication/Token/Manager.php","line":71,"function":"generateToken","class":"OC\\Authentication\\Token\\PublicKeyTokenProvider","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/User/Session.php","line":689,"function":"generateToken","class":"OC\\Authentication\\Token\\Manager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/CreateSessionTokenCommand.php","line":68,"function":"createSessionToken","class":"OC\\User\\Session","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\CreateSessionTokenCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/CompleteLoginCommand.php","line":48,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\CompleteLoginCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/LoggedInCheckCommand.php","line":60,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\LoggedInCheckCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/EmailLoginCommand.php","line":58,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\EmailLoginCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/UidLoginCommand.php","line":54,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\UidLoginCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/UserDisabledCheckCommand.php","line":58,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\UserDisabledCheckCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/PreLoginHookCommand.php","line":53,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/Authentication/Login/Chain.php","line":108,"function":"process","class":"OC\\Authentication\\Login\\PreLoginHookCommand","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/core/Controller/LoginController.php","line":310,"function":"process","class":"OC\\Authentication\\Login\\Chain","type":"->","args":[{"__class__":"OC\\Authentication\\Login\\LoginData"}]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"tryLogin","class":"OC\\Core\\Controller\\LoginController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\LoginController"},"tryLogin"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\LoginController"},"tryLogin"]},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\LoginController","tryLogin",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"core.login.tryLogin"}]},{"file":"/var/www/nextcloud/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/login"]},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/nextcloud/lib/private/Authentication/Token/PublicKeyTokenProvider.php","Line":373,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36","version":"21.0.2.1"}

There is a lot in the log, but I am guessing the issue has something to do with openssl as is show up a few times e.g.:

"Something is wrong with your openssl setup: error:02001002:system library:fopen:No such file or directory, error:2006D080:BIO routines:BIO_new_file:no such file, error:0E064002:configuration file routines:CONF_load:system lib, error:02001002:system library:fopen:No such file or directory, error:2006D080:BIO routines:BIO_new_file:no such file, error:0E064002:configuration file routines:CONF_load:system lib"

I have checked and the openssl bundle is installed and the PHP openssl module was installed and enabled with the PHP-basic bundle. Is it possible there are some additional PHP or openssl configuration that is needed? Or is it another issue altogether?

Have you seen this …

I did see that; however, I don’t seem to be smart enough to interpret it into a working solution. I have made sure that the OpenSSL bundle is installed and went so far to install many other bundles that showed up in a search of OpenSSL. I am not sure what else to try, any suggestions.

Thank you

I will try to build openssl from source.

I had the same error: apparently PHP openssl_* functions absolutely, positively require an openssl.cnf file (see e.g. PHP: openssl_pkey_new - Manual which is the one that’s causing the error).
Of course, Clear Linux OS has no such file by default.

So you have to create an openssl.cnf file and add it to config/config.php by appending this bit to the array:

'openssl' => [
  'config' => '/path/to/openssl.cnf',
],

Unfortunately I don’t know what you should write in the cnf file.
There’s a “minimal” one at /path/to/your/nextcloud/3rdparty/phpseclib/phpseclib/phpseclib/openssl.cnf which seems to work, but I don’t know if it’s safe to use for this purpose or not.