snipe / snipe-it

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

Unable to upgrade Snipe-IT to version 6 #11289

Closed cdubdubdub closed 2 years ago

cdubdubdub commented 2 years ago

Debug mode

Describe the bug

I am currently using Snipe-IT version 5.4.1 on Unbuntu server and I'm trying to upgrade to 6.0 via git: https://snipe-it.readme.io/docs/upgrading

This is my first time upgrading.

I followed this guide for installation: https://www.vultr.com/docs/how-to-install-snipe-it-on-ubuntu-20-04/

I am receiving what I believe to be permission errors, I'm just not sure on the process to follow to correct this:

admin@servername:/var/www/snipe-it$ php upgrade.php
--------------------------------------------------------
WELCOME TO THE SNIPE-IT UPGRADER!
--------------------------------------------------------

This script will attempt to:

- check your PHP version and extension requirements
- 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 PHP requirements:
--------------------------------------------------------

Current PHP version: (7.4.3) is at least 7.2.5 - continuing...
FYI: The php.ini used by this PHP is: /etc/php/7.4/cli/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!
√ tokenizer is installed!
√ xml is installed!
√ zip is installed!

--------------------------------------------------------
STEP 2: Backing up database:
--------------------------------------------------------

-- Starting backup...
Backup failed because: mkdir(): Permission denied.

--------------------------------------------------------
STEP 3: Putting application into maintenance mode:
--------------------------------------------------------

-- Failed to enter maintenance mode.
file_put_contents(/var/www/snipe-it/storage/framework/down): failed to open stre                                                                             am: Permission denied

--------------------------------------------------------
STEP 4: Pulling latest from Git (master branch):
--------------------------------------------------------

Git is installed.
error: cannot open .git/FETCH_HEAD: Permission denied
fatal: Unable to create '/var/www/snipe-it/.git/index.lock': Permission denied
error: cannot open .git/FETCH_HEAD: Permission denied
-- -- --
--------------------------------------------------------
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.

-- Configuration cache cleared!
-- Failed to clear cache. Make sure you have the appropriate permissions.
-- Route cache cleared!
-- Compiled views cleared!

--------------------------------------------------------
Step 6: Updating composer dependencies:
(This may take a moment.)
--------------------------------------------------------

-- We couldn't find a local composer.phar. No worries, trying globally.

> Illuminate\Foundation\ComposerScripts::postAutoloadDump
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/b                                                                             etter-reflection instead.
Package patchwork/utf8 is abandoned, you should avoid using it. Use symfony/poly                                                                             fill-mbstring or symfony/string instead.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use sym                                                                             fony/mailer instead.
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement                                                                              was suggested.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No rep                                                                             lacement was suggested.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
70 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Generating optimized autoload files
Generated optimized autoload files containing 6164 classes

--------------------------------------------------------
Step 7: Migrating database:
--------------------------------------------------------

Nothing to migrate.

--------------------------------------------------------
Step 8: Checking for OAuth keys:
--------------------------------------------------------

√ OAuth keys detected. Skipping passport install.

--------------------------------------------------------
Step 9: Taking application out of maintenance mode:
--------------------------------------------------------

-- Application is already up.

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

Reproduction steps

  1. Log into via SSH and run the below commands:

    admin@servername:~$ cd /var/www/snipe-it/
    admin@servername:/var/www/snipe-it$ git pull
    error: cannot open .git/FETCH_HEAD: Permission denied
  2. Ran the below due to the permission denied error: admin@servername:/var/www/snipe-it$ sudo git pull

Received below error:

fatal: unsafe repository ('/var/www/snipe-it' is owned by someone else)
To add an exception for this directory, call:

git config --global --add safe.directory /var/www/snipe-it
  1. Run the below commands to solve above issue:

    admin@servername:/var/www/snipe-it$ git config --global --add safe.directory /var/www/snipe-it
    admin@servername:/var/www/snipe-it$ sudo git config --global --add safe.directory /var/www/snipe-it 
  2. Run the below command again:
    admin@servername:/var/www/snipe-it$ sudo git pull

  3. Ran the below command to upgrade Snipe-IT: admin@servername:/var/www/snipe-it$ php upgrade.php

Received the below output:

admin@servername:/var/www/snipe-it$ php upgrade.php
--------------------------------------------------------
WELCOME TO THE SNIPE-IT UPGRADER!
--------------------------------------------------------

This script will attempt to:

- check your PHP version and extension requirements
- 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 PHP requirements:
--------------------------------------------------------

Current PHP version: (7.4.3) is at least 7.2.5 - continuing...
FYI: The php.ini used by this PHP is: /etc/php/7.4/cli/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!
√ tokenizer is installed!
√ xml is installed!
√ zip is installed!

--------------------------------------------------------
STEP 2: Backing up database:
--------------------------------------------------------

-- Starting backup...
Backup failed because: mkdir(): Permission denied.

--------------------------------------------------------
STEP 3: Putting application into maintenance mode:
--------------------------------------------------------

-- Failed to enter maintenance mode.
file_put_contents(/var/www/snipe-it/storage/framework/down): failed to open stre                                                                             am: Permission denied

--------------------------------------------------------
STEP 4: Pulling latest from Git (master branch):
--------------------------------------------------------

Git is installed.
error: cannot open .git/FETCH_HEAD: Permission denied
fatal: Unable to create '/var/www/snipe-it/.git/index.lock': Permission denied
error: cannot open .git/FETCH_HEAD: Permission denied
-- -- --
--------------------------------------------------------
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.

-- Configuration cache cleared!
-- Failed to clear cache. Make sure you have the appropriate permissions.
-- Route cache cleared!
-- Compiled views cleared!

--------------------------------------------------------
Step 6: Updating composer dependencies:
(This may take a moment.)
--------------------------------------------------------

-- We couldn't find a local composer.phar. No worries, trying globally.

> Illuminate\Foundation\ComposerScripts::postAutoloadDump
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/b                                                                             etter-reflection instead.
Package patchwork/utf8 is abandoned, you should avoid using it. Use symfony/poly                                                                             fill-mbstring or symfony/string instead.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use sym                                                                             fony/mailer instead.
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement                                                                              was suggested.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No rep                                                                             lacement was suggested.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
70 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Generating optimized autoload files
Generated optimized autoload files containing 6164 classes

--------------------------------------------------------
Step 7: Migrating database:
--------------------------------------------------------

Nothing to migrate.

--------------------------------------------------------
Step 8: Checking for OAuth keys:
--------------------------------------------------------

√ OAuth keys detected. Skipping passport install.

--------------------------------------------------------
Step 9: Taking application out of maintenance mode:
--------------------------------------------------------

-- Application is already up.

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

Expected behavior

The upgrade to be successful.

Screenshots

No response

Snipe-IT Version

5.4.1

Operating System

Ubuntu 20.04.4

Web Server

Apache

PHP Version

7.4.3

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

Permissions on /var/www/snipe-it:

admin@servername:/var/www/snipe-it$ ls -l
total 1624
-rwxr-xr-x  1 www-data www-data   3228 Mar 28 05:13 CODE_OF_CONDUCT.md
-rwxr-xr-x  1 www-data www-data    317 Mar 28 05:13 CONTRIBUTING.md
-rwxr-xr-x  1 www-data www-data   4352 Mar 28 05:13 Dockerfile
-rwxr-xr-x  1 www-data www-data   2530 Mar 28 05:13 Dockerfile.alpine
-rwxr-xr-x  1 www-data www-data   3642 Mar 28 05:13 Dockerfile.fpm-alpine
-rwxr-xr-x  1 www-data www-data  34519 Mar 28 05:13 LICENSE
-rwxr-xr-x  1 www-data www-data     57 Mar 28 05:13 Procfile
-rwxr-xr-x  1 www-data www-data  68205 Mar 28 05:13 README.md
-rwxr-xr-x  1 www-data www-data   1083 Mar 28 05:13 SECURITY.md
-rwxr-xr-x  1 www-data www-data   4586 Mar 28 05:13 Vagrantfile
-rwxr-xr-x  1 www-data www-data      0 Mar 28 05:13 _config.yml
drwxr-xr-x  4 www-data www-data   4096 Mar 28 05:13 ansible
drwxr-xr-x 18 www-data www-data   4096 Mar 28 05:13 app
-rwxr-xr-x  1 www-data www-data   5764 Mar 28 05:13 app.json
-rwxr-xr-x  1 www-data www-data   1646 Mar 28 05:13 artisan
drwxr-xr-x  3 www-data www-data   4096 Mar 28 05:13 bootstrap
-rwxr-xr-x  1 www-data www-data   9210 Mar 28 05:13 c3.php
-rwxr-xr-x  1 www-data www-data    373 Mar 28 05:13 codeception.yml
-rwxr-xr-x  1 www-data www-data   3259 Mar 28 05:13 composer.json
-rwxr-xr-x  1 www-data www-data 435156 Mar 28 05:16 composer.lock
drwxr-xr-x  2 www-data www-data   4096 Mar 28 05:13 config
-rwxr-xr-x  1 www-data www-data    214 Mar 28 05:13 crowdin.yml
drwxr-xr-x  5 www-data www-data   4096 Mar 28 05:13 database
drwxr-xr-x  2 www-data www-data   4096 Mar 28 05:13 docker
-rwxr-xr-x  1 www-data www-data    707 Mar 28 05:13 docker-compose.yml
drwxr-xr-x  2 www-data www-data   4096 Mar 28 05:13 heroku
-rwxr-xr-x  1 www-data www-data    956 Mar 28 05:13 index.html
-rwxr-xr-x  1 www-data www-data    371 Mar 28 05:13 install.sh
-rwxr-xr-x  1 www-data www-data 901534 Mar 28 05:13 package-lock.json
-rwxr-xr-x  1 www-data www-data   1996 Mar 28 05:13 package.json
-rwxr-xr-x  1 www-data www-data   2376 Mar 28 05:13 phpmd.xml
-rwxr-xr-x  1 www-data www-data   1097 Mar 28 05:13 phpunit.xml
drwxr-xr-x  6 www-data www-data   4096 Mar 29 03:51 public
drwxr-xr-x  6 www-data www-data   4096 Mar 28 05:13 resources
drwxr-xr-x  3 www-data www-data   4096 Mar 28 05:13 routes
drwxr-xr-x  2 www-data www-data   4096 Mar 28 05:13 sample_csvs
-rwxr-xr-x  1 www-data www-data    567 Mar 28 05:13 server.php
-rwxr-xr-x  1 www-data www-data  26289 Mar 28 05:13 snipeit.sh
drwxr-xr-x  7 www-data www-data   4096 Mar 29 03:51 storage
drwxr-xr-x 10 www-data www-data   4096 Mar 28 05:13 tests
-rwxr-xr-x  1 www-data www-data   9657 Mar 28 05:13 upgrade.php
drwxr-xr-x 67 www-data www-data   4096 Mar 28 05:17 vendor
-rwxr-xr-x  1 www-data www-data   7565 Mar 28 05:13 webpack.mix.js
welcome[bot] commented 2 years ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

snipe commented 2 years ago

Backup failed because: mkdir(): Permission denied. file_put_contents(/var/www/snipe-it/storage/framework/down): failed to open stre am: Permission denied fatal: Unable to create '/var/www/snipe-it/.git/index.lock': Permission denied

You have permissions problems, per the error messages.

Make sure your .git, storage, and bootstrap directories - and subdirectories - are writable by the web server and the user that you're running the updater as. I can't advise you on those permissions since I don't know how your users and group permissions are set up on that server, or what user your web server runs as - or run the upgrader and other artisan commands using su - so you can run them as the web server's user.

Side note: I really wish people would stick to the official docs as much as possible.

cdubdubdub commented 2 years ago

Backup failed because: mkdir(): Permission denied. file_put_contents(/var/www/snipe-it/storage/framework/down): failed to open stre am: Permission denied fatal: Unable to create '/var/www/snipe-it/.git/index.lock': Permission denied

You have permissions problems, per the error messages.

Make sure your .git, storage, and bootstrap directories - and subdirectories - are writable by the web server and the user that you're running the updater as. I can't advise you on those permissions since I don't know how your users and group permissions are set up on that server, or what user your web server runs as - or run the upgrader and other artisan commands using su - so you can run them as the web server's user.

Side note: I really wish people would stick to the official docs as much as possible.

Thank you for your prompt response, I'll ensure I stick to the official documentation moving forward.

Below is the information regarding what user my web server runs as:

admin@servername:/var/www/snipe-it$ ps aux | grep apache2
root         849  0.0  2.8 241972 28668 ?        Ss   20:06   0:00 /usr/sbin/apache2 -k start
www-data     860  0.0  4.3 250992 43028 ?        S    20:06   0:00 /usr/sbin/apache2 -k start
www-data     861  0.0  4.2 251168 42208 ?        S    20:06   0:00 /usr/sbin/apache2 -k start
www-data     863  0.0  4.3 251048 43640 ?        S    20:06   0:00 /usr/sbin/apache2 -k start
www-data     864  0.0  4.2 251000 42760 ?        S    20:06   0:00 /usr/sbin/apache2 -k start
www-data    1172  0.0  4.2 248664 42376 ?        S    20:09   0:00 /usr/sbin/apache2 -k start
www-data    1199  0.0  4.2 250860 42916 ?        S    20:09   0:00 /usr/sbin/apache2 -k start
www-data    1208  0.0  4.5 251112 45208 ?        S    20:10   0:00 /usr/sbin/apache2 -k start
www-data    1209  0.0  5.0 253256 50652 ?        S    20:10   0:00 /usr/sbin/apache2 -k start
www-data    1210  0.0  4.1 250532 41416 ?        S    20:10   0:00 /usr/sbin/apache2 -k start
www-data    1885  0.0  1.3 242476 13976 ?        S    20:26   0:00 /usr/sbin/apache2 -k start
admin    2770  0.0  0.2   8160  2528 pts/0    S+   22:30   0:00 grep --color=auto apache2

Does that give you enough information to advise on the permission changes please?

snipe commented 2 years ago

Try:

ls -al storage
ls -al bootstrap
ls -al .git
snipe commented 2 years ago

It looks like your processes are running as www-data (which is pretty standard.

So you'd want something like:

chown -R www-data storage; chmod 755 -R storage; for each of those directories you're seeing errors in...

And then to upgrade you'd run something like su - www-data php upgrade.php

cdubdubdub commented 2 years ago

ls -al .git

Thank you, please see output below:

admin@servername:/var/www/snipe-it$ ls -al storage
total 36
drwxr-xr-x  7 www-data www-data 4096 Mar 29 03:51 .
drwxr-xr-x 18 www-data www-data 4096 Jun  3 05:43 ..
drwxr-xr-x  4 www-data www-data 4096 Jun  3 03:09 app
drwxr-xr-x  2 www-data www-data 4096 Apr  7 22:21 debugbar
drwxr-xr-x  5 www-data www-data 4096 Mar 28 05:13 framework
drwxr-xr-x  2 www-data www-data 4096 Mar 28 05:18 logs
-rw-r--r--  1 www-data www-data 3292 Mar 29 03:51 oauth-private.key
-rw-r--r--  1 www-data www-data  812 Mar 29 03:51 oauth-public.key
drwxr-xr-x  9 www-data www-data 4096 Mar 28 05:13 private_uploads

admin@servername:/var/www/snipe-it$ ls -al bootstrap
total 20
drwxr-xr-x  3 www-data www-data 4096 Mar 28 05:13 .
drwxr-xr-x 18 www-data www-data 4096 Jun  3 05:43 ..
-rwxr-xr-x  1 www-data www-data 1602 Mar 28 05:13 app.php
-rwxr-xr-x  1 www-data www-data 1079 Mar 28 05:13 autoload.php
drwxr-xr-x  2 www-data www-data 4096 Mar 28 05:18 cache

admin@servername:/var/www/snipe-it$ ls -al .git
total 816
drwxr-xr-x  8 www-data www-data   4096 Jun  9 20:34 .
drwxr-xr-x 18 www-data www-data   4096 Jun  3 05:43 ..
-rw-r--r--  1 root     root       8306 Jun  9 20:34 FETCH_HEAD
-rwxr-xr-x  1 www-data www-data     23 Mar 28 05:13 HEAD
-rw-r--r--  1 root     root         41 Jun  9 20:34 ORIG_HEAD
drwxr-xr-x  2 www-data www-data   4096 Mar 28 05:13 branches
-rwxr-xr-x  1 www-data www-data    258 Mar 28 05:13 config
-rwxr-xr-x  1 www-data www-data     73 Mar 28 05:13 description
drwxr-xr-x  2 www-data www-data   4096 Mar 28 05:13 hooks
-rwxr-xr-x  1 www-data www-data 754824 Mar 28 05:13 index
drwxr-xr-x  2 www-data www-data   4096 Mar 28 05:13 info
drwxr-xr-x  3 www-data www-data   4096 Mar 28 05:13 logs
drwxr-xr-x  4 www-data www-data   4096 Mar 28 05:13 objects
-rwxr-xr-x  1 www-data www-data  15945 Mar 28 05:13 packed-refs
drwxr-xr-x  5 www-data www-data   4096 Mar 28 05:13 refs
snipe commented 2 years ago

And what is the output when you run su - www-data php upgrade.php?

snipe commented 2 years ago

(I do see some things owned by root in that git directory. Please run the corrective chmod/chown commands I gave you previously. You may need to run them as root.)

cdubdubdub commented 2 years ago

Thank you, I will give that a try and let you know the outcome.

cdubdubdub commented 2 years ago

I made the permission changes, but I'm not sure how to authenticate using www-data, so I will need to figure that out first:

admin@servername:/var/www/snipe-it$ su - www-data php upgrade.php
Password:
su: Authentication failure
snipe commented 2 years ago

Try running it as root or sudo

cdubdubdub commented 2 years ago

Thank you, I receive the below error when I run as sudo:

admin@servername:/var/www/snipe-it$ su - www-data php upgrade.php
Password:
su: Authentication failure
admin@servername:/var/www/snipe-it$ sudo php upgrade.php
[sudo] password for admin:

ERROR: This script should not be run as root/admin. Exiting.

And I seem to be getting an authentication error when su as root:

admin@servername:/var/www/snipe-it$ su - root php upgrade.php
Password:
su: Authentication failure
admin@servername:/var/www/snipe-it$

I'll need to figure that out and get back to you, as I'm pretty confident that I'm using the correct password.

cdubdubdub commented 2 years ago

I don't appear to be able to run as root either:

root@servername:~# cd /var/www/snipe-it/
root@servername:/var/www/snipe-it# php upgrade.php

ERROR: This script should not be run as root/admin. Exiting.
snipe commented 2 years ago

You'd want to make those permission and ownership changes AS root, then switch to www-data to run the upgrader. Nothing the upgrader touches should ever be run as root, otherwise, you'd end up changing file permissions and breaking stuff - which is what I suspect may have happened with your install (or it was installed that way.) It's common, but once you get it all sorted, you'll always want to run it AS root, but using the su - www-data php upgrade.php version, so that anything that changes is still owned by the right user.

snipe commented 2 years ago

We prevent you from running the upgrader as root for exactly that reason. If the update adds new directories or files, they'll be owned by root if you run the upgrader AS root without the - www-data flag that tells it to perform the action as the user you specify.

cdubdubdub commented 2 years ago

Thank you, that makes sense. I ran the permission changes as root, but when I try to switch to www-data, it tells me the account is not available. I'm super familiar with setting up Apache or webservers, but I assume this was an account that was created during the installation of Apache. Any idea's how I can get around this please?

root@servername:~# cd /var/www/snipe-it/
root@servername:/var/www/snipe-it# chown -R www-data storage; chmod 755 -R                                                                              storage;
root@servername:/var/www/snipe-it# chown -R www-data bootstrap; chmod 755                                                                              -R bootstrap;
root@servername:/var/www/snipe-it# chown -R www-data .git; chmod 755 -R .g                                                                             it;
root@servername:/var/www/snipe-it# su www-data
This account is currently not available.
snipe commented 2 years ago

I think you need to try sudo -u www-data php upgrade.php to run just THAT command as the web server user. (You need the dash.)

cdubdubdub commented 2 years ago

Ah gotcha, ok that seems to have worked, or at least ran the upgrade. However, I'm getting an error 500 now when I try to access Snipe-IT through the web browser, so I'll need to figure that out, but thank you for all your assistance. Much appreciated!

--------------------------------------------------------
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 /var/www/snipe-it/.env
--------------------------------------------------------

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

--------------------------------------------------------
STEP 2: Checking PHP requirements:
--------------------------------------------------------

Current PHP version: (7.4.3) is at least 7.4.0 - continuing...
FYI: The php.ini used by this PHP is: /etc/php/7.4/cli/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 'Tightenco\Ziggy\ZiggyServiceProvider' not found

--------------------------------------------------------
STEP 5: Putting application into maintenance mode:
--------------------------------------------------------

--
In ProviderRepository.php line 208:

  Class 'Tightenco\Ziggy\ZiggyServiceProvider' 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.
√ Deleting vendor/symfony/translation/TranslatorInterface.php. It is no longer u                                                                             sed.

--
In ProviderRepository.php line 208:

  Class 'Tightenco\Ziggy\ZiggyServiceProvider' not found

--
In ProviderRepository.php line 208:

  Class 'Tightenco\Ziggy\ZiggyServiceProvider' not found

--
In ProviderRepository.php line 208:

  Class 'Tightenco\Ziggy\ZiggyServiceProvider' not found

--
In ProviderRepository.php line 208:

  Class 'Tightenco\Ziggy\ZiggyServiceProvider' 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: 41 installs, 51 updates, 8 removals
Cannot create cache directory /var/www/.cache/composer/files/, or directory is n                                                                             ot writable. Proceeding without cache
  - Downloading symfony/deprecation-contracts (v2.5.1)
  - Syncing psr/http-client (1.0.1) into cache
Cloning failed using an ssh key for authentication, enter your GitHub credential                                                                             s to access private repos
When working with _public_ GitHub repositories only, head to https://github.com/                                                                             settings/tokens/new?scopes=&description=Composer+on+d2-bpm-itam1-vma+2022-06-10+                                                                             0058 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://git                                                                             hub.com/settings/tokens/new?scopes=repo&description=Composer+on+d2-bpm-itam1-vma                                                                             +2022-06-10+0058
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 "/var/www/.config/composer/auth.json" for                                                                              future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentic                                                                             ation-for-private-packages.md#github-oauth
Token (hidden):

  [ErrorException]
  file_put_contents(/var/www/.config/composer/auth.json): failed to open stream: No such file or directory

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] [--] [<packages>]...

> 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 'Tightenco\Ziggy\ZiggyServiceProvider' not found

--------------------------------------------------------
STEP 9: Migrating database:
--------------------------------------------------------

In ProviderRepository.php line 208:

  Class 'Tightenco\Ziggy\ZiggyServiceProvider' 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 'Tightenco\Ziggy\ZiggyServiceProvider' not found

---------------------- FINISHED! -----------------------
All done! Clear your browser cookies and re-login to use
your upgraded Snipe-IT!
--------------------------------------------------------
cdubdubdub commented 2 years ago

I was getting the below error from the debug. However, I don't want to put too much time into this as we will be moving to the hosted solution soon, so restoring my VM for now. Maybe I'll have a play around in my own time and rebuild following the official documentation. Thank you for your assistance!

Illuminate\Contracts\Container\BindingResolutionException thrown with message "Target class [Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance] does not exist."

Stacktrace:
#9 Illuminate\Contracts\Container\BindingResolutionException in /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Container.php:805
#8 ReflectionException in /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Container.php:803
#7 ReflectionClass:__construct in /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Container.php:803
#6 Illuminate\Container\Container:build in /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Container.php:681
#5 Illuminate\Container\Container:resolve in /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:785
#4 Illuminate\Foundation\Application:resolve in /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Container.php:629
#3 Illuminate\Container\Container:make in /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:770
#2 Illuminate\Foundation\Application:make in /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:209
#1 Illuminate\Foundation\Http\Kernel:terminateMiddleware in /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:183
#0 Illuminate\Foundation\Http\Kernel:terminate in /var/www/snipe-it/public/index.php:55
snipe commented 2 years ago

We don't use Ziggy anymore, so this definitely sounds like some caching stuff. v6 does not use that library, so the only reason it would be looking for that is if something is cached.

Cannot create cache directory /var/www/.cache/composer/files/, or directory is

This is likely the problem tbh.

Good news is, if you switch to hosted, this is our problem, not yours ;)

snipe commented 2 years ago

I think composer was installed globally as root, and so any other permission other than root (which no one should use for upgrades) is going to be tough. If you want to tough it out, I wrote some docs here: https://snipe.net/2017/11/15/so-you-ran-composer-as-root/

Snipe.Net
So you ran composer as root... - Snipe.Net
Composer is a PHP dependency manager that’s used in just about any modern PHP application, and it works similarly to how Bundler works for Ruby. Even though Composer itself gives you a warning about not running it as root, lots of people disregard this warning and run it as root anyway. We run into this […]
cdubdubdub commented 2 years ago

Thank you! I will give that a go.

cdubdubdub commented 2 years ago

I ended up just building a new server and following the official documentation. However, when I go to install composer, this is where I run into issues: https://snipe-it.readme.io/docs/install-dependencies

When running the below, do I run this from the location where I installed Snipe-IT? i.e. /var/www/html/snipe-it

cd <install-dir>
curl -sS https://getcomposer.org/installer | php
php composer.phar install --no-dev --prefer-source

Thank you!

Snipe-IT Documentation
Install Dependencies
Composer is a package manager for PHP that allows us to manage the dependencies for the various vendor packages we utilize in Snipe-IT. Vendor packages are PHP libraries that someone else wrote, and that we use in Snipe-IT to help make it awesome. These are not the same thing as the system requireme...
uberbrady commented 2 years ago

Yes, you run that from your snipe-it directory.

cdubdubdub commented 2 years ago

Yes, you run that from your snipe-it directory.

Awesome, thank you.

DoK44 commented 2 years ago

I have the same Ziggy problem when I tried to upgrade to V6:

Generating optimized autoload files

In ProviderRepository.php line 208:

Class "Tightenco\Ziggy\ZiggyServiceProvider" not found


STEP 9: Migrating database:

In ProviderRepository.php line 208:

Class "Tightenco\Ziggy\ZiggyServiceProvider" 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 "Tightenco\Ziggy\ZiggyServiceProvider" not found

I tried to clear cache but same error: Class "Tightenco\Ziggy\ZiggyServiceProvider" not found

How can I fix this?

Thanks

snipe commented 2 years ago

Hi there - We haven't heard back in a bit, so I'm going to close this ticket for now, but will re-open it if you're still having issues.

hackerman-hacking

rkthamizhan commented 1 year ago

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

Git is installed. Already on 'master' error: unable to unlink old 'public/uploads/barcodes/invalid_barcode.gif': Permi ssion denied error: unable to unlink old 'storage/private_uploads/signatures/.gitkeep': Permi ssion denied fatal: Could not reset index file to revision 'HEAD'. error: The following untracked working tree files would be overwritten by merge: .github/workflows/tests.yml app/Http/Controllers/Api/LabelsController.php app/Http/Controllers/LabelsController.php app/Http/Livewire/CategoryEditForm.php app/Http/Transformers/LabelsTransformer.php app/Models/Labels/DefaultLabel.php app/Models/Labels/Field.php app/Models/Labels/FieldOption.php app/Models/Labels/Label.php app/Models/Labels/RectangleSheet.php app/Models/Labels/Sheet.php app/Models/Labels/Sheets/Avery/L7162.php app/Models/Labels/Sheets/Avery/L7162_A.php app/Models/Labels/Sheets/Avery/L7162_B.php app/Models/Labels/Sheets/Avery/L7163.php app/Models/Labels/Sheets/Avery/L7163_A.php app/Models/Labels/Sheets/Avery/_5267.php app/Models/Labels/Sheets/Avery/_5267_A.php app/Models/Labels/Sheets/Avery/_5520.php app/Models/Labels/Sheets/Avery/_5520_A.php app/Models/Labels/Tapes/Brother/TZe_12mm.php app/Models/Labels/Tapes/Brother/TZe_12mm_A.php app/Models/Labels/Tapes/Brother/TZe_24mm.php app/Models/Labels/Tapes/Brother/TZe_24mm_A.php app/Models/Labels/Tapes/Dymo/LabelWriter.php app/Models/Labels/Tapes/Dymo/LabelWriter_30252.php app/Presenters/LabelPresenter.php app/View/Label.php database/migrations/2022_10_25_215520_add_label2_settings.php database/migrations/2023_08_13_172600_add_email_to_companies.php database/migrations/2023_08_21_064609_add_name_ordering_to_settings.php public/js/dist/all-defer.js resources/lang/en/admin/labels/message.php resources/lang/en/admin/labels/table.php resources/views/livewire/category-edit-form.blade.php resources/views/models/custom_fields_form_bulk_edit.blade.php resources/views/partials/label2-field-definitions.blade.php resources/views/partials/label2-preview.blade.php tests/Feature/Api/Users/UpdateUserApiTest.php tests/Feature/Livewire/CategoryEditFormTest.php tests/Feature/Reports/CustomReportTest.php Please move or remove them before you merge. Aborting -- Saved working directory and index state WIP on master: c52a1f94d Merge remote -tracking branch 'origin/develop' -- M public/uploads/barcodes/invalid_barcode.gif M storage/private_uploads/signatures/.gitkeep Your branch is behind 'origin/master' by 539 commits, and can be fast-forwarded. (use "git pull" to update your local branch) -- Updating c52a1f94d..8384786e8