'Internal Server Error' after restarting WSL instance

Nextcloud version 18.0.4
Windows 10 x64 WSL (Ubuntu 18.04 LTS)
Apache or nginx version: Server version: Apache/2.4.29 (Ubuntu)
PHP version: PHP 7.2.24-0ubuntu0.18.04.4 (cli)

I know this install isn’t really the way to go and that it’s pretty scuffed, but please provide any help you can.

The issue you are facing:
After restarting my host pc (windows) or terminating the wsl instance (whether intentionally or accidentally) upon restarting the service and launching apache, I’m greeted with
"Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log."

This may be due to the unusual manner in which I’m running Nextcloud, idk. Installed it following this video’s instructions: https://www.youtube.com/watch?v=vAWe8LjSUNk

As I’m inexperienced in running linux based server programs and the like, I had to change my /etc/apache2/apache2.conf listening port from 80 to 8080, as otherwise apache would fail to start.

I must reinforce that everything PRIOR to terminating the WSL instance worked perfectly fine. Uploading, downloading, everything.

Is this the first time you’ve seen this error? No

Steps to replicate it:

  1. Successfully install nextcloud
  2. Terminate WSL instance or turn off host pc.
  3. Launch into WSL again and attempt to start apache.

The output of your Nextcloud log:

Log: https://pastebin.com/vaLugtNJ

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'ocq3mox7uemm',
  'passwordsalt' => 'CENSORED',
  'secret' => 'CENSORED',
  'trusted_domains' => 
  array (
    0 => 'localhost:8080',
    1 => '192.168.0.17:8080',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '18.0.4.2',
  'overwrite.cli.url' => 'http://localhost:8080/nextcloud',
  'dbname' => 'nextdb',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'CENSORED',
  'dbpassword' => 'CENSORED',
  'installed' => true,
);

Apache System Log:

[Sat May 02 00:24:50.702028 2020] [mpm_prefork:notice] [pid 13094] AH00163: Apache/2.4.29 (Ubuntu) configured – resuming normal operations
[Sat May 02 00:24:50.702206 2020] [core:notice] [pid 13094] AH00094: Command line: ‘/usr/sbin/apache2’
[Sat May 02 00:25:12.981305 2020] [mpm_prefork:notice] [pid 13094] AH00171: Graceful restart requested, doing restart
[Sat May 02 00:25:13.074811 2020] [mpm_prefork:notice] [pid 13094] AH00163: Apache/2.4.29 (Ubuntu) configured – resuming normal operations
[Sat May 02 00:25:13.074857 2020] [core:notice] [pid 13094] AH00094: Command line: ‘/usr/sbin/apache2’
[Sat May 02 00:26:58.214177 2020] [mpm_prefork:notice] [pid 13094] AH00169: caught SIGTERM, shutting down
[Sat May 02 00:26:59.709032 2020] [mpm_prefork:notice] [pid 13470] AH00163: Apache/2.4.29 (Ubuntu) configured – resuming normal operations
[Sat May 02 00:26:59.709127 2020] [core:notice] [pid 13470] AH00094: Command line: ‘/usr/sbin/apache2’
[Sat May 02 01:00:01.281932 2020] [mpm_prefork:notice] [pid 13470] AH00169: caught SIGTERM, shutting down
[Sat May 02 01:00:02.747023 2020] [mpm_prefork:notice] [pid 14285] AH00163: Apache/2.4.29 (Ubuntu) configured – resuming normal operations
[Sat May 02 01:00:02.747122 2020] [core:notice] [pid 14285] AH00094: Command line: ‘/usr/sbin/apache2’
[Sat May 02 01:03:44.639260 2020] [php7:error] [pid 14307] [client ::1:5985] PHP Fatal error: Class ‘OCA\Files_Sharing\Activity\Providers\Base’ not found in /var/www/html/nextcloud/apps/files_sharing/lib/Activity/Providers/Downloads.php on line 28
[Sat May 02 01:27:22.716758 2020] [mpm_prefork:notice] [pid 55] AH00163: Apache/2.4.29 (Ubuntu) configured – resuming normal operations
[Sat May 02 01:27:22.716893 2020] [core:notice] [pid 55] AH00094: Command line: ‘/usr/sbin/apache2’
[Sat May 02 01:28:56.330610 2020] [mpm_prefork:notice] [pid 55] AH00171: Graceful restart requested, doing restart
[Sat May 02 01:28:56.423061 2020] [mpm_prefork:notice] [pid 55] AH00163: Apache/2.4.29 (Ubuntu) configured – resuming normal operations
[Sat May 02 01:28:56.423094 2020] [core:notice] [pid 55] AH00094: Command line: ‘/usr/sbin/apache2’
[Sat May 02 01:32:10.031036 2020] [mpm_prefork:notice] [pid 55] AH00169: caught SIGTERM, shutting down
[Sat May 02 01:37:03.633872 2020] [mpm_prefork:notice] [pid 167] AH00163: Apache/2.4.29 (Ubuntu) configured – resuming normal operations
[Sat May 02 01:37:03.633979 2020] [core:notice] [pid 167] AH00094: Command line: ‘/usr/sbin/apache2’

WSL is not intended to run services. That kind of setup may not be viable.

If you have to run this on Windows, consider instead running an Ubuntu VM in Hyper-V. WSL is based on Ubuntu anyway, so it won’t be all that different.

I see. I figured that since people had made guides on how to set it up using WSL, that WSL would be a viable method. Thanks for letting me know!

Hmm. All I can say there is people will write guides for a lot of strange things.

In the early days of WSL, it wouldn’t even let you run system services. But with Hyper-V you can run a native Linux environment that would even be officially supportable.