snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.13k stars 3.19k forks source link

Upgrade 6.0.14 to newest 6.1 - failed and now access to GUI now #13126

Closed splork closed 1 year ago

splork commented 1 year ago

Debug mode

Describe the bug

Upgraded to newest 6.1 version and can no longer access GUI using same URL as previously. Here is the output from the upgrade:

WELCOME TO THE SNIPE-IT UPGRADER!

This script will attempt to:


STEP 1: Checking .env file:

√ Your APP_KEY is not blank. √ Your APP_URL is not null or blank. It is set to http://snipe.lan √ Your APP_URL is set to http://snipe.lan and starts with the protocol (https:// or http://) √ Your APP_URL (http://snipe.lan) does not have a trailing slash.


STEP 2: Checking PHP requirements:

Current PHP version: (7.4.30) is at least 7.4.0 - continuing... FYI: The php.ini used by this PHP is: /etc/php.ini

Checking Required PHP extensions...

√ bcmath is installed! √ curl is installed! √ fileinfo is installed! √ gd is installed! √ json is installed! √ ldap is installed! √ mbstring is installed! √ mysqli is installed! √ openssl is installed! √ PDO is installed! √ sodium is installed! √ tokenizer is installed! √ xml is installed! √ zip is installed!


STEP 3: Checking directory permissions:

√ /var/www/snipe-it/bootstrap/cache is writable √ /var/www/snipe-it/storage is writable √ /var/www/snipe-it/storage/logs is writable √ /var/www/snipe-it/storage/logs/laravel.log is writable √ /var/www/snipe-it/storage/framework is writable √ /var/www/snipe-it/storage/framework/cache is writable √ /var/www/snipe-it/storage/framework/sessions is writable √ /var/www/snipe-it/storage/framework/views is writable √ /var/www/snipe-it/storage/app is writable √ /var/www/snipe-it/storage/app/backups is writable √ /var/www/snipe-it/storage/app/backup-temp is writable √ /var/www/snipe-it/storage/private_uploads is writable √ /var/www/snipe-it/public/uploads is writable


STEP 4: Backing up database:

-- In ProviderRepository.php line 208:

Class 'Laravel\Socialite\SocialiteServiceProvider' not found


STEP 5: Putting application into maintenance mode:

-- In ProviderRepository.php line 208:

Class 'Laravel\Socialite\SocialiteServiceProvider' not found


STEP 6: Pulling latest from Git (master branch):

Git is installed. Already on 'master' -- No local changes to save -- Your branch is up to date with 'origin/master'. -- Already up to date.


STEP 7: Cleaning up old cached files:

√ No bootstrap/cache/compiled.php, so nothing to delete. √ No bootstrap/cache/services.php, so nothing to delete. √ No bootstrap/cache/config.php, so nothing to delete. √ No vendor/symfony/translation/TranslatorInterface.php, so nothing to delete.

-- In ProviderRepository.php line 208:

Class 'Laravel\Socialite\SocialiteServiceProvider' not found

-- In ProviderRepository.php line 208:

Class 'Laravel\Socialite\SocialiteServiceProvider' not found

-- In ProviderRepository.php line 208:

Class 'Laravel\Socialite\SocialiteServiceProvider' not found

-- In ProviderRepository.php line 208:

Class 'Laravel\Socialite\SocialiteServiceProvider' not found


STEP 8: Updating composer dependencies: (This may take a moment.)

-- Running the app in production mode. -- We couldn't find a local composer.phar. No worries, trying globally. Since you are running composer globally, we won't try to update it for you. If you run into issues with this step, try running composer self-update before running this updater again

Installing dependencies from lock file Verifying lock file contents can be installed on current platform. Package operations: 3 installs, 60 updates, 0 removals

In GitDownloader.php line 246:

Failed to execute git show-ref --head -d

fatal: detected dubious ownership in repository at '/var/www/snipe-it/vendor/symfony/polyfill-php80' To add an exception for this directory, call:

    git config --global --add safe.directory /var/www/snipe-it/vendor/symfony/polyfill-php80

install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [...]

Class ParsedownTest located in ./vendor/erusev/parsedown/test/ParsedownTest.php does not comply with psr-0 autoloading standard. Skipping.

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1 Generating optimized autoload files

In ProviderRepository.php line 208:

Class 'Laravel\Socialite\SocialiteServiceProvider' not found


STEP 9: Migrating database:

In ProviderRepository.php line 208:

Class 'Laravel\Socialite\SocialiteServiceProvider' not found


STEP 10: Checking for OAuth keys:

√ OAuth keys detected. Skipping passport install.


STEP 11: Taking application out of maintenance mode:

-- In ProviderRepository.php line 208:

Class 'Laravel\Socialite\SocialiteServiceProvider' not found

---------------------- FINISHED! ----------------------- All done! Clear your browser cookies and re-login to use your upgraded Snipe-IT!

[snipeit@WCS-snipeIT-01 snipe-it]$

splork commented 1 year ago

This is from the debug:

Illuminate \ Contracts \ Container \ BindingResolutionException Target class [session] does not exist. Previous exceptions Class session does not exist (-1)

splork commented 1 year ago

Fixed:

I added the git config line from below and every time I upgrade.php it would give a new line. Did about 20 of them and it finally worked.

In GitDownloader.php line 248:

Failed to execute git show-ref --head -d

fatal: detected dubious ownership in repository at '/var/www/snipe-it/vendor/nyholm/psr7'

To add an exception for this directory, call:

    git config --global --add safe.directory /var/www/snipe-it/vendor/nyholm/psr7
marcusmoore commented 1 year ago

Hi there @splork, glad you got it working but it would be a lot better if you didn't have to keep running the command over and over...what platform are you using?

splork commented 1 year ago

Centos 7

On Wed, Jun 7, 2023, 4:45 PM Marcus Moore @.***> wrote:

Hi there @splork https://github.com/splork, glad you got it working but it would be a lot better if you didn't have to keep running the command over and over...what platform are you using?

— Reply to this email directly, view it on GitHub https://github.com/snipe/snipe-it/issues/13126#issuecomment-1581482355, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXPEOKQ5FD5WUQQADUXS3LXKDR5RANCNFSM6AAAAAAY5AXJYE . You are receiving this because you were mentioned.Message ID: @.***>

marcusmoore commented 1 year ago

Thanks for the response.

I'm going to close this since you got around the issues you experienced but we'll keep track of it if anyone else runs into the same problem.

stf675 commented 1 year ago

Hello,

I got the same problem after running ./upgrade.php from 6.0.14 to latest.

I searched for GitDownloader.php but that file dose not exist.

at this time I am getting 500 error.

`

STEP 4: Backing up database:

-- In ProviderRepository.php line 208:

Class "Laravel\Socialite\SocialiteServiceProvider" not found


STEP 5: Putting application into maintenance mode:

-- In ProviderRepository.php line 208:

Class "Laravel\Socialite\SocialiteServiceProvider" not found


STEP 6: Pulling latest from Git (master branch):

Git is installed. Already on 'master' -- No local changes to save -- Your branch is up to date with 'origin/master'. -- Already up to date.


STEP 7: Cleaning up old cached files:

v No bootstrap/cache/compiled.php, so nothing to delete. v No bootstrap/cache/services.php, so nothing to delete. v No bootstrap/cache/config.php, so nothing to delete. v No vendor/symfony/translation/TranslatorInterface.php, so nothing to delete.

-- In ProviderRepository.php line 208:

Class "Laravel\Socialite\SocialiteServiceProvider" not found

-- In ProviderRepository.php line 208:

Class "Laravel\Socialite\SocialiteServiceProvider" not found

-- In ProviderRepository.php line 208:

Class "Laravel\Socialite\SocialiteServiceProvider" not found

-- In ProviderRepository.php line 208:

Class "Laravel\Socialite\SocialiteServiceProvider" not found


STEP 8: Updating composer dependencies: (This may take a moment.)

-- Running the app in production mode. -- We couldn't find a local composer.phar. No worries, trying globally. Since you are running composer globally, we won't try to update it for you. If you run into issues with this step, try running composer self-update before running this updater again

sh: composer: command not found sh: composer: command not found


STEP 9: Migrating database:

In ProviderRepository.php line 208:

Class "Laravel\Socialite\SocialiteServiceProvider" not found


STEP 10: Checking for OAuth keys:

v OAuth keys detected. Skipping passport install.


STEP 11: Taking application out of maintenance mode:

-- In ProviderRepository.php line 208:

Class "Laravel\Socialite\SocialiteServiceProvider" not found `

marcusmoore commented 1 year ago

Hi @stf675

This line stood out to me: sh: composer: command not found can you verify that you can run composer successfully? It seems like it is not installed on the system anymore?

stf675 commented 1 year ago

since initial setup over year ago, php ./upgrade.php always worked. this time after it broke on v 6.1.12, I ran php ./upgrade.php v6.1.0 and I got back to 6.1.0 and it worked - tried 6.1.2 and it failed same error

tried few time back and forth with same results

stf675 commented 1 year ago

so going from 6.1.0 to 6.1.1 or 6.1.2 ends up with those errors

6.1.0 is good

marcusmoore commented 1 year ago

Sorry you're having issues with this.

Can you try the following:

  1. Upgrade to the latest using the upgrade script (knowing that it will fail)
  2. Run composer install --no-dev --prefer-source manually and confirm it runs successfully (and install Socialite)
  3. Run the upgrade again and hopefully it runs successfully
  4. Let me know how it goes
stf675 commented 1 year ago

running #2 produce lots of "Synching...... into cache

then

Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
When working with _public_ GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer+on+devsnipeit.wolve.com+2023-08-03+2126 to retrieve a token.
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+devsnipeit.wolve.com+2023-08-03+2126
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in "/home/snipeit/.config/composer/auth.json" for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
Token (hidden):
    Update of symfony/deprecation-contracts failed
  - Upgrading guzzlehttp/psr7 (2.2.1 => 2.4.0): Checking out 13388f0095 from cache
Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
When working with _public_ GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer+on+devsnipeit.wolve.com+2023-08-03+2126 to retrieve a token.
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+devsnipeit.wolve.com+2023-08-03+2126
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in "/home/snipeit/.config/composer/auth.json" for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
Token (hidden):

hitting enter not helping. CTRL-C messing up shell.

rebooted, ran upgrade.php - error 500

ran upgrade.php v6.1.0 back to ver 6.1.0 and working

marcusmoore commented 1 year ago

hitting enter not helping

That's odd...Did you generate a token and paste it in before hitting enter?

stf675 commented 1 year ago

it did not prompt me, and I am not really know what token that should be.

marcusmoore commented 1 year ago

The message might be confusing because you're not accessing "private repos" but the prompt was at the top of your snippet:

Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
When working with _public_ GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer+on+devsnipeit.wolve.com+2023-08-03+2126 to retrieve a token.
This token will have read-only permission for public information only.

You usually won't get prompted for this but it can occur when composer install or composer update are run multiple times in a short amount of time and GitHub starts rate-limiting your IP address.

I would give the steps mentioned above and generate and paste in the token if prompted.

stf675 commented 1 year ago

Fixed,

As you suggested....

ran

sudo php ./composer.phar install --no-dev --prefer-source

confirmed bunch of smaller updates, re-ran uograde.php, it updated some dependencies and now I am on 6.1.2