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

    Snipe-IT php upgrade.php install

    IT Discussion
    centos 7 snipe-it permissions upgrade
    3
    15
    4.3k
    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.
    • DustinB3403D
      DustinB3403
      last edited by

      Ok so it looks like the Snipe-IT team has come up with a new upgrade process for Snipe-IT.

      I'm trying to use this approach rather than the script that I have (as there are some issues with it, namely it no longer works).

      I've added my user to the 'apache` group

      The obfuscated parts are my user name.
      https://i.imgur.com/KmnSIRj.png

      Based on this output though I don't have write permissions to these folders.

      @snipeit snipeit]$ php upgrade.php install
      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.
      !! 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...
      Backup failed because The dump process failed with exitcode 1 : General error :                                                                                                                                                              sh: /var/www/html/snipeit/storage/laravel-backups/temp//snipeit.sql: Permission                                                                                                                                                              denied
      .
      Backup failed because: The stream or file "/var/www/html/snipeit/storage/logs/la                                                                                                                                                             ravel-2017-11-16.log" could not be opened: failed to open stream: Permission den                                                                                                                                                             ied.
      
      
        [UnexpectedValueException]
        The stream or file "/var/www/html/snipeit/storage/logs/laravel-2017-11-16.l
        og" could not be opened: failed to open stream: Permission denied
      
      
      
      
      --------------------------------------------------------
      STEP 2: Putting application into maintenance mode:
      --------------------------------------------------------
      
      --
      
        [UnexpectedValueException]
        The stream or file "/var/www/html/snipeit/storage/logs/laravel-2017-11-16.l
        og" could not be opened: failed to open stream: Permission denied
      
      
      
      
      --------------------------------------------------------
      STEP 3: Pulling latest from Git (install branch):
      --------------------------------------------------------
      
      Git is installed.
      fatal: Unable to create '/var/www/html/snipeit/.git/index.lock': Permission deni                                                                                                                                                             ed
      fatal: Unable to create '/var/www/html/snipeit/.git/index.lock': Permission deni                                                                                                                                                             ed
      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.
      -- 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.)
      --------------------------------------------------------
      
      -- Local composer.phar detected, so we'll use that.
      
      Generating optimized autoload files
      Loading composer repositories with package information
      Installing dependencies (including require-dev) 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!
      
      
        [UnexpectedValueException]
        The stream or file "/var/www/html/snipeit/storage/logs/laravel-2017-11-16.l
        og" could not be opened: failed to open stream: Permission denied
      
      
      -- Route cache cleared!
      
      
        [UnexpectedValueException]
        The stream or file "/var/www/html/snipeit/storage/logs/laravel-2017-11-16.l
        og" could not be opened: failed to open stream: Permission denied
      
      
      
      --------------------------------------------------------
      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.
      --------------------------------------------------------
      

      Clearly I should have access based on being a part of the wheel and apache groups. Can someone give me a hand sorting this out (forgot my glasses at the house today and am already getting a headache)

      1 Reply Last reply Reply Quote 0
      • DustinB3403D
        DustinB3403
        last edited by

        Here is a github ticket I've opened to formally track the issue.

        1 Reply Last reply Reply Quote 0
        • DustinB3403D
          DustinB3403
          last edited by

          Running php upgrade.php install with sudo immediately fails as there are permissions issues that get caused.

          So that isn't an option.

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

            Have you tried doing it this way? sudo -u apache php upgrade.php install

            DustinB3403D 1 Reply Last reply Reply Quote 1
            • DustinB3403D
              DustinB3403 @black3dynamite
              last edited by

              @black3dynamite said in Snipe-IT php upgrade.php install:

              Have you tried doing it this way? sudo -u apache php upgrade.php install

              Why aren't you sitting next to me. That seems to have been it.

              1 Reply Last reply Reply Quote 0
              • DustinB3403D
                DustinB3403
                last edited by

                I still get some permission denied errors, but the system upgraded to 4.1.4

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

                  @dustinb3403 said in Snipe-IT php upgrade.php install:

                  I still get some permission denied errors, but the system upgraded to 4.1.4

                  What other permission denied errors?

                  1 Reply Last reply Reply Quote 0
                  • DustinB3403D
                    DustinB3403
                    last edited by

                    PHP Notice:  Undefined offset: 1 in /var/www/html/snipeit/upgrade.php on line 16
                    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.
                    !! 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...
                    Backup failed because The dump process failed with exitcode 1 : General error : sh: /var/www/html/snipeit/storage/laravel-back                                                                                                               ups/temp//snipeit.sql: Permission denied
                    .
                    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'
                    -- No local changes to save
                    -- -- Already up-to-date.
                    --------------------------------------------------------
                    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.)
                    --------------------------------------------------------
                    
                    -- Local composer.phar detected, so we'll use that.
                    
                    Cannot create cache directory /usr/share/httpd/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proc                                                                                                               eeding without cache
                    Cannot create cache directory /usr/share/httpd/.composer/cache/files/, or directory is not writable. Proceeding without cache
                    Generating optimized autoload files
                    Cannot create cache directory /usr/share/httpd/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proc                                                                                                               eeding without cache
                    Cannot create cache directory /usr/share/httpd/.composer/cache/files/, or directory is not writable. Proceeding without cache
                    Loading composer repositories with package information
                    Installing dependencies from lock file
                    Package operations: 0 installs, 0 updates, 23 removals
                      - Removing squizlabs/php_codesniffer (3.1.1)
                    
                    
                      [RuntimeException]
                      Could not delete /var/www/html/snipeit/vendor/squizlabs/php_codesniffer/.git/refs/heads/master: date_default_timezone_get
                      (): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the
                      date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you m
                      ost likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to se
                      lect your timezone.
                    
                    
                    install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scri                                                                                                               pts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-aut                                                                                                               oloader] [--ignore-platform-reqs] [--] [<packages>]...
                    
                    
                    
                    
                    
                    --------------------------------------------------------
                    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.
                    --------------------------------------------------------
                    
                    black3dynamiteB 1 Reply Last reply Reply Quote 0
                    • JaredBuschJ
                      JaredBusch
                      last edited by

                      Did you check the SELinux context for those? I would disable SELinux and run the script. that would inform you.

                      DustinB3403D 1 Reply Last reply Reply Quote 0
                      • DustinB3403D
                        DustinB3403 @JaredBusch
                        last edited by

                        @jaredbusch What would an selinux denial look like so I can search for it?

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

                          @dustinb3403

                          You can get rid of the message about not able to create cache directory by following this post.
                          https://mangolassi.it/topic/15461/snipe-it-cannot-create-cache-directory

                          1 Reply Last reply Reply Quote 2
                          • black3dynamiteB
                            black3dynamite @DustinB3403
                            last edited by

                            @dustinb3403 said in Snipe-IT php upgrade.php install:

                            @jaredbusch What would an selinux denial look like so I can search for it?

                            You can find SELinux denial by doing one of the following:

                            # If you have setroubleshoot-server package installed
                            sealert -a /var/log/audit/audit.log
                            
                            OR
                            
                            tail -f /var/log/audit/audit.log | grep 'denied'
                            
                            1 Reply Last reply Reply Quote 0
                            • DustinB3403D
                              DustinB3403
                              last edited by

                              No denials found.

                              100% done
                              found 0 alerts in /var/log/audit/audit.log
                              
                              black3dynamiteB 1 Reply Last reply Reply Quote 0
                              • black3dynamiteB
                                black3dynamite @DustinB3403
                                last edited by

                                @dustinb3403 said in Snipe-IT php upgrade.php install:

                                No denials found.

                                100% done
                                found 0 alerts in /var/log/audit/audit.log
                                

                                Is apache the owner of snipeit directory, subdirectories, and files?

                                DustinB3403D 1 Reply Last reply Reply Quote 0
                                • DustinB3403D
                                  DustinB3403 @black3dynamite
                                  last edited by

                                  @black3dynamite said in Snipe-IT php upgrade.php install:

                                  @dustinb3403 said in Snipe-IT php upgrade.php install:

                                  No denials found.

                                  100% done
                                  found 0 alerts in /var/log/audit/audit.log
                                  

                                  Is apache the owner of snipeit directory, subdirectories, and files?

                                  apache : apache owns at least storage, which is where those files are. (I am a part of this group)

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