Moi Meme's picture

Hi,

Everything installed OK on an AWS server, I can access Webmin and Adminer, but the main tool at https//my-ip gives a 500 error (after accepting the auto-signed SSL, I did not create one yet).

The logs give me

[Mon Sep 23 14:57:31.482011 2019] [php7:error] [pid 921] [client xxx] PHP Fatal error:  Uncaught Doctrine\\DBAL\\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory in /var/www/nextcloud/l:

Connecting to Webmin works OK.
Connecting to Adminer gives " No such file or directory "

I did read instructions and searched your faqs to no avail. Any idea what I did wrong, how to fix ?

Best regards.

Forum: 
Jeremy Davis's picture

Thanks for getting in touch.

Could you please share the AWS instance size and region that you are using? Then I can try to create the issue on my end.

My first guess is that for some reason the backend database has crashed. The fact that Adminer doesn't work and you are getting a 500 error from Nextcloud would be consistent with that guess.

I know that the resource requirements for Nextcloud have increased within the last few builds, and it also now requires (includes) Redis, so it may just be that it's now too heavy for the instance size you have chosen.

The first thing to try would be to double check the status of the MySQL/MariaDB server. Do that like this:

systemctl status mysql

If that says that the status is "inactive (dead)" or "active (exited)" then I would try starting it and see if that fixes it. Do that like this:

systemctl start mysql

Double check that it's now running by rechecking the status (as per above). It should say "active (running)"

Then see if you can log in. If it still doesn't work, double check the MySQL status again. if it's again crashed, that would suggest that the size server you are trying to run does not have sufficient resources.

As soon as I know the size and rgion, I'm happy to investigate further on my end.

Moi Meme's picture

Thanks for the reply. I chose a t2.medium instance which I thought was the required size, in the closest location to us ie Paris, France.

Type d'instance: t2.medium
Zone de disponibilité: eu-west-3c

Instance     vCPU*     CPU Credits / hour Mem (GiB)
t2.medium    2     12              4

I will test the commands you suggest for the DB,

Thanks.

 

Moi Meme's picture

The commands give

admin@nextcloud ~$ systemctl status mysql
Failed to connect to bus: No such file or directory

The Start command gives the same

admin@nextcloud ~$ systemctl start mysql
Failed to connect to bus: No such file or directory


I had set a pretty restrictive security policy (connection from our IPs only) but no outgoing restriction, so I tried by "opening up" everything for a while, but no change.


Thank you.

Moi Meme's picture

This seems like the same error, related ? It's above my level :-)

 

https://askubuntu.com/questions/813588/systemctl-failed-to-connect-to-bu...

Jeremy Davis's picture

Apologies on delayed response, I've been a bit unwell.

I'm pretty sure that the error message is because you need to be root when you run that command, so try prefixing it with sudo (FWIW by default all our servers use the root user account, however AWS MP servers are the exception to that rule). So if you could please retry them, prefixed with sudo.

Having said that, you note that it's a t2.medium sized server, that should have plenty enough resources, so this strikes me as especially weird. I'll launch one myself ASAP and see how I go. I'll post back if I have any luck.

Moi Meme's picture

Hello,

Thanks for the reply and I hope you got better !

I could try those commands as root again, sorry for not detecting the required sudo option.
I indeed got a much more explicit message:

sudo systemctl status mysql

admin@nextcloud ~$ sudo systemctl status mysql
* mariadb.service - MariaDB 10.1.38 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-09-23 14:07:04 UTC; 1 weeks 0 days ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 823 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, statu
  Process: 625 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`;
  Process: 541 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCE
  Process: 438 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCES
 Main PID: 823 (code=exited, status=226/NAMESPACE)

Sep 23 14:07:02 nextcloud systemd[1]: Starting MariaDB 10.1.38 database server...
Sep 23 14:07:04 nextcloud systemd[1]: mariadb.service: Main process exited, code=exited, status=226/NAMESPACE
Sep 23 14:07:04 nextcloud systemd[1]: Failed to start MariaDB 10.1.38 database server.
Sep 23 14:07:04 nextcloud systemd[1]: mariadb.service: Unit entered failed state.
Sep 23 14:07:04 nextcloud systemd[1]: mariadb.service: Failed with result 'exit-code'.

sudo systemctl start mysql

admin@nextcloud ~$ sudo systemctl start mysql

said nothing and seemed to work, and indeed after that:


admin@nextcloud ~$ sudo systemctl status mysql
* mariadb.service - MariaDB 10.1.38 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-09-30 15:10:36 UTC; 3s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 23839 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SU
  Process: 23836 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
  Process: 23674 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery
  Process: 23670 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUC
  Process: 23667 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCC
 Main PID: 23808 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 26 (limit: 4915)
   CGroup: /system.slice/mariadb.service
           `-23808 /usr/sbin/mysqld

Sep 30 15:10:34 nextcloud systemd[1]: Starting MariaDB 10.1.38 database server...
Sep 30 15:10:35 nextcloud mysqld[23808]: 2019-09-30 15:10:35 139785140804992 [Note] /usr/sbin/mysqld (mysqld 10.1.38-
Sep 30 15:10:36 nextcloud systemd[1]: Started MariaDB 10.1.38 database server.

and I now can see the Web admin to start the configuration.

So I guess it all boiled down to a database service not started install ? Not sure why though.

 

Have a nice day.

Jeremy Davis's picture

Yes I'm much better now, thanks for your kind words.

Ok, so it sounds like MySQL (MariaDB technically) crashed for some reason. My suggestion is to have a little bit more of a dig and see if there are any hints in the logs. The MySQL log files should be in /var/log (I'm pretty sure they're called 'mysql.log' and 'mysql.err'). You can view them with 'cat', or if they're big, 'tail' ('tail -NUMBER_OF_LINES' - e.g. 'tail -30' to show the last 30 lines) might be better. Alternatively, you can view the journal using 'journalctl -u mysql' (will likely require sudo).

Although another option is to just see how it goes. Depending on why it crashed (e.g. if it ran out of RAM - which is my guess), it will likely crash again (maybe hours, days or perhaps even weeks). If you check the logs (as per above) as soon as it crashes (and before you try restarting it again) it may actually be easier to see why it crashed.

Regardless, good luck with it all.

Add new comment