CONTENTS


Lastmodified 2022-03-15 (火) 10:02:20


portupgrade -ar --batch && reboot

ports をいつもの如くアップグレードしたところ、NextcloudがInternal Server Errorとなった。

同時に、というか、おもむろにw 

/usr/bin/su -m www -c "php /usr/local/www/nextcloud/occ upgrade"

すると、

An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory in /usr/local/www/nextcloud/lib/private/DB/Connection.php:72
Stack trace:
#0 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1449): OC\DB\Connection->connect()
#1 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(892): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /usr/local/www/nextcloud/lib/private/DB/Connection.php(202): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM `...', Array, Array, NULL)
#3 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(206): OC\DB\Connection->executeQuery('SELECT * FROM `...', Array, Array)
#4 /usr/local/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(217): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /usr/local/www/nextcloud/lib/private/AppConfig.php(345): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /usr/local/www/nextcloud/lib/private/AppConfig.php(110): OC\AppConfig->loadConfigValues()
#7 /usr/local/www/nextcloud/lib/private/AppConfig.php(301): OC\AppConfig->getApps()
#8 /usr/local/www/nextcloud/lib/private/legacy/OC_App.php(949): OC\AppConfig->getValues(false, 'installed_versi...')
#9 /usr/local/www/nextcloud/lib/private/Server.php(668): OC_App::getAppVersions()
#10 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}(Object(OC\Server))
#11 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#12 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet('OC\\Memcache\\Fac...')
#13 /usr/local/www/nextcloud/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query('OC\\Memcache\\Fac...', true)
#14 /usr/local/www/nextcloud/lib/private/Server.php(1677): OC\ServerContainer->query('OC\\Memcache\\Fac...')
#15 /usr/local/www/nextcloud/lib/private/Server.php(1017): OC\Server->getMemCacheFactory()
#16 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}(Object(OC\Server))
#17 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#18 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet('OCP\\Lock\\ILocki...')
#19 /usr/local/www/nextcloud/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query('OCP\\Lock\\ILocki...', true)
#20 /usr/local/www/nextcloud/lib/private/Server.php(1977): OC\ServerContainer->query('OCP\\Lock\\ILocki...')
#21 /usr/local/www/nextcloud/lib/private/Files/View.php(118): OC\Server->getLockingProvider()
#22 /usr/local/www/nextcloud/lib/private/Server.php(395): OC\Files\View->__construct()
#23 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}(Object(OC\Server))
#24 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#25 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet('OC\\Files\\Node\\H...')
#26 /usr/local/www/nextcloud/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query('OC\\Files\\Node\\H...', true)
#27 /usr/local/www/nextcloud/lib/private/Server.php(1324): OC\ServerContainer->query('OC\\Files\\Node\\H...')
#28 /usr/local/www/nextcloud/lib/base.php(595): OC\Server->boot()
#29 /usr/local/www/nextcloud/lib/base.php(1091): OC::init()
#30 /usr/local/www/nextcloud/console.php(49): require_once('/usr/local/www/...')
#31 /usr/local/www/nextcloud/occ(11): require_once('/usr/local/www/...')
#32 {main}mysql not running? (check /var/db/mysql/sun1.smb.net.pid).

と、既視感の有るスタックトレースが・・・

原因は、サーバ再起動時にMySQLが起動に失敗したために、DBにコネクトできないということ。

MySQLのログを見ると、

/var/db/mysql/[FQDN].erro

[ERROR] [MY-010276] [Server] Unix socket lock file is empty /tmp/mysql.sock.lock.
[ERROR] [MY-010268] [Server] Unable to setup unix socket lock file.
[ERROR] [MY-010119] [Server] Aborting
[System] [MY-010910] [Server] /usr/local/libexec/mysqld: Shutdown complete (mysqld 8.0.25)  Source distribution.

とのことなので、

/tmp

mysql.sock.lock
mysqlx.sock.lock
mysqlx.sock

これらを、

mysql.sock.lock_
mysqlx.sock.lock_
mysqlx.sock_

と改名して、

# /usr/local/etc/rc.d/mysql-server start

で、無事起動。

# ps aux | grep mysql
mysql   62251  11.0  6.8 2252388  560460  -  S    13:52    0:02.00 /usr/local/libexec/mysqld --defaults-extra-file=/usr/local/etc/mysql/my.cnf --basedir=/usr/l
mysql   59251   0.0  0.0   13624    3044  -  Is   13:52    0:00.06 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/usr/local/etc/mysql/my.cnf --based
root    72447   0.0  0.0   12868    2372  3  S+   13:53    0:00.00 grep mysql

Total access 922:本日 1:昨日 0

Counter: 922, today: 1, yesterday: 0

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS