nilsteampassnet / TeamPass

Collaborative Passwords Manager
https://www.teampass.net
1.66k stars 543 forks source link

Unable to upgrade 2.1.27.36 to a 3.0.0.14 #3107

Open GreyChame1eon opened 2 years ago

GreyChame1eon commented 2 years ago

Steps to reproduce

  1. Replace all the 2.1.27.36 files with the 3.0.0.14
  2. Run https://[sitename]/install/upgrade.php
  3. Enter the credentials (built-in teampass admin)
  4. Got an error "Setting.php file already exists and cannot be renamed. Please do it by yourself and click on button Launch."
  5. Rename the file ../includes/config/settings.php to a ../includes/config/settings.php.old
  6. Press "start" again (or Ctrl+F5 and start again)

Expected behaviour

See the next step of upgrade process or, at least, button Launch

Actual behaviour

Got a rotating gear in the right corner and that's all

Server configuration

Operating system: Ubuntu 20.04 LTS. The image is in the docker (2.1.27.36 original image)

Web server: nginx/1.17.6

Database: 5.7.32

PHP version: PHP 7.1.9

Teampass version: 2.1.27.36

Teampass configuration file:

Updated from an older Teampass or fresh install: 2.1.27.36 is the original version, it was not upgraded earlier

Client configuration

Browser: Opera 84.0.4316.42, Edge 99.0.1150.55, Firefox 98.0.2

Operating system: Windows 10

Logs

Insert your webserver log here only records like that: 172.18.0.2 - - [28/Mar/2022:15:30:06 +0000] "POST /install/upgrade_ajax.php HTTP/1.1" 200 13 "https://[sitename]/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55" 172.18.0.2 - - [28/Mar/2022:15:32:03 +0000] "POST /install/upgrade_ajax.php HTTP/1.1" 200 13 "https://[sitename]/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55" 172.18.0.2 - - [28/Mar/2022:15:38:04 +0000] "POST /install/upgrade_ajax.php HTTP/1.1" 200 13 "https://[sitename]/install/upgrade.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55"

Log from the web-browser developer console (CTRL + SHIFT + i)

Uncaught SyntaxError: Unexpected end of JSON input at Function.parse [as parseJSON] (<anonymous>) at Object.complete (upgrade.php:216:26) at c (jquery.min.js:2:28327) at Object.fireWith (jquery.min.js:2:29072) at l (jquery.min.js:2:80029) at XMLHttpRequest.<anonymous> (jquery.min.js:2:82355) at Object.send (jquery.min.js:2:82714) at Function.ajax (jquery.min.js:2:78291) at HTMLInputElement.<anonymous> (upgrade.php:208:18) at HTMLInputElement.dispatch (jquery.min.js:2:43064)

antoweb commented 2 years ago

Unable to rename seems to be a permission problem. Have you setup owner and group for all file in teampass folder according to your user of the webserver?

GreyChame1eon commented 2 years ago

Hello, antoweb! Thanks for your response

Yep, the owner and the group are the same as earlier, I've change them recursively. I've also tried to remove all the files in the directory, copy the new files, and copy original settings.php and tp.config.php files Now it looks like renaming procedure work well, but upgrade process still hung when I press the "start" button (without any warnings)

Browser error is the same: Uncaught SyntaxError: Unexpected token < in JSON at position 0 at Function.parse [as parseJSON] (<anonymous>) at Object.complete (upgrade.php:216:26) at c (jquery.min.js:2:28327) at Object.fireWith (jquery.min.js:2:29072) at l (jquery.min.js:2:80029) at XMLHttpRequest.<anonymous> (jquery.min.js:2:82355) at Object.send (jquery.min.js:2:82714) at Function.ajax (jquery.min.js:2:78291) at HTMLInputElement.<anonymous> (upgrade.php:208:18) at HTMLInputElement.dispatch (jquery.min.js:2:43064)

aTm12 commented 2 years ago

i have the same problem u need a php version at least 7.4, annd u notice the php version is 7.1 installed, i am using docker and i still can t figure out how to update the php version there !! let me know if u find a solution!

antoweb commented 1 year ago

I solved problem in this way:

All users can login and see password and download attachments.

For upgrade process from 2.1.27.36 i have used this method:

Start from 3.0.0.23 : https://github.com/nilsteampassnet/TeamPass/archive/refs/tags/3.0.0.23.tar.gz

Rename teampass folder old (2.1.27.36) to teampass_v2 Unzip 3.0.0.23.tar.gz Rename unzipped folder to "teampass" Create avatars folder in new teampass folder

copy following file: cp -p /var/www/html/teampass_v2/includes/config/settings.php /var/www/html/teampass/includes/config/ cp -p /var/www/html/teampass_v2/includes/config/tp.config.php /var/www/html/teampass/includes/config/ cp -p /var/www/html/teampass_v2/includes/libraries/csrfp/libs/csrfp.config.php /var/www/html/teampass/includes/libraries/csrfp/libs/ cp -rp /var/www/html/teampass_v2/avatars/ /var/www/html/teampass/includes/avatars/ cp -rp /var/www/html/teampass_v2/files/ /var/www/html/teampass/files/ cp -rp /var/www/html/teampass_v2/upload/ /var/www/html/teampass/upload/ cp -rp /var/www/html/teampass_v2/Saltkey/ /var/www/html/teampass/Saltkey/ (this folder must be created before copy file) Setting permission: chown -R www-data.www-data /var/www/html/teampass

chmod 0777 teampass/includes chmod -R 0777 teampass/includes/config chmod -R 0777 teampass/includes/avatars chmod -R 0777 teampass/includes/libraries/csrfp/libs chmod -R 0777 teampass/includes/libraries/csrfp/log chmod -R 0777 teampass/includes/libraries/csrfp/js chmod -R 0777 teampass/backups chmod -R 0777 teampass/files chmod -R 0777 teampass/install chmod -R 0777 teampass/upload

I have to set to 0 the column complexity_level in teampass_items table qith this query: UPDATE teampass_items SET complexity_level = '0' WHERE complexity_level IS NULL;

Launch the upgrade from browser if obtain error open file include/config/settings.php and add define('SECUREFILE', 'teampass-seckey.txt'); define("DB_ENCODING", "utf8");

At the end of upgrade process: Take note of all keys generated click oon button show/hide keys and send to users

Comment block code in index.php / // Quick major version check -> upgrade needed? if (isset($SETTINGS['cpassman_version']) === true && version_compare(TP_VERSION, $SETTINGS['cpassman_version']) > 0) { // Perform redirection if (headers_sent()) { echo ''; } else { header('Location: install/upgrade.php'); } // No other way, we should stop processing further exit; } /

restart apache and php-fpm

Enter with admin user and do 2 actions: Rebuild configuration file Reload cache table

Configure LDAP and sync users (if needed)

If at login of the user teampass says to put old password and current you must insert the same ldap passowrd if the local users was ldap user before upgrade