server icon indicating copy to clipboard operation
server copied to clipboard

NC12 with External Storage App crashing mysql

Open fabianborg opened this issue 9 years ago • 3 comments

Fresh install of Ubuntu 16.0.3 lts and Nextcloud 12.0.3 with external storage enabled. Server has 64gb physical ram and 64gb of swap. I am experiencing a blank screen when visiting the NC webpage after 12 hours and NC desktop app is reporting an Internal Server Error. I have reinstalled everything from scratch, NC12 works fine but after 4 hours circa mysql exits and not able to recover.

user@server:~$ sudo systemctl status mysql.service
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (start-post) (Result: exit-code) since Wed 2017-10-11 21:32:13 CEST; 13s ago
  Process: 3166 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 3158 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 3166 (code=exited, status=1/FAILURE);         : 3167 (mysql-systemd-s)
    Tasks: 2
   Memory: 464.0K
      CPU: 769ms
   CGroup: /system.slice/mysql.service
           └─control
             ├─3167 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─3213 sleep 1

Oct 11 21:32:13 server systemd[1]: Starting MySQL Community Server...
Oct 11 21:32:15 server systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
user@server:~$ sudo journalctl -xe
Oct 11 21:32:43 server systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Oct 11 21:32:43 server systemd[1]: mysql.service: Unit entered failed state.
Oct 11 21:32:43 server systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 11 21:32:44 server systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Oct 11 21:32:44 server systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Oct 11 21:32:44 server systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Oct 11 21:32:44 server audit[3260]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/3260/status" pid=3260 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=111 ouid=111
Oct 11 21:32:44 server audit[3260]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=3260 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=111 ouid=0
Oct 11 21:32:44 server audit[3260]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/3260/status" pid=3260 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=111 ouid=111
Oct 11 21:32:44 server kernel: audit: type=1400 audit(1507750364.128:63): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/3260/status" pid=3260 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=111 ouid=111
Oct 11 21:32:44 server kernel: audit: type=1400 audit(1507750364.128:64): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=3260 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=111 o
Oct 11 21:32:44 server kernel: audit: type=1400 audit(1507750364.128:65): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/3260/status" pid=3260 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=111 ouid=111
Oct 11 21:32:45 server systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Oct 11 21:33:14 server systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Oct 11 21:33:14 server systemd[1]: mysql.service: Unit entered failed state.
Oct 11 21:33:14 server systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 11 21:33:14 server systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Oct 11 21:33:14 server systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Oct 11 21:33:14 server systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Oct 11 21:33:14 server audit[3350]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/3350/status" pid=3350 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=111 ouid=111
Oct 11 21:33:14 server audit[3350]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=3350 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=111 ouid=0
Oct 11 21:33:14 server audit[3350]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/3350/status" pid=3350 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=111 ouid=111
Oct 11 21:33:14 server kernel: audit: type=1400 audit(1507750394.624:66): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/3350/status" pid=3350 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=111 ouid=111
Oct 11 21:33:14 server kernel: audit: type=1400 audit(1507750394.624:67): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=3350 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=111 o
Oct 11 21:33:14 server kernel: audit: type=1400 audit(1507750394.624:68): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/3350/status" pid=3350 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=111 ouid=111
Oct 11 21:33:16 server systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Oct 11 21:33:41 server sudo[3422]: user : TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=/bin/journalctl -xe
Oct 11 21:33:41 server sudo[3422]: pam_unix(sudo:session): session opened for user root by user(uid=0)

fabianborg avatar Oct 11 '17 19:10 fabianborg

From my point of view this seems not to be a Nextcloud problem but a MySQL configuration failure, because AppArmor doesn't allow to run specific MySQL commands. Mrs. G. told me that the listed AVC apparmor="DENIED" operation="open" denied ... error has first been reported in 2012. Please try-out the given steps to fix the problem:

https://askubuntu.com/questions/900064/mysql-not-starting-due-to-errors

j-ed avatar Oct 12 '17 07:10 j-ed

@j-ed went through the thread before, tried all options to no avail. Something is automatically messing the mysql sockets after a spree of time of perfect operation.

fabianborg avatar Oct 12 '17 08:10 fabianborg

@fabianborg As I wrote it's AppAmore which denies access to the socket. Try searching for ubuntu AVC apparmor="DENIED"and you will find many more links describing the problem and how it got solved.

E.g. https://opensourcegenie.wordpress.com/2014/11/01/apparmor-permission-issue-with-mysql-on-ubuntu/

j-ed avatar Oct 12 '17 10:10 j-ed