KUSONEKOの見る世界

Nextcloud 23 にアップデートしたときのメモ

Nextcloud 22.2.6を使っていましたが、Nextcloud 23.0.3の通知が来たため、バージョンアップしてみました。

メジャーバージョンアップの際は、何かと問題が起こるもので、その時のメモを残しておきます。

いつも通りにアップデートしてみると

Webでバージョンアップするとタイムアウトで失敗するため、いつも通りCLIで実行しました。

# cd /var/www/html/nextcloud/updater/
# sudo -u nginx php updater.phar

Nextcloud Updater - version: v20.0.0beta4-11-g68fa0d4

Current version is 22.2.6.

Update to Nextcloud 23.0.3 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-23.0.3.zip
Open changelog ?

Steps that will be executed:
[ ] Check for expected files
[ ] Check for write permissions
[ ] Create backup
[ ] Downloading
[ ] Verify integrity
[ ] Extracting
[ ] Enable maintenance mode
[ ] Replace entry points
[ ] Delete old files
[ ] Move new files in place
[ ] Done

Start update? [y/N] y
Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[?] Check for expected files
[?] Check for write permissions
[?] Create backup
[?] Downloading
[?] Verify integrity
[?] Extracting
[?] Enable maintenance mode
[?] Replace entry points
[?] Delete old files
[?] Move new files in place
[?] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] Y
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
2022-04-07T12:27:53+00:00 Setting log level to debug
2022-04-07T12:27:53+00:00 Repair step: Repair MySQL collation
(snip)
2022-04-07T12:29:37+00:00
An unhandled exception has been thrown:
ValueError: str_repeat(): Argument #2 ($times) must be greater than or equal to 0 in /var/www/html/nextcloud/3rdparty/symfony/console/Helper/ProgressBar.php:497
Stack trace:
#0 /var/www/html/nextcloud/3rdparty/symfony/console/Helper/ProgressBar.php(497): str_repeat('-', -2)
#1 /var/www/html/nextcloud/3rdparty/symfony/console/Helper/ProgressBar.php(568): Symfony\Component\Console\Helper\ProgressBar::Symfony\Component\Console\Helper\{closure}(Object(Symfony\Component\Console\Helper\ProgressBar), Object(Symfony\Component\Console\Output\StreamOutput))
#2 [internal function]: Symfony\Component\Console\Helper\ProgressBar->Symfony\Component\Console\Helper\{closure}(Array)
#3 /var/www/html/nextcloud/3rdparty/symfony/console/Helper/ProgressBar.php(581): preg_replace_callback('{%([a-z\\-_]+)(?...', Object(Closure), ' %message%\n %cu...')
#4 /var/www/html/nextcloud/3rdparty/symfony/console/Helper/ProgressBar.php(393): Symfony\Component\Console\Helper\ProgressBar->buildLine()
#5 /var/www/html/nextcloud/3rdparty/symfony/console/Helper/ProgressBar.php(302): Symfony\Component\Console\Helper\ProgressBar->display()
#6 /var/www/html/nextcloud/core/Command/Upgrade.php(135): Symfony\Component\Console\Helper\ProgressBar->start(0)
#7 /var/www/html/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(264): OC\Core\Command\Upgrade->OC\Core\Command\{closure}(Object(OC\EventDispatcher\GenericEventWrapper), '\\OC\\Repair::sta...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#8 /var/www/html/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, '\\OC\\Repair::sta...', Object(OC\EventDispatcher\GenericEventWrapper))
#9 /var/www/html/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, '\\OC\\Repair::sta...', Object(OC\EventDispatcher\GenericEventWrapper))
#10 /var/www/html/nextcloud/lib/private/EventDispatcher/SymfonyAdapter.php(123): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(OC\EventDispatcher\GenericEventWrapper), '\\OC\\Repair::sta...')
#11 /var/www/html/nextcloud/lib/private/Repair.php(258): OC\EventDispatcher\SymfonyAdapter->dispatch('\\OC\\Repair::sta...', Object(Symfony\Component\EventDispatcher\GenericEvent))
#12 /var/www/html/nextcloud/lib/private/Repair.php(280): OC\Repair->emit('\\OC\\Repair', 'startProgress', Array)
#13 /var/www/html/nextcloud/apps/accessibility/lib/Migration/RepairUserConfig.php(75): OC\Repair->startProgress()
#14 /var/www/html/nextcloud/lib/private/Repair.php(124): OCA\Accessibility\Migration\RepairUserConfig->run(Object(OC\Repair))
#15 /var/www/html/nextcloud/lib/private/legacy/OC_App.php(1071): OC\Repair->run()
#16 /var/www/html/nextcloud/lib/private/legacy/OC_App.php(1008): OC_App::executeRepairSteps('accessibility', Array)
#17 /var/www/html/nextcloud/lib/private/Updater.php(353): OC_App::updateApp('accessibility')
#18 /var/www/html/nextcloud/lib/private/Updater.php(265): OC\Updater->doAppUpgrade()
#19 /var/www/html/nextcloud/lib/private/Updater.php(133): OC\Updater->doUpgrade('23.0.3.2', '22.2.6.2')
#20 /var/www/html/nextcloud/core/Command/Upgrade.php(235): OC\Updater->upgrade()
#21 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/html/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /var/www/html/nextcloud/console.php(99): OC\Console\Application->run()
#27 /var/www/html/nextcloud/occ(11): require_once('/var/www/html/n...')
#28 {main}
Keep maintenance mode active? [y/N] n
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Maintenance mode disabled

Maintenance mode is disabled

このあとWebでログインしようとしましたが、やはり失敗しました。

対処方法

occ upgradeをすれば、回避できるようなのでやってみます。

# cd /var/www/html/nextcloud/
# sudo -u nginx php occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Updating database schema
Updated database
Starting code integrity check...
Finished code integrity check
Update successful
Maintenance mode is kept active
Resetting log level

メンテナンスモード状態のため、以下で解除。

# sudo -u nginx php occ maintenance:mode --off

これでWebでログインできるようになりました。

セキュリティ&セットアップ警告の消し込み

Nextcloud 23.0.4 にアップデートした時に出たものです。

  • The PHP OPcache module is not properly configured. See the documentation ↗ for more information.
      The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply opcache.interned_strings_buffer to your PHP configuration with a value higher than 8.
    →ひとまず2倍にしました。
    # vi /etc/php.d/10-opcache.ini
    opcache.interned_strings_buffer=8
    ↓
    opcache.interned_strings_buffer=16