Author Topic: Safe upgrade of Roundcube after install from Debian Repo  (Read 14095 times)

Offline gtcodave

  • Newbie
  • *
  • Posts: 5
Safe upgrade of Roundcube after install from Debian Repo
« on: August 28, 2012, 07:32:52 AM »
Hi,

Background:
I've been playing around with Roundcube for about 4 months now and I really like it. I have a small server (Debian Squeeze) running Roundcube 0.7. I installed it from the Squeeze repo.

Later I wanted to have a look at the plug-ins available for it so I installed 0.7.2 from the Debian Testing / Wheezy repo and let the package manager handle the install.

Clearly, whilst this was the easiest option, it doesn't really provide the latest and greatest Roundcube due to Debian's package freezing protocol for stability.

Scenario:
Now I'm looking at installing the latest version, 0.8, which will require me to use the install script.

However I'm not sure I should upgrade or install from scratch. I don't want any issues on the system with the package manager, by just writing over files it thinks are a particular version, which may lead to 'collisions'.

I want to upgrade everything and be independent of the package management system now, for Roundcube, but I don't want to lose any data or accounts I've made so far.

Question:
What's the advised method of installing the new version of Roundcube without losing the emails, accounts and data which I already have? Is it as simple as

1. #aptitude remove roundcube
2. Install new roundcube
(?)

Or are there some serious things I need to take into account?

Closing Statement:
Always best to ask those with a wealth of experience than walk blindly in the dark :)

Thanks very much(!) and I hope this helps anyone else with this future question.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,534
    • http://SKaero.com/
Re: Safe upgrade of Roundcube after install from Debian Repo
« Reply #1 on: August 28, 2012, 08:09:03 AM »
RoundCube doesn't store email accounts or emails, that is handled by the mail server. What RoundCube does store is the identities you create in RoundCube, RoundCube preferences, and the contacts. I would recommend copying the existing install RoundCube (both the files and the database) and upgrading the copied install so you don't run into problems with the package manager or lose any data. Then you should be able to remove the old install though the package manager. And as always, before you make any changes backup incase of any problems.

Offline gtcodave

  • Newbie
  • *
  • Posts: 5
Re: Safe upgrade of Roundcube after install from Debian Repo
« Reply #2 on: September 07, 2012, 03:51:35 AM »
Right here's what I've tried to do:

1. Uploaded version 8 to server
2. Made a backup of all Roundcube-7 folders (named 'roundcube') and SQL db.
3. # apt-get remove roundcube
4. Attempted to run (from Roundcube8 folder) ./bin/installto.sh /path/to/Roundcube

At this point I had an error about a requirement, suhosin.session.encrypt, incorrect

5. Checked symlinked .ht* file to make sure suhosin.session.encrypt was disabled as required

Couldn't work out why it was complaining so attempted 'MANUAL UPGRADE'

6. Replaced index.php and all files in
   - ./bin/
   - ./SQL/
   - ./program/
7.  rsync the contents of the following folders from your installation
    directory into the target folder:
   ./skins/
   ./plugins/

At this point the Roundcube 7 folders have now been overwritten as Roundcube 8 folders

8. Attempted to run ./bin/update.sh from the commandline but it failed again with suhosin.session.encrypt requirement.

- I checked it was disabled as required, it was.
- Tried replacing .ht* with roundcube 8 .ht* file. Didn't fix issue, so I put roundcube7 version back (as it was not a request of the documentation to replace the .ht* file with a  new version)


9. Moved over the ./install folder from roundcube8 folder to normal roundcube folder so i could 'open http://url-to-roundcube/installer/ in a browser and choose "3 Test config".' as stated as an alternate method of installation.

10. Updated config files with updated tags such as 'imap_folders' as instructed.

I didn't have the option for 'Test Config' so went through the install procedure and was informed DSN (write):  NOT OK(MDB2 Error: not found)

11. Checked config files. Config files remained unedited in this respect from roundcube7.

E.G.

db.inc.php file

Code: [Select]
$rcmail_config = array();

/* Do not set db_dsnw here, use dpkg-reconfigure roundcube-core to configure database ! */

include_once("/etc/roundcube/debian-db.php");

switch ($dbtype) {
 case "sqlite":
   $rcmail_config['db_dsnw'] = "sqlite:///$basepath/$dbname?mode=0640";
   break;
 default:
   if ($dbport != '') $dbport=":$dbport";
   if ($dbserver == '') $dbserver="localhost";
   $rcmail_config['db_dsnw'] = "$dbtype://$dbuser:$dbpass@$dbserver$dbport/$dbname";
   break;
 }

and debian-db.php

Code: [Select]
<?php
##
## database access settings in php format
## automatically generated from /etc/dbconfig-common/roundcube.conf
## by /usr/sbin/dbconfig-generate-include
## Tue, 24 Apr 2012 11:19:09 +0100
##
## by default this file is managed via ucf, so you shouldn't have to
## worry about manual changes being silently discarded.  *however*,
## you'll probably also want to edit the configuration file mentioned
## above too.
##
$dbuser='roundcube';
$dbpass='[b]Correct passwd but REMOVED for this post[/b]';
$basepath='';
$dbname='roundcube';
$dbserver='';
$dbport='';
$dbtype='mysql';

I really like the structure of the folders as they are and I've made so everything is updated properly and the symlinks are correct.

I even ran dpkg-reconfigure roundcube-core in an attempt to get it working that way but no joy, first without reinstalling db, 2nd trying to reinstall it and overwrite it.

Quote
dpkg-reconfigure roundcube-core
dbconfig-common: writing config to /etc/dbconfig-common/roundcube.conf
Replacing config file /etc/roundcube/debian-db.php with new version
granting access to database roundcube for roundcube@localhost: already exists.
creating database roundcube: already exists.
populating database via sql...  error encountered populating database:
mysql said: ERROR 1050 (42S01) at line 8: Table 'session' already exists
dbconfig-common: roundcube configure: aborted.
dbconfig-common: flushing administrative password

^ So I aborted and no changes made.

Any ideas?

« Last Edit: September 07, 2012, 04:13:34 AM by gtcodave »

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,534
    • http://SKaero.com/
Re: Safe upgrade of Roundcube after install from Debian Repo
« Reply #3 on: September 07, 2012, 04:20:39 AM »
Let start with the first problem. When running files from the command line the .htaccess files are not read, they are only accessed when running from a supported web server (Apache) even then the settings in the .htaccess files may not be read do to the way php is configured. Try creating a php.ini file in the base RoundCube folder (you may need to have another copy of the php.ini in the installer and/or bin folders) with the following:
Code: [Select]
suhosin.session.encrypt = Off

Offline gtcodave

  • Newbie
  • *
  • Posts: 5
Re: Safe upgrade of Roundcube after install from Debian Repo
« Reply #4 on: September 07, 2012, 04:43:40 AM »
Ok I will look into you suggestion now, and see if I can then use the update script, as I assume this is the method you would prefer?

...
...

Ok I created a file called 'php.ini' inside:
./roundcube
./roundcube/bin
./roundcube/install

Inside the php.ini file is the code you gave me.

I tried running ./bin/update.sh but got the error
Quote
ERROR: Wrong 'suhosin.session.encrypt' option value. Read REQUIREMENTS section in INSTALL file or use Roundcube Installer, please!

I also tried changing 'suhosin.session.encrypt off' to 'suhosin.session.encrypt disabled' but that didn't work.

Any other suggestions, have I misunderstood your instruction?

---Note for later---

Also when reading ./logs/errors I find:

Code: [Select]
Assigning the return value of new by reference is deprecated in /usr/share/php/MDB2.php on line 393
[06-Sep-2012 12:42:50] PHP Deprecated:  Assigning the return value of new by reference is deprecated in /usr/share/php/MDB2.php on line 2647

No idea how to fix this, if it must be fixed.

« Last Edit: September 07, 2012, 04:46:16 AM by gtcodave »

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,534
    • http://SKaero.com/
Re: Safe upgrade of Roundcube after install from Debian Repo
« Reply #5 on: September 07, 2012, 04:49:52 AM »
It may not be reading the php.ini files, you may have to disable it in the main php.ini for the upgrade.

Offline gtcodave

  • Newbie
  • *
  • Posts: 5
Re: Safe upgrade of Roundcube after install from Debian Repo
« Reply #6 on: September 07, 2012, 05:09:41 AM »
Thanks for the swift reply.

I have # find / -name php.ini

and have these additional options:

/etc/php5/cli/php.ini
/etc/php5/cgi/php.ini
/etc/php5/apache2/php.ini

should I paste your code into all 3 of these?

Or did you mean to add it somehow to ./roundcube/config/main.inc.php ?

Thank you.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,534
    • http://SKaero.com/
Re: Safe upgrade of Roundcube after install from Debian Repo
« Reply #7 on: September 07, 2012, 06:28:55 AM »
I'm not a Debian expert but I think the one you'd want would be /etc/php5/cli/php.ini.

Offline gtcodave

  • Newbie
  • *
  • Posts: 5
Re: Safe upgrade of Roundcube after install from Debian Repo
« Reply #8 on: September 07, 2012, 07:03:20 AM »
I'm not a Debian expert...

Maybe not, but you are a massive help and I really appreciate it.

We've made some progress. ./php/cli/ was correct and I'm past that error now.

Now I am on the same one I had earlier, reported by the web installer.

Code: [Select]
NOTICE: Obsolete config options:
(You still have some obsolete or inexistent properties set. This isn't a problem but should be noticed)
- 'double_auth'

Do you want me to fix your local configuration? (y/N)
y
. backing up the current config files...
. writing /var/lib/roundcube/config/main.inc.php...
. writing /var/lib/roundcube/config/main.db.php...
Done.
Your configuration files are now up-to-date!
MDB2 Error: not found (-4): no RDBMS driver specified
Error connecting to database: MDB2 Error: not found
sh: /var/lib/roundcube/bin/indexcontacts.sh: Permission denied

The MDB2 Error I have no idea what the could be, do you have any clue? I'm going through Google now trying to find out.

The indexcontacts.sh isn't a concern, that's just not executable at the moment.[/s]

Thanks


---  UPDATE  ---
I've just been fiddling with the ./roundcube/config/db.inc.php and it seems that it's not correctly calling the additional debian.db.php file as it was before.

In ./roundcube/config/db.inc.php I changed:

Code: [Select]
$rcmail_config = array();

/* Do not set db_dsnw here, use dpkg-reconfigure roundcube-core to configure database ! */

include_once("/etc/roundcube/debian-db.php");

switch ($dbtype) {
 case "sqlite":
   $rcmail_config['db_dsnw'] = "sqlite:///$basepath/$dbname?mode=0640";
   break;
 default:
   if ($dbport != '') $dbport=":$dbport";
   if ($dbserver == '') $dbserver="localhost";
   $rcmail_config['db_dsnw'] = "$dbtype://$dbuser:$dbpass@$dbserver$dbport/$dbname";
   break;
 }

to

Code: [Select]
$rcmail_config = array();

/* Do not set db_dsnw here, use dpkg-reconfigure roundcube-core to configure database ! */

include_once("/etc/roundcube/debian-db.php");

switch ($dbtype) {
 case "sqlite":
   $rcmail_config['db_dsnw'] = "sqlite:///$basepath/$dbname?mode=0640";
   break;
 default:
   if ($dbport != '') $dbport=":$dbport";
   if ($dbserver == '') $dbserver="localhost";
   $rcmail_config['db_dsnw'] = 'mysql://USERNAME:PASSWORD@localhost/DATABASE-NAME';
   break;
 }

With that change it is functioning correctly. It's a shame it won't work the other way but I'm just happy to be making progress. Let's see how we get on...
« Last Edit: September 07, 2012, 07:37:52 AM by gtcodave »

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,534
    • http://SKaero.com/
Re: Safe upgrade of Roundcube after install from Debian Repo
« Reply #9 on: September 07, 2012, 10:03:06 AM »
The include to debian-db is only in the Debian package of RoundCube thats why it didn't updated cleanly to stock 0.8.x.