View Issue Details

IDProjectCategoryView StatusLast Update
0003230SOGoPackaging (Debian)public2016-04-13 13:52
Reporterfrancbelge Assigned Toplevesque  
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Platform[Server] LinuxOSDebianOS Version7 (Wheezy)
Fixed in Versionnightly v2 
Summary0003230: Post-installation should run database migration script
Description

When updating sogo from 2.2.17a to 2.3, calendars do not display in the web interface anymore and caldav access is denied because of changes to the database schema. Database migration scripts sql-update-2.1.17_to_2.3.0[-mysql].sql should be launched automatically or a message should let the administrator know that a manual migration is necessary.

Steps To Reproduce

Update from 2.2.17a to 2.3 with apt-get or aptitude.

TagsNo tags attached.

Relationships

has duplicate 0001043 resolvedludovic SOGo Ubuntu package does not advise schema update 
related to 0003053 resolvedplevesque sogo-backup.sh is not executable 

Activities

Raido

Raido

2015-06-03 09:17

reporter   ~0008562

I have the same problem.

francbelge

francbelge

2015-06-03 09:19

reporter   ~0008563

Quick note: manually running the migration script after the installation fixes the calendar issue.

Raido

Raido

2015-06-03 09:46

reporter   ~0008566

Is there anything else I have to do before running the script?
Stop some services etc?
Or should I just execute script?

ludovic

ludovic

2015-06-03 09:48

administrator   ~0008567

Just run the script. It is mentioned in the upgrade instructions - both in the guide and in the annonce message. We will most likely never automate this process.

Raido

Raido

2015-06-03 10:38

reporter   ~0008570

I ran script, got error:

2015-06-03 17:31:11.940 sogo-tool[16657] ERROR(+[GCSFolderManager defaultFolderManager]): default 'OCSFolderInfoURL' is not configured.
Couldn't fetch OCSFolderInfoURL value, aborting

changed update script to this:

indextable=$(sogo-tool dump-defaults -f /home/sogo/GNUstep/Defaults/.GNUstepDefaults | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
if [ -z "$indextable" ]; then
echo "Couldn't fetch OCSFolderInfoURL value, aborting" >&2

My GNUstepDeafults file:

<dict>
<key>OCSFolderInfoURL</key>
<string>mysql://sogo:tormsogosql@localhost:3306/sogo/sogo_folder_info</string>
<key>OCSSessionsFolderURL</key>

What am I missing?

Raido

Raido

2015-06-03 11:00

reporter   ~0008571

sudo -u sogo sogo-tool dump-defaults
{
OCSFolderInfoURL = "mysql://sogo:tormsogosql@localhost:3306/sogo/sogo_folder_info";
OCSSessionsFolderURL = "mysql://sogo:tormsogosql@localhost:3306/sogo/sogo_session_folder";

francbelge

francbelge

2015-06-03 11:06

reporter   ~0008572

An alternative would be to display upgrade instructions during apt-get upgrade, especially when a specific migration operation is required.

Raido

Raido

2015-06-04 11:24

reporter   ~0008583

One step forward and another error:

sudo -u sogo sh sql-update-2.1.17_to_2.3.0-mysql.sh

Username (sogo): sogo
Hostname (127.0.0.1): 127.0.0.1
Database (sogo): sogo
sql-update-2.1.17_to_2.3.0-mysql.sh.bak: 41: sql-update-2.1.17_to_2.3.0-mysql.sh.bak: Syntax error: "(" unexpected

line 41:

function adjustSchema() {
oldIFS="$IFS"
IFS=" "
part1="echo -e \&quot;ALTER TABLE $table MODIFY c_partstates mediumtext;\\n\&quot;";
part2="echo -e \&quot;ALTER TABLE $table ADD COLUMN c_description mediumtext;\\n\&quot;";
sqlscript="$sqlscript$part1$part2"
IFS="$oldIFS"
}

Raido

Raido

2015-06-04 11:32

reporter   ~0008584

Next error:

bash sql-update-2.1.17_to_2.3.0-mysql.sh
Username (sogo): root
Hostname (127.0.0.1): localhost
Database (sogo): sogo
This script will ask for the sql password twice
Converting c_partstates from VARCHAR(255) to mediumtext in calendar quick tables
Enter password:
Enter password:
ERROR 1060 (42S21) at line 1: Duplicate column name 'c_description'

Raido

Raido

2015-06-08 03:04

reporter   ~0008592

Was able to update my database. So this topic can be closed.

penguinpreferred

penguinpreferred

2015-06-10 10:07

reporter   ~0008613

Same problem on automatic upgrade on Ubuntu system.

sudo -u sogo sogo-tool dump-defaults does display
{
...
OCSFolderInfoURL = "mysql://sogo:xxxxxxx@localhost:3306/sogo/sogo_folder_info";
OCSSessionsFolderURL = "mysql://sogo:xxxxxxxxx@localhost:3306/sogo/sogo_sessions_folder";
...

sudo -u sogo bash sql-update-2.1.17_to_2.3.0-mysql.sh

fails with: "Couldn't fetch OCSFolderInfoURL value, aborting"

Suggestions?

ma@gtt-technologies.de

ma@gtt-technologies.de

2015-06-10 10:12

reporter   ~0008614

I have exactly the same problem.

Anyone has suggestion?

penguinpreferred

penguinpreferred

2015-06-11 05:35

reporter   ~0008618

I've tracked down the problem to the assumption that /etc/sogo/sogo.conf contains the defaults for the current installation. Ubuntu does not and it has not changed this with previous upgrades.

While the upgrade notes for 2.0.5 provide instructions for this transition, I am hesitant to follow all these notes as Ubuntu seems to follow its own set of conventions regarding the placement of some settings files.

My guess is that one alteration is needed to those instructions. The final instruction should be changed from

sudo -u sogo mv ~/GNUstep/Defaults/.GNUstepDefaults \
~/GNUstep/Defaults/GNUstepDefaults.old

to

sudo -u sogo mv /var/lib/sogo/GNUstep/Defaults/.GNUstepDefaults \
/var/lib/sogo/GNUstep/Defaults/.GNUstepDefaults.old

So, is there someone from the Ubuntu package group who can confirm the steps are for Ubuntu to move to a set of defaults in /etc/sogo/ ?

angelus1969

angelus1969

2015-06-11 16:04

reporter   ~0008627

Last edited: 2015-06-11 16:11

I managed to get past the "Couldn't fetch OCSFolderInfoURL value, aborting" error with the tip above. But when I try to run the script now, everytime I get sql-update-2.1.17_to_2.3.0-mysql.sh: 41: sql-update-2.1.17_to_2.3.0-mysql.sh: Syntax error: "(" unexpected

This is NOT an Ubuntu box btsihw, but a Debian 7 box.

@raido: you said you were able to update your database. Care to share with the class how you managed that? :)

@ludovic: I think that the severity should be upgraded, this affects quite a lot of people and a large portion of SOGo is now unuseable for the people affected!

penguinpreferred

penguinpreferred

2015-06-12 22:36

reporter   ~0008632

I bit the bullet, and it seems to have worked on my Ubuntu machine.

I ran the upgrade instructions for 2.0.5 as root, changing the rename line as noted in my post #8618 above (http://www.sogo.nu/bugs/view.php?id=3230#c8618)

I was then able to run the update script for 2.3. (I did move the sample settings in /etc/sogo/ first, so you may need to do that too.)

YMMV.

jackc

jackc

2015-06-14 04:34

reporter   ~0008634

Debian7: Move /etc/sogo/sogo.conf out or remove "-f /etc/sogo/sogo.conf" from the script.

I run the script by sogo user, but had to change "sogo-tool" to "/usr/sbin/sogo-tool".

Sven

Sven

2015-06-15 05:51

reporter   ~0008641

Since I just upgrade to 2.3.0 I will try to add some clarifiying comments to some of the problems above:

Comment #8618:

In current ubuntu package (sogo-2.3.0-1) /etc/sogo.conf is included in the package. So it should be safe to perform the documented upgrade procedure to move configuration to sogo.conf.

Comments #8583 and #8627:

The syntax error '"(" unexpected ...' occurs if the script is executed with another interpreter than bash. Ubuntu uses dash by default which uses another function declaration syntax (see https://wiki.ubuntu.com/DashAsBinSh for more information). Try executing "bash update-sql....sh" instead of "sh update-sql....sh". Otherwise you have to remove the "function" keyword (and probably have to edit the escape sequences in echo expressions as well).

kabelschachtrobbe

kabelschachtrobbe

2015-06-15 15:36

reporter   ~0008647

Comment #8572
An alternative would be to display upgrade instructions during apt-get upgrade, especially when a specific migration operation is required.

This would be in my opinion expected behavior and would have saved us from the (calendar) downtime and the trouble attached to that.

ThomasS

ThomasS

2015-10-08 11:05

reporter   ~0008981

My Workaround for Ubuntu/Debian was to execute following after the upgrade:

chown -R sogo /etc/sogo
sudo -u sogo sogo-tool dump-defaults > /etc/sogo/sogo.conf
sudo -u sogo /usr/doc/sogo/sql-update-2.1.17_to_2.3.0[-mysql].sh

plevesque

plevesque

2016-04-13 13:51

reporter   ~0009976

Installation/upgrade of binary packages from now on will show an on-screen note to remind the system maintainer to check for database schema upgrades.

Already included in nightly builds; will be part of the next set of releases for v2 and v3.

Issue History

Date Modified Username Field Change
2015-06-03 07:47 francbelge New Issue
2015-06-03 09:17 Raido Note Added: 0008562
2015-06-03 09:19 francbelge Note Added: 0008563
2015-06-03 09:46 Raido Note Added: 0008566
2015-06-03 09:48 ludovic Note Added: 0008567
2015-06-03 09:48 ludovic Severity major => feature
2015-06-03 10:38 Raido Note Added: 0008570
2015-06-03 11:00 Raido Note Added: 0008571
2015-06-03 11:06 francbelge Note Added: 0008572
2015-06-04 11:24 Raido Note Added: 0008583
2015-06-04 11:32 Raido Note Added: 0008584
2015-06-08 03:04 Raido Note Added: 0008592
2015-06-10 10:07 penguinpreferred Note Added: 0008613
2015-06-10 10:12 ma@gtt-technologies.de Note Added: 0008614
2015-06-11 05:35 penguinpreferred Note Added: 0008618
2015-06-11 16:04 angelus1969 Note Added: 0008627
2015-06-11 16:06 angelus1969 Note Edited: 0008627
2015-06-11 16:11 angelus1969 Note Edited: 0008627
2015-06-12 22:36 penguinpreferred Note Added: 0008632
2015-06-14 04:34 jackc Note Added: 0008634
2015-06-15 05:51 Sven Note Added: 0008641
2015-06-15 15:36 kabelschachtrobbe Note Added: 0008647
2015-10-08 11:05 ThomasS Note Added: 0008981
2016-04-01 11:00 ludovic Relationship added has duplicate 0001043
2016-04-01 11:02 ludovic Assigned To => plevesque
2016-04-01 11:02 ludovic Status new => assigned
2016-04-01 11:03 ludovic Relationship added related to 0003053
2016-04-13 13:51 plevesque Note Added: 0009976
2016-04-13 13:52 plevesque Status assigned => resolved
2016-04-13 13:52 plevesque Fixed in Version => nightly v2
2016-04-13 13:52 plevesque Resolution open => fixed