Update to 15.0.14 fails due to: The column 'private_key' on table 'oc_authtoken' already exists

Hello and thank you for helping me out here!

I am trying to update a from 15.0.13.1 to 15.0.4.14 and got stuck because of a problem when running the updater. Some table columns exist and the update trips and throws an error.

Some basic info of my system:

Nextcloud version 15.0.13.1: Trying to update to 15.0.4.14
Operating system and version: Debian 9 on Cubietruck (Armbian)
Apache or nginx version: Apache 2.4.25
PHP version (eg, 7.0.33):

The issue i am facing:
Doctrine\DBAL\Schema\SchemaException: The column ‘private_key’ on table ‘oc_authtoken’ already exists.

It’s not the only column that gives this error. I was able to fix oc_users by removing the column uid_lower, but i don’t feel confident in removing the authtoken from the database. Although it should not matter, i guess, as it will be generated on the fly.

Is this the first time you’ve seen this error? (Yes):

The output of my Nextcloud log in Admin > Logging:

{
  "reqId": "aYYb56gdddwP6tBtsu2r",
  "level": 3,
  "time": "December 30, 2019 19:38:29",
  "remoteAddr": "192.168.0.129",
  "user": "--",
  "app": "updater",
  "method": "GET",
  "url": "/nc/core/ajax/update.php?requesttoken=fhaNTbK5bSXps6yTPEmLWFzHkDkwqV%2FjviczmU2ebeE%3D%3ALnPgL8TIXk2Mxdm8aGLpbnekpkBj0SmzyGBJ7SPYFdE%3D",
  "message": "\\OC\\Updater::failure: Doctrine\\DBAL\\Schema\\SchemaException: The column 'private_key' on table 'oc_authtoken' already exists.",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0",
  "version": "15.0.13.1"
}

The output of my config.php file:

$CONFIG = array (
  'instanceid' => 'XXX',
  'overwrite.cli.url' => 'https://XXX',
  'htaccess.RewriteBase' => '/nc',
  'passwordsalt' => 'XXX',
  'secret' => 'XXX',
  'trusted_domains' =>
  array (
    0 => 'XXX',
    1 => '192.168.0.129',
    2 => '192.168.0.130',
    4 => '192.168.0.131',
  ),
  'datadirectory' => '/var/www/data',
  'dbtype' => 'mysql',
  'version' => '15.0.13.1',
  'dbname' => 'XXX',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'XXX',
  'dbpassword' => 'XXX',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 0,
  'log_type' => 'file',
  'logfile' => '/var/www/html/nc/nextcloud.log',
  'logfilemode' => 416,
  'logdateformat' => 'F d, Y H:i:s',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0,
    'password' => '',
    'dbindex' => 0,
  ),
  'mysql.utf8mb4' => true,
  'updater.secret' => 'XXX',
);

Ok, the solution to my problem was to DROP the columns/keys that the updater complained about… Dunno what caused the problem and why the updater could not handle this case.
Anyway, i waited for the updater to throw an error and did:

mysql -u root
use nextcloudDB;
ALTER TABLE 'oc_authtoken' DROP COLUMN 'private_key';

I then repeated the steps above for every column or key that the update tripped over.

That’s all…
Would want to learn what happened here. If anyone could educate me :slight_smile: