Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 6.0.4 -> 7.0.1 fails at LDAP mapping tables #10798

Closed
fdrtom opened this issue Sep 1, 2014 · 7 comments
Closed

Update 6.0.4 -> 7.0.1 fails at LDAP mapping tables #10798

fdrtom opened this issue Sep 1, 2014 · 7 comments

Comments

@fdrtom
Copy link

fdrtom commented Sep 1, 2014

Steps to reproduce

  1. install oc 6
  2. set up ldap mapping
  3. (optional) delete ldap config in admin web interface
  4. start update

Expected behaviour

ownCloud web updater should alter all tables and import its contents

Actual behaviour

The updater terminates unsuccessfully with the error

An exception occurred while executing 'ALTER TABLE `oc_oc_ldap_user_mapping_26dc95731c3b7` DROP PRIMARY KEY': SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'PRIMARY'; check that column/key exists

Of course, that table does not exist. Dropping the LDAP config before the update makes no difference. If I reload and restart the update, the hex string at the end will change, yet I cannot find it in my tables.

Server configuration

Operating system:
Debian jessie

Web server:
apache 2.4

Database:
MySQL 5.5

PHP version:
5.6

ownCloud version: (see ownCloud admin page)
6.0.4

Updated from an older ownCloud or fresh install:
update

List of activated apps:
calendar, files, contacts, documents, ldap and some viewers

The content of config/config.php:

<?php
$CONFIG = array (
  'instanceid' => 'ocXXXXX',
  'trusted_domains' => 
  array (
    0 => 'XXXX',
  ),
  'datadirectory' => '/srv/owncloud/data',
  'dbtype' => 'mysql',
  'version' => '6.0.4.1',
  'appstoreenabled' => false,
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/usr/share/owncloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
  ),
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'XXXXXX',
  'installed' => true,
  'forcessl' => false,
  'maxZipInputSize' => 838860800,
  'allowZipDownload' => true,
  'ldapIgnoreNamingRules' => false,
  'mail_smtpmode' => 'php',
  'mail_smtphost' => '127.0.0.1',
  'mail_smtpport' => 25,
  'mail_smtptimeout' => 10,
  'mail_smtpsecure' => '',
  'mail_smtpauth' => false,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
  'theme' => '',
  'maintenance' => false,
);

(after failed backup)

Are you using external storage, if yes which one: local/smb/sftp/...
No

Are you using encryption: yes/no
No

Logs

Web server error log

<empty>

ownCloud log (data/owncloud.log)

{"app":"core","message":"Simulated database structure update failed (exception 'OC\\DB\\MigrationException' with message 'An exception occurred while executing 'ALTER TABLE `oc_oc_ldap_user_mapping_26dc95731c3b7` DROP PRIMARY KEY':\n\nSQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'PRIMARY'; check that column\/key exists' in \/usr\/share\/owncloud\/lib\/private\/db\/migrator.php:117\nStack trace:\n#0 \/usr\/share\/owncloud\/lib\/private\/db\/migrator.php(75): OC\\DB\\Migrator->checkTableMigrate(Object(Doctrine\\DBAL\\Schema\\Table))\n#1 \/usr\/share\/owncloud\/lib\/private\/db\/mdb2schemamanager.php(111): OC\\DB\\Migrator->checkMigrate(Object(Doctrine\\DBAL\\Schema\\Schema))\n#2 \/usr\/share\/owncloud\/lib\/private\/db.php(337): OC\\DB\\MDB2SchemaManager->simulateUpdateDbFromStructure('\/usr\/share\/ownc...')\n#3 \/usr\/share\/owncloud\/lib\/private\/updater.php(195): OC_DB::simulateUpdateDbFromStructure('\/usr\/share\/ownc...')\n#4 \/usr\/share\/owncloud\/lib\/private\/updater.php(137): OC\\Updater->doUpgrade('7.0.1.1', '6.0.4.1')\n#5 \/usr\/share\/owncloud\/core\/ajax\/update.php(35): OC\\Updater->upgrade()\n#6 {main})","level":4,"time":"2014-09-01T11:33:20+00:00"}
@PVince81
Copy link
Contributor

PVince81 commented Sep 1, 2014

The hex number is a copy of the table on which the schema change will be simulated.
In your case it seems that it doesn't work.
I think these temporary tables are dropped after the check.

@blizzz any idea about this update issue ?

@blizzz
Copy link
Contributor

blizzz commented Sep 2, 2014

Could be a dup of #9893

@fdrtom
Copy link
Author

fdrtom commented Sep 3, 2014

Unlike them I actually have a primary key (looks the same before and after the failed update)

mysql> describe oc_ldap_user_mapping;
+----------------+--------------+------+-----+---------+-------+
| Field          | Type         | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+-------+
| ldap_dn        | varchar(255) | NO   | PRI |         |       |
| owncloud_name  | varchar(255) | NO   | UNI |         |       |
| directory_uuid | varchar(255) | NO   |     |         |       |
+----------------+--------------+------+-----+---------+-------+

Edit: my bad, SQL shows ldap_dn as primary, but it is just unique. That is because the first unique key is handled as primary. Yet alter table ... drop primary key does only work on true primary keys. See also http://bugs.mysql.com/bug.php?id=22520

@fdrtom
Copy link
Author

fdrtom commented Sep 3, 2014

I didn't disable the ldap app in the app page. If I do that, the update works fine, but I cannot enable it again. If I do, owncloud will display Failed to upgrade "user_ldap". instead of a login screen or anything else. The owncloud.log says the same.

@craigpg craigpg added this to the 2014-sprint-03-current milestone Sep 3, 2014
@craigpg craigpg modified the milestones: 2014-sprint-04-current, 2014-sprint-03 Sep 15, 2014
@karlitschek
Copy link
Contributor

@fdrtom Is it possible that you changed the permissions of the mysql users?
Or can you try to execute the mysql alter table command manually in the mysql console as the owncloud mysql user?

@craigpg craigpg modified the milestones: 2014-sprint-05-current, 2014-sprint-04 Sep 29, 2014
@craigpg craigpg modified the milestones: 2014-sprint-06-current, 2014-sprint-05 Oct 12, 2014
@craigpg craigpg modified the milestones: 2014-sprint-07-current, 2014-sprint-06 Oct 27, 2014
@craigpg craigpg modified the milestones: 2014-sprint-08-current, 2014-sprint-07 Nov 10, 2014
@DeepDiver1975
Copy link
Member

duplicate of #9893 -> closing

@silk
Copy link

silk commented Mar 16, 2015

I had the same error, when trying to update from 6.0.4.1 from owncloud packages to 7.0.4+dfsg-2 from debian repository.
I switched and used https://download.owncloud.org/community/owncloud-7.0.5.tar.bz2 - now the update finished without problems.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants