Après mise à niveau de mon serveur Ubuntu de la version 10.04 à 12.04, une erreur apparaît lors de l’utilisation du webmail roundcube à l’enregistrement des contacts et des identités. Ce tutoriel explique comment identifier et réparer le problème.

After having updated my Ubuntu server from 10.04 version to 12.04 version, an error occurred while trying to save contacts and identities in the webmail roundcube. This tutorial explains how to find out what the problem is and how to fix it.

Erreur à l’enregistrement d’un contact dans le carnet d’adresses

Après avoir édité un nouveau contact, l’action d’enregistrement déclenche le message d’erreur suivant :

Une erreur a empêché la sauvegarde

La recherche de la source de cette erreur peut être faite en regardant les log de roundcube :

tail -f /var/log/roundcube/errors

où on voit apparaître des lignes du type

[21-Aug-2012 07:52:12 UTC] MDB2 Error: no such field (-19): _doQuery: [Error message:
  Could not execute statement]
[Last executed query: INSERT INTO contacts (user_id, changed, del, `vcard`, `name`,
  `email`, `firstname`, `surname`, `words`) VALUES ...
  [Native code: 1054] [Native message: Unknown column 'words' in 'field list']

qui indique que le champ “words” n’existe pas dans la table “contact” de la base de données de roundcube. En démarrant le serveur SQL (ou par le biais de PhpMyAdmin si il est installé), on corrige le problème en insérant le champ dans la table

ALTER TABLE `contacts` ADD `words` VARCHAR( 500 ) NULL DEFAULT NULL

Erreur à l’ajout d’une nouvelle identité

L’insertion d’une nouvelle identité produit la même erreur. Une méthodologie similaire permet d’identifier que le champ “changed” est manquant dans la table “identitities”

ALTER TABLE `identities` ADD `changed` DATETIME NOT NULL DEFAULT '1000-01-01 00:00:00'
  AFTER `identity_id`

Error while saving a contact in the addressbook

While trying to save a new contact, I obtain the following message:

An error occured while saving

The error is more precisely described in roundcube’s log files:

tail -f /var/log/roundcube/errors

where the following lines can be found

[21-Aug-2012 07:52:12 UTC] MDB2 Error: no such field (-19): _doQuery: [Error message:
  Could not execute statement]
[Last executed query: INSERT INTO contacts (user_id, changed, del, `vcard`, `name`,
  `email`, `firstname`, `surname`, `words`) VALUES ...
  [Native code: 1054] [Native message: Unknown column 'words' in 'field list']

This indicates that the field “words” does not exist in the table “contact” in roundcube’s database. Using SQL server (or PhpMyAdmin if it is installed), this error can be fixed by inserting the missing field:

ALTER TABLE `contacts` ADD `words` VARCHAR( 500 ) NULL DEFAULT NULL

Error while adding a new identity

Trying to save a new identity resulted in the same error message. Once again, it comes from a missing field (“changed” is missing in the table “identities”)

ALTER TABLE `identities` ADD `changed` DATETIME NOT NULL DEFAULT '1000-01-01 00:00:00'
  AFTER `identity_id`