ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Snipe-IT Upgrade from 4.6.7 to 4.7.5 not working.

    IT Discussion
    3
    10
    3.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • jrcJ
      jrc
      last edited by jrc

      Ubuntu Server 18.04 LTS with all the latest updates (as of today).

      I tried running php upgrade.php and got:

      Welcome to the Snipe-IT upgrader.
      
      Please note that this script will not download the latest Snipe-IT 
      files for you unless you have git installed. 
      It simply runs the standard composer and artisan 
      commands needed to finalize the upgrade after. 
      
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      !! If you have any encrypted custom fields, BE SURE TO run the recrypter if upgrading from v3 to v4. 
      !! See the Snipe-IT documentation for help: 
      !! https://snipe-it.readme.io/docs/upgrading-to-v4
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      --------------------------------------------------------
      STEP 1: Backing up database: 
      --------------------------------------------------------
      
      -- Starting backup...
      Dumping database snipeit_data...
      Backup failed because The dump process failed with exitcode 2 : Misuse of shell builtins : sh: 1: cannot create /var/www/snipe-it/storage/laravel-backups/temp//snipeit_data.sql: Directory nonexistent
      .
      Backup failed because: The stream or file "/var/www/snipe-it/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied.
      
      In StreamHandler.php line 107:
                                                                                                
        The stream or file "/var/www/snipe-it/storage/logs/laravel.log" could not be opened: f  
        ailed to open stream: Permission denied                                                 
                                                                                                
      
      
      
      --------------------------------------------------------
      STEP 2: Putting application into maintenance mode: 
      --------------------------------------------------------
      
      -- 
      In StreamHandler.php line 107:
                                                                                                
        The stream or file "/var/www/snipe-it/storage/logs/laravel.log" could not be opened: f  
        ailed to open stream: Permission denied                                                 
                                                                                                
      
      
      
      --------------------------------------------------------
      STEP 3: Pulling latest from Git (master branch): 
      --------------------------------------------------------
      
      Git is installed. 
      fatal: Unable to create '/var/www/snipe-it/.git/index.lock': Permission denied
      fatal: Unable to create '/var/www/snipe-it/.git/index.lock': Permission denied
      Cannot save the current index state
      error: cannot open .git/FETCH_HEAD: Permission denied
      -- -- -- --------------------------------------------------------
      Step 4: Cleaning up old cached files:
      --------------------------------------------------------
      
      -- No bootstrap/cache/compiled.php, so nothing to delete.
      -- Deleting bootstrap/cache/services.php. It it no longer used.
      -- No bootstrap/cache/config.php, so nothing to delete.
      -- Configuration cache cleared!
      -- Cache cleared successfully.
      -- Route cache cleared!
      -- Compiled views cleared!
      
      --------------------------------------------------------
      Step 5: Updating composer dependencies:
      (This may take an moment.)
      --------------------------------------------------------
      
      -- We couldn't find a local composer.phar - trying globally.
      
      Cannot create cache directory /home/jcoombes/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
      Cannot create cache directory /home/jcoombes/.composer/cache/files/, or directory is not writable. Proceeding without cache
      Generating optimized autoload files
      ^C
      

      You can see I killed it at the end there. So I moved onto trying to update manually, so I started by running php artisan snipeit:backup and got:

      Starting backup...
      Dumping database snipeit_data...
      Backup failed because The dump process failed with exitcode 2 : Misuse of shell builtins : sh: 1: cannot create /var/www/snipe-it/storage/laravel-backups/temp//snipeit_data.sql: Directory nonexistent
      .
      Backup failed because: The stream or file "/var/www/snipe-it/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied.
      
      In StreamHandler.php line 107:
                                                                                                
        The stream or file "/var/www/snipe-it/storage/logs/laravel.log" could not be opened: f  
        ailed to open stream: Permission denied
      

      So I am reasonably sure that this is a permissions issue, though I cannot for the life of me think how those got screwed up, and I am absolutely not sure what they should be set to.

      Can anyone help me with this?

      Here is the ls output for the folder:

      ls -alh
      total 1016K
      drwxr-xr-x 16 www-data www-data 4.0K Jan 15  2019 .
      drwxr-xr-x  4 root     root     4.0K Nov  1  2018 ..
      -rw-r--r--  1 www-data www-data  44K Nov  1  2018 .all-contributorsrc
      drwxr-xr-x 17 www-data www-data 4.0K Nov  1  2018 app
      -rw-r--r--  1 www-data www-data 1.7K Nov  1  2018 artisan
      drwxr-xr-x  3 www-data www-data 4.0K Nov  1  2018 bootstrap
      -rw-r--r--  1 www-data www-data  875 Nov  1  2018 bower.json
      -rw-r--r--  1 www-data www-data 9.0K Nov  1  2018 c3.php
      -rw-r--r--  1 www-data www-data  373 Nov  1  2018 codeception.yml
      -rw-r--r--  1 www-data www-data 3.2K Nov  1  2018 CODE_OF_CONDUCT.md
      -rw-r--r--  1 www-data www-data 2.3K Nov  1  2018 composer.json
      -rw-r--r--  1 www-data www-data 227K Nov  1  2018 composer.lock
      drwxr-xr-x  2 www-data www-data 4.0K Jan 15  2019 config
      -rw-r--r--  1 www-data www-data  317 Nov  1  2018 CONTRIBUTING.md
      -rw-r--r--  1 www-data www-data   90 Nov  1  2018 crowdin.yml
      drwxr-xr-x  5 www-data www-data 4.0K Nov  1  2018 database
      drwxr-xr-x  2 www-data www-data 4.0K Nov  1  2018 docker
      -rw-r--r--  1 www-data www-data 3.2K Nov  1  2018 Dockerfile
      -rw-r--r--  1 www-data www-data   67 Nov  1  2018 .dockerignore
      -rw-r--r--  1 www-data www-data 2.8K Nov  1  2018 .env
      -rw-r--r--  1 root     root     2.9K Jan 15  2019 .env.example
      -rw-r--r--  1 www-data www-data 1.8K Nov  1  2018 .env.testing
      -rw-r--r--  1 www-data www-data 1.8K Nov  1  2018 .env.testing-ci
      -rw-r--r--  1 www-data www-data  536 Nov  1  2018 .env.tests
      -rw-r--r--  1 www-data www-data  491 Nov  1  2018 .env.unit-tests
      -rw-r--r--  1 www-data www-data 1.7K Nov  1  2018 gh-changelog.php
      drwxr-xr-x  8 www-data www-data 4.0K Jan 15  2019 .git
      -rwxr-xr-x  1 www-data www-data   11 Nov  1  2018 .gitattributes
      drwxr-xr-x  3 www-data www-data 4.0K Nov  1  2018 .github
      -rwxr-xr-x  1 www-data www-data 1.1K Nov  1  2018 .gitignore
      -rw-r--r--  1 www-data www-data  251 Nov  1  2018 .htaccess
      -rw-r--r--  1 www-data www-data  956 Nov  1  2018 index.html
      -rwxr-xr-x  1 www-data www-data  371 Nov  1  2018 install.sh
      -rwxr-xr-x  1 www-data www-data  34K Nov  1  2018 LICENSE
      -rw-r--r--  1 www-data www-data 441K Nov  1  2018 npm-shrinkwrap.json
      -rw-r--r--  1 www-data www-data 1.8K Nov  1  2018 package.json
      -rw-r--r--  1 www-data www-data 1.1K Nov  1  2018 phpunit.xml
      drwxr-xr-x  8 www-data www-data 4.0K Jan 15  2019 public
      -rw-r--r--  1 www-data www-data  45K Nov  1  2018 README.md
      drwxr-xr-x  6 www-data www-data 4.0K Nov  1  2018 resources
      drwxr-xr-x  3 www-data www-data 4.0K Nov  1  2018 routes
      drwxr-xr-x  2 www-data www-data 4.0K Nov  1  2018 sample_csvs
      -rw-r--r--  1 www-data www-data  567 Nov  1  2018 server.php
      -rwxr-xr-x  1 www-data www-data  22K Nov  1  2018 snipeit.sh
      drwxrwxr-x  7 www-data www-data 4.0K Nov  1  2018 storage
      drwxr-xr-x 10 www-data www-data 4.0K Nov  1  2018 tests
      -rw-r--r--  1 root     root     2.8K Jan 15  2019 .travis.yml
      -rw-r--r--  1 www-data www-data 6.1K Nov  1  2018 upgrade.php
      -rw-r--r--  1 www-data www-data 3.4K Nov  1  2018 Vagrantfile
      drwxr-xr-x 51 www-data www-data 4.0K Nov  1  2018 vendor
      -rw-r--r--  1 www-data www-data 2.1K Nov  1  2018 webpack.mix.js
      

      EDIT: I just changed the permissions on everything in the /var/www/snipe-it folder to 755, and made sure that everything is owned by www-data and the group is www-data. I am still getting all these permission errors when trying to upgrade.

      1 Reply Last reply Reply Quote 0
      • black3dynamiteB
        black3dynamite
        last edited by

        sudo -u www-data php upgrade.php

        1 Reply Last reply Reply Quote 2
        • jrcJ
          jrc
          last edited by

          @black3dynamite said in Snipe-IT Upgrade from 4.6.7 to 4.7.5 not working.:

          sudo -u www-data php upgrade.php

          That makes sense, and seems to have solved the backup issue and some of the permission errors, but now I am getting this:

          Welcome to the Snipe-IT upgrader.
          
          Please note that this script will not download the latest Snipe-IT 
          files for you unless you have git installed. 
          It simply runs the standard composer and artisan 
          commands needed to finalize the upgrade after. 
          
          !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
          !! If you have any encrypted custom fields, BE SURE TO run the recrypter if upgrading from v3 to v4. 
          !! See the Snipe-IT documentation for help: 
          !! https://snipe-it.readme.io/docs/upgrading-to-v4
          !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
          --------------------------------------------------------
          STEP 1: Backing up database: 
          --------------------------------------------------------
          
          -- Starting backup...
          Dumping database snipeit_data...
          Determining files to backup...
          Zipped 79 files...
          Copying 2019-07-30-145900.zip (size: 806.26 KB) to disk named local...
          Successfully copied .zip file to disk named local.
          Backup completed!
          
          
          --------------------------------------------------------
          STEP 2: Putting application into maintenance mode: 
          --------------------------------------------------------
          
          -- Application is now in maintenance mode.
          
          
          --------------------------------------------------------
          STEP 3: Pulling latest from Git (master branch): 
          --------------------------------------------------------
          
          Git is installed. 
          Already on 'master'
          error: cannot open .git/FETCH_HEAD: Permission denied
          -- No local changes to save
          -- Your branch is up to date with 'origin/master'.
          -- --------------------------------------------------------
          Step 4: Cleaning up old cached files:
          --------------------------------------------------------
          
          -- No bootstrap/cache/compiled.php, so nothing to delete.
          -- Deleting bootstrap/cache/services.php. It it no longer used.
          -- Deleting bootstrap/cache/config.php. It it no longer used.
          -- Configuration cache cleared!
          -- Cache cleared successfully.
          -- Route cache cleared!
          -- Compiled views cleared!
          
          --------------------------------------------------------
          Step 5: Updating composer dependencies:
          (This may take an moment.)
          --------------------------------------------------------
          
          -- We couldn't find a local composer.phar - trying globally.
          
          Cannot create cache directory /home/jcoombes/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
          Cannot create cache directory /home/jcoombes/.composer/cache/files/, or directory is not writable. Proceeding without cache
          Generating optimized autoload files
          Cannot create cache directory /home/jcoombes/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
          Cannot create cache directory /home/jcoombes/.composer/cache/files/, or directory is not writable. Proceeding without cache
          Loading composer repositories with package information
          Installing dependencies from lock file
          Nothing to install or update
          Generating optimized autoload files
          
          
          
          
          --------------------------------------------------------
          Step 6: Migrating database:
          --------------------------------------------------------
          
          -- Nothing to migrate.
          
          
          --------------------------------------------------------
          Step 7: Checking for OAuth keys:
          --------------------------------------------------------
          
          - OAuth keys detected. Skipping passport install.
          
          --------------------------------------------------------
          Step 8: Caching routes and config:
          --------------------------------------------------------
          
          -- Configuration cache cleared!
          Configuration cached successfully!
          -- Route cache cleared!
          Routes cached successfully!
          
          --------------------------------------------------------
          Step 9: Taking application out of maintenance mode:
          --------------------------------------------------------
          
          -- Application is now live.
          
          
          --------------------------------------------------------
          FINISHED! Clear your browser cookies and re-login to use :
          your upgraded Snipe-IT.
          --------------------------------------------------------
          
          1 Reply Last reply Reply Quote 0
          • JaredBuschJ
            JaredBusch
            last edited by

            @jrc said in Snipe-IT Upgrade from 4.6.7 to 4.7.5 not working.:

            That makes sense, and seems to have solved the backup issue and some of the permission errors, but now I am getting this:

            That looks normal.

            jrcJ 1 Reply Last reply Reply Quote 0
            • jrcJ
              jrc @JaredBusch
              last edited by jrc

              @JaredBusch

              I'll take you word for that. The end result is it is not upgrading anything. I am still on 4.6.7 when it is done.

              To be clear, you are saying that this is normal?

              --------------------------------------------------------
              STEP 3: Pulling latest from Git (master branch): 
              --------------------------------------------------------
              
              Git is installed. 
              Already on 'master'
              error: cannot open .git/FETCH_HEAD: Permission denied
              -- No local changes to save
              -- Your branch is up to date with 'origin/master'.
              

              And this:

              --------------------------------------------------------
              Step 5: Updating composer dependencies:
              (This may take an moment.)
              --------------------------------------------------------
              
              -- We couldn't find a local composer.phar - trying globally.
              
              Cannot create cache directory /home/jcoombes/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
              Cannot create cache directory /home/jcoombes/.composer/cache/files/, or directory is not writable. Proceeding without cache
              Generating optimized autoload files
              Cannot create cache directory /home/jcoombes/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
              Cannot create cache directory /home/jcoombes/.composer/cache/files/, or directory is not writable. Proceeding without cache
              Loading composer repositories with package information
              Installing dependencies from lock file
              Nothing to install or update
              Generating optimized autoload files
              
              
              JaredBuschJ 1 Reply Last reply Reply Quote 0
              • JaredBuschJ
                JaredBusch @jrc
                last edited by

                @jrc said in Snipe-IT Upgrade from 4.6.7 to 4.7.5 not working.:

                error: cannot open .git/FETCH_HEAD: Permission denied

                missed that.

                DId you chown that folder too?

                ls -lash

                jrcJ 1 Reply Last reply Reply Quote 0
                • jrcJ
                  jrc @JaredBusch
                  last edited by

                  @JaredBusch

                  For some reason the FETCH_HEAD file was owned by root, and several other things in the .git folder, so I changed them all to www-data:www-data.

                  It is running now, and updating a bunch of things. Hopefully that will do it.

                  1 Reply Last reply Reply Quote 0
                  • jrcJ
                    jrc
                    last edited by

                    It finished, but with these errors:

                    Step 4: Cleaning up old cached files:
                    --------------------------------------------------------
                    
                    -- No bootstrap/cache/compiled.php, so nothing to delete.
                    -- Deleting bootstrap/cache/services.php. It it no longer used.
                    -- Deleting bootstrap/cache/config.php. It it no longer used.
                    -- 
                    In ProviderRepository.php line 208:
                                                                                   
                      Class 'PragmaRX\Google2FALaravel\ServiceProvider' not found  
                                                                                   
                    
                    -- 
                    In ProviderRepository.php line 208:
                                                                                   
                      Class 'PragmaRX\Google2FALaravel\ServiceProvider' not found  
                                                                                   
                    
                    -- 
                    In ProviderRepository.php line 208:
                                                                                   
                      Class 'PragmaRX\Google2FALaravel\ServiceProvider' not found  
                                                                                   
                    
                    -- 
                    In ProviderRepository.php line 208:
                                                                                   
                      Class 'PragmaRX\Google2FALaravel\ServiceProvider' not found 
                    

                    And

                    --------------------------------------------------------
                    Step 5: Updating composer dependencies:
                    (This may take an moment.)
                    --------------------------------------------------------
                    
                    -- We couldn't find a local composer.phar - trying globally.
                    
                    Cannot create cache directory /home/jcoombes/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
                    Cannot create cache directory /home/jcoombes/.composer/cache/files/, or directory is not writable. Proceeding without cache
                    
                    <snip>
                    
                    Generating optimized autoload files
                    > Illuminate\Foundation\ComposerScripts::postAutoloadDump
                    > @php artisan package:discover
                    
                    In ProviderRepository.php line 208:
                                                                                   
                      Class 'PragmaRX\Google2FALaravel\ServiceProvider' not found  
                                                                                   
                    <snip> 
                    
                    Package manifest generated successfully.
                    

                    But other than that it appears to have worked out just fine.

                    Are there any security concerns with the .git files now being owned by www-data with 755 permissions?

                    1 Reply Last reply Reply Quote 1
                    • jrcJ
                      jrc
                      last edited by

                      So for anyone else who may stumble across this, here is the concise solution that worked for me.

                      sudo chown -R www-data:www-data ./storage
                      sudo chmod -R 755 ./storage
                      This sets the owner and permissions for all the files in the storage folder for Snipe-IT.

                      Then run sudo -u www-data php upgrade.php

                      This still spat out a few errors, but they seem to be inconsequential, and everything is updated.

                      1 Reply Last reply Reply Quote 0
                      • JaredBuschJ
                        JaredBusch
                        last edited by

                        @jrc said in Snipe-IT Upgrade from 4.6.7 to 4.7.5 not working.:

                        Cannot create cache directory /home/jcoombes/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
                        Cannot create cache directory /home/jcoombes/.composer/cache/files/, or directory is not writable. Proceeding without cache

                        This is normal. You are running something as the apache user and it has no access to your home directory.

                        1 Reply Last reply Reply Quote 2
                        • 1 / 1
                        • First post
                          Last post