snipe / snipe-it

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

Error on Upgrade from 5.4 to 6.0 #11099

Closed Angl0r closed 2 years ago

Angl0r commented 2 years ago

Debug mode

Describe the bug

When Upgrading with upgrade.php i recive the Following Errors:

Step 5: Cleaning up old cached files:

√ No bootstrap/cache/compiled.php, so nothing to delete. √ No bootsrap/cache/services.php, so nothing to delete. √ No bootstrap/cache/config.php, so nothing to delete.

-- In ProviderRepository.php line 208:

Class 'Barryvdh\DomPDF\ServiceProvider' not found

-- In ProviderRepository.php line 208:

Class 'Barryvdh\DomPDF\ServiceProvider' not found

-- In ProviderRepository.php line 208:

Class 'Barryvdh\DomPDF\ServiceProvider' not found

-- In ProviderRepository.php line 208:

Class 'Barryvdh\DomPDF\ServiceProvider' not found

as well in Step 6:

Problem 1

and at the end:


Step 7: Migrating database:

In ProviderRepository.php line 208:

Class 'Barryvdh\DomPDF\ServiceProvider' not found


Step 8: Checking for OAuth keys:

√ OAuth keys detected. Skipping passport install.


Step 9: Taking application out of maintenance mode:

-- In ProviderRepository.php line 208:

Class 'Barryvdh\DomPDF\ServiceProvider' not found


got a clean page atm.

Reproduction steps

  1. Used 5.4.4
  2. run sudo -u www-data php upgrade.php
  3. get Errors ...

Expected behavior

Uprage fine to newest Major Version

Screenshots

No response

Snipe-IT Version

5.4.4 to 6.0.0

Operating System

Ubuntu 20.04

Web Server

Apache2

PHP Version

7.4.29

Operating System

Windows

Browser

Firefox

Version

100.0

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

AccelerentIT commented 2 years ago

Same problem for me.

LSNIGHTSHOT commented 2 years ago

Also have the same problem

athompsoncmc commented 2 years ago

Same here

The13thTimelord commented 2 years ago

I had the same issue when upgrading running:

composer self-update --2

This worked for us

athompsoncmc commented 2 years ago

I ran php upgrade.php again and it said I didn't have php sodium installed, I installed it and restarted my IIS Server, ran php upgrade.php and it works now.

Angl0r commented 2 years ago

I had the same issue when upgrading running:

composer self-update --2

This worked for us

tryed this in a dev environment, this works. But also have to accept that package meteor (or similar) has changed. But is this the correct way to do this or will this lead to other problems in further Releases is the question :D

jeffmcm64 commented 2 years ago

Same, can anyone confirm yet if composer self-update --2 is safe?

snipe commented 2 years ago

We’ve been using composer 2 for about a year - it’s safe. Also, if you run into any problems, you can always downgrade composer using composer self-update --1.

snipe commented 2 years ago

Can you folks let me know if upgrading composer resolves this for you?

LSNIGHTSHOT commented 2 years ago

Upgrading composer worked for me. Then re-ran php upgrade.php and it updated.

snipe commented 2 years ago

Great, thanks for the heads up. I wonder if I should attempt the upgrade of composer in the upgrade.php file to make this easier for folks.

jeffmcm64 commented 2 years ago

Can you folks let me know if upgrading composer resolves this for you?

I can confirm it worked for me.

tomck commented 2 years ago

I am on 5.3.8 and tried to run php upgrade.php and it failed (pastebin), so I found this thread and tried to run the composer upgrade and it failed. I had been warned previously not to just sudo/run as root, and my install was done via the install script (see issue #10581), so I'm not quite sure how it's failing. I confirmed I ran the install script not as sudo and not as root so upgrading composer not as root should still work, but doesn't.

tom@assets:/var/www/html/snipeit$ composer self-update --2
Upgrading to version 2.3.5 (2.x channel).

  [Composer\Downloader\FilesystemException]
  Filesystem exception:
  Composer update failed: "/usr/local/bin/composer" could not be written.
  rename(/home/tom/.cache/composer/composer-temp1376806.phar,/usr/local/bin/c
  omposer): Permission denied

self-update [-r|--rollback] [--clean-backups] [--no-progress] [--update-keys] [--stable] [--preview] [--snapshot] [--1] [--2] [--set-channel-only] [--] [<version>]

I'm also confused how, if permission was denied to run git in the php upgrade.php, that the script didn't just stop there and instead tried to continue on. Is there no error catch? (I wanted to create a new issue for this but I don't want to lie about trying debug mode.)

EDIT: It seems that everything is owned by snipeitapp, if I do the commands with sudo -u snipeitapp they work. This might be how the system was setup, so, maybe worthwhile for a doc somewhere. "See who owns the files, and try to run as them, not root." I did have to run the upgrade.php twice (there is no update.php even though it is referenced in the docs here), but it worked.

1eyeITguy commented 2 years ago

I was running v5.3.8 on Windows Server 2022 and tried updated to 6.0.7 with the same failure. I found this issue and tried running "composer self-update" Was running composer v2.2.4, that command updated me to v2.3.9. Tried running "php upgrade.php" again, and this time it said "MISSING PHP EXTENSION: sodium" I added "extension=php_sodium.dll" to php.ini, ran "php upgrade.php" again and this time it worked.

andrewc2 commented 2 years ago

Mine is telling me You are already using the latest available Composer version 2.3.9 (2.x channel). when I run composer self-update --2, but php upgrade.php is telling me I'm using compose 1?

snipe commented 2 years ago

It's possible you have composer installed both locally and globally, and the upgrader is using a different one than your CLI. I'd need to see the output of your upgrade.

andrewc2 commented 2 years ago
Log ``` -------------------------------------------------------- WELCOME TO THE SNIPE-IT UPGRADER! -------------------------------------------------------- This script will attempt to: - validate some very basic .env file settings - check your PHP version and extension requirements - check directory permissions - do a git pull to bring you to the latest version - run composer install to get your vendors up to date - run migrations to get your schema up to date - clear out old cache settings -------------------------------------------------------- STEP 1: Checking .env file: - Your .env is located at /home/t/snipe-it/.env -------------------------------------------------------- √ Your APP_KEY is not blank. √ Your APP_URL is not null or blank. It is set to https://snipe.domain.com √ Your APP_URL is set to https://snipe.domain.com and starts with the protocol (https:// or http://) √ Your APP_URL (https://snipe.domain.com) does not have a trailing slash. -------------------------------------------------------- STEP 2: Checking PHP requirements: -------------------------------------------------------- Current PHP version: (8.1.7) is at least 7.4.0 - continuing... FYI: The php.ini used by this PHP is: /opt/cpanel/ea-php81/root/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: -------------------------------------------------------- √ /home/t/snipe-it/bootstrap/cache is writable √ /home/t/snipe-it/storage is writable √ /home/t/snipe-it/storage/logs is writable √ /home/t/snipe-it/storage/logs/laravel.log is writable √ /home/t/snipe-it/storage/framework is writable √ /home/t/snipe-it/storage/framework/cache is writable √ /home/t/snipe-it/storage/framework/sessions is writable √ /home/t/snipe-it/storage/framework/views is writable √ /home/t/snipe-it/storage/app is writable √ /home/t/snipe-it/storage/app/backups is writable √ /home/t/snipe-it/storage/app/backup-temp is writable √ /home/t/snipe-it/storage/private_uploads is writable √ /home/t/snipe-it/public/uploads is writable -------------------------------------------------------- STEP 4: Backing up database: -------------------------------------------------------- -- In ProviderRepository.php line 208: Class "Barryvdh\DomPDF\ServiceProvider" not found -------------------------------------------------------- STEP 5: Putting application into maintenance mode: -------------------------------------------------------- -- In ProviderRepository.php line 208: Class "Barryvdh\DomPDF\ServiceProvider" 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 "Barryvdh\DomPDF\ServiceProvider" not found -- In ProviderRepository.php line 208: Class "Barryvdh\DomPDF\ServiceProvider" not found -- In ProviderRepository.php line 208: Class "Barryvdh\DomPDF\ServiceProvider" not found -- In ProviderRepository.php line 208: Class "Barryvdh\DomPDF\ServiceProvider" not found -------------------------------------------------------- STEP 8: Updating composer dependencies: (This may take a moment.) -------------------------------------------------------- -- Running the app in production mode. √ Local composer.phar detected, so we'll use that. -- Updating local composer.phar A new stable major version of Composer is available (2.3.9), run "composer self-update --2" to update to it. See also https://getcomposer.org/2 You are already using composer version 1.10.26 (1.x channel). You are using Composer 1 which is deprecated. You should upgrade to Composer 2, see https://blog.packagist.com/deprecating-composer-1-support/ Loading composer repositories with package information Installing dependencies from lock file Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for doctrine/dbal 3.3.6 -> satisfiable by doctrine/dbal[3.3.6]. - doctrine/dbal 3.3.6 requires composer-runtime-api ^2 -> no matching package found. Potential causes: - This package is not installable via Composer 1.x, see - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see for more details. - It's a private package and you forgot to add a custom repository to find it Read for further common problems. Deprecation Notice: Class ParsedownTest located in ./vendor/erusev/parsedown/test/ParsedownTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///home/t/snipe-it/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201 > Illuminate\Foundation\ComposerScripts::postAutoloadDump Deprecation Notice: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1277 Deprecation Notice: Return type of Illuminate\Support\Collection::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1288 Deprecation Notice: Return type of Illuminate\Support\Collection::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1300 Deprecation Notice: Return type of Illuminate\Support\Collection::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1315 Deprecation Notice: Return type of Illuminate\Support\Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1243 Deprecation Notice: Return type of Illuminate\Support\Collection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1233 Deprecation Notice: Return type of Illuminate\Support\Collection::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php:727 Deprecation Notice: Return type of Illuminate\Support\LazyCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Support/LazyCollection.php:1206 Deprecation Notice: Return type of Illuminate\Support\LazyCollection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Support/LazyCollection.php:1196 Deprecation Notice: Return type of Illuminate\Support\LazyCollection::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php:727 Deprecation Notice: Return type of Illuminate\Container\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Container.php:1232 Deprecation Notice: Return type of Illuminate\Container\Container::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Container.php:1243 Deprecation Notice: Return type of Illuminate\Container\Container::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Container.php:1255 Deprecation Notice: Return type of Illuminate\Container\Container::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Container.php:1268 Deprecation Notice: Return type of Dotenv\Environment\AbstractVariables::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/vlucas/phpdotenv/src/Environment/AbstractVariables.php:162 Deprecation Notice: Return type of Dotenv\Environment\AbstractVariables::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/vlucas/phpdotenv/src/Environment/AbstractVariables.php:170 Deprecation Notice: Return type of Dotenv\Environment\AbstractVariables::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/vlucas/phpdotenv/src/Environment/AbstractVariables.php:178 Deprecation Notice: Return type of Dotenv\Environment\AbstractVariables::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/vlucas/phpdotenv/src/Environment/AbstractVariables.php:186 Deprecation Notice: Return type of PhpOption\None::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/t/snipe-it/vendor/phpoption/phpoption/src/PhpOption/None.php:118 > @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 "Barryvdh\DomPDF\ServiceProvider" not found -------------------------------------------------------- STEP 9: Migrating database: -------------------------------------------------------- In ProviderRepository.php line 208: Class "Barryvdh\DomPDF\ServiceProvider" 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 "Barryvdh\DomPDF\ServiceProvider" not found ---------------------- FINISHED! ----------------------- All done! Clear your browser cookies and re-login to use your upgraded Snipe-IT! ```
snipe commented 2 years ago

-- Updating local composer.phar

That means you updated your global composer, but you're using composer.phar, so that one isn't updated.

Try:

php composer.phar update

snipe commented 2 years ago

(or php composer.phar self-update --2)

andrewc2 commented 2 years ago

That cleared up v1 composer issue, running into more issues but I think it's just compose mad that things aren't updated fully as I've had to make adjustments to server settings due to insufficient resources.