Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error update [Feature Request]: #13730

Closed
melihertasss opened this issue Oct 10, 2023 · 1 comment
Closed

error update [Feature Request]: #13730

melihertasss opened this issue Oct 10, 2023 · 1 comment

Comments

@melihertasss
Copy link

Is your feature request related to a problem? Please describe.

Hello,

When I want to update snipe-it with the php upgrade.php command, I get the following error codes? When I examine it, I do not see that I have permission to write to the snipe-it folder. But I couldn't figure out how to get around this. Can you help with this issue? All codes are available below.

ankutsan@snipeit:/var/www/snipe-it$ php upgrade.php

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 http://10.7.0.29
√ Your APP_URL is set to http://10.7.0.29 and starts with the protocol (https:// or http://)
√ Your APP_URL (http://10.7.0.29) does not have a trailing slash.


STEP 2: Checking PHP requirements:

Current PHP version: (8.1.2-1ubuntu2.14) is at least 7.4.0 - continuing...
FYI: The php.ini used by this PHP is: /etc/php/8.1/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:


The following directories/files do not seem writable:

✘ PERMISSIONS ERROR: /var/www/snipe-it/bootstrap/cache is NOT writable
✘ PERMISSIONS ERROR: /var/www/snipe-it/storage is NOT writable
✘ PERMISSIONS ERROR: /var/www/snipe-it/storage/logs is NOT writable
✘ PERMISSIONS ERROR: /var/www/snipe-it/storage/logs/laravel.log is NOT writable
✘ PERMISSIONS ERROR: /var/www/snipe-it/storage/framework is NOT writable
✘ PERMISSIONS ERROR: /var/www/snipe-it/storage/framework/cache is NOT writable
✘ PERMISSIONS ERROR: /var/www/snipe-it/storage/framework/sessions is NOT writabl e
✘ PERMISSIONS ERROR: /var/www/snipe-it/storage/framework/views is NOT writable
✘ PERMISSIONS ERROR: /var/www/snipe-it/storage/app is NOT writable
✘ PERMISSIONS ERROR: /var/www/snipe-it/storage/app/backups is NOT writable
✘ PERMISSIONS ERROR: /var/www/snipe-it/storage/app/backup-temp is NOT writable
✘ PERMISSIONS ERROR: /var/www/snipe-it/storage/private_uploads is NOT writable
✘ PERMISSIONS ERROR: /var/www/snipe-it/public/uploads is NOT writable
--------------------- !! ERROR !! ----------------------
Please check the permissions on the directories above and re-run this script.
------------------------- :( ---------------------------


STEP 4: Backing up database:

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


STEP 5: 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 6: 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 7: Cleaning up old cached files:

√ No bootstrap/cache/compiled.php, so nothing to delete.
√ Deleting bootstrap/cache/services.php. It is no longer used.
√ No bootstrap/cache/config.php, so nothing to delete.
√ No vendor/symfony/translation/TranslatorInterface.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 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.
Nothing to install, update or remove

In Filesystem.php line 862:

file_put_contents(/var/www/snipe-it/vendor/composer/installed.php): Failed
to open stream: Permission denied

install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--d ry-run] [--download-only] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [- -no-progress] [--no-install] [--audit] [--audit-format AUDIT-FORMAT] [-v|vv|vvv| --verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-auto loader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [...]

Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover --ansi
@php artisan vendor:publish --force --tag=livewire:assets --ansi
Generating optimized autoload files

UnexpectedValueException

The stream or file "/var/www/snipe-it/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/snipe-it/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: Exception: The /var/www/snipe-it/bootstrap/cache directory must be present and writable. in /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php:177
Stack trace:
#0 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(136): Illuminate\Foundation\PackageManifest->write()
#1 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php(32): Illuminate\Foundation\PackageManifest->build()
#2 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Foundation\Console\PackageDiscoverCommand->handle()
#3 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()
#4 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#5 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#6 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call()
#7 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()
#8 /var/www/snipe-it/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute()
#9 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#10 /var/www/snipe-it/vendor/symfony/console/Application.php(1040): Illuminate\Console\Command->run()
#11 /var/www/snipe-it/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#12 /var/www/snipe-it/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#13 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run()
#14 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
#15 /var/www/snipe-it/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#16 {main} in /var/www/snipe-it/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:146
Stack trace:
#0 /var/www/snipe-it/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(48): Monolog\Handler\StreamHandler->write()
#1 /var/www/snipe-it/vendor/monolog/monolog/src/Monolog/Logger.php(399): Monolog\Handler\AbstractProcessingHandler->handle()
#2 /var/www/snipe-it/vendor/monolog/monolog/src/Monolog/Logger.php(650): Monolog\Logger->addRecord()
#3 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Log/Logger.php(183): Monolog\Logger->error()
#4 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Log/Logger.php(94): Illuminate\Log\Logger->writeLog()
#5 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(590): Illuminate\Log\Logger->error()
#6 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Log\LogManager->error()
#7 /var/www/snipe-it/app/Exceptions/Handler.php(48): Illuminate\Support\Facades\Facade::__callStatic()
#8 /var/www/snipe-it/vendor/nunomaduro/collision/src/Adapters/Laravel/ExceptionHandler.php(46): App\Exceptions\Handler->report()
#9 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(366): NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler->report()
#10 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException()
#11 /var/www/snipe-it/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#12 {main}

at vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:146
142▕ restore_error_handler();
143▕ if (!is_resource($stream)) {
144▕ $this->stream = null;
145▕
➜ 146▕ throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened in append mode: '.$this->errorMessage, $url) . Utils::getRecordMessageForException($record));
147▕ }
148▕ stream_set_chunk_size($stream, $this->streamChunkSize);
149▕ $this->stream = $stream;
150▕ }

  +7 vendor frames

8 app/Exceptions/Handler.php:48
Illuminate\Support\Facades\Facade::__callStatic()

  +2 vendor frames

11 [internal]:0
Illuminate\Foundation\Bootstrap\HandleExceptions::handleException()

UnexpectedValueException

The stream or file "/var/www/snipe-it/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/snipe-it/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: ErrorException: file_put_contents(/var/www/snipe-it/public/vendor/livewire/livewire.js): Failed to open stream: Permission denied in /var/www/snipe-it/vendor/league/flysystem/src/Adapter/Local.php:199
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 /var/www/snipe-it/vendor/league/flysystem/src/Adapter/Local.php(199): file_put_contents()
#2 /var/www/snipe-it/vendor/league/flysystem/src/Filesystem.php(100): League\Flysystem\Adapter\Local->update()
#3 /var/www/snipe-it/vendor/league/flysystem/src/MountManager.php(595): League\Flysystem\Filesystem->put()
#4 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php(254): League\Flysystem\MountManager->put()
#5 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php(238): Illuminate\Foundation\Console\VendorPublishCommand->moveManagedFiles()
#6 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php(203): Illuminate\Foundation\Console\VendorPublishCommand->publishDirectory()
#7 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php(166): Illuminate\Foundation\Console\VendorPublishCommand->publishItem()
#8 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php(77): Illuminate\Foundation\Console\VendorPublishCommand->publishTag()
#9 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Foundation\Console\VendorPublishCommand->handle()
#10 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()
#11 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#12 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#13 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call()
#14 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()
#15 /var/www/snipe-it/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute()
#16 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#17 /var/www/snipe-it/vendor/symfony/console/Application.php(1040): Illuminate\Console\Command->run()
#18 /var/www/snipe-it/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#19 /var/www/snipe-it/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#20 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run()
#21 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
#22 /var/www/snipe-it/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#23 {main} in /var/www/snipe-it/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:146
Stack trace:
#0 /var/www/snipe-it/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(48): Monolog\Handler\StreamHandler->write()
#1 /var/www/snipe-it/vendor/monolog/monolog/src/Monolog/Logger.php(399): Monolog\Handler\AbstractProcessingHandler->handle()
#2 /var/www/snipe-it/vendor/monolog/monolog/src/Monolog/Logger.php(650): Monolog\Logger->addRecord()
#3 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Log/Logger.php(183): Monolog\Logger->error()
#4 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Log/Logger.php(94): Illuminate\Log\Logger->writeLog()
#5 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(590): Illuminate\Log\Logger->error()
#6 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Log\LogManager->error()
#7 /var/www/snipe-it/app/Exceptions/Handler.php(48): Illuminate\Support\Facades\Facade::__callStatic()
#8 /var/www/snipe-it/vendor/nunomaduro/collision/src/Adapters/Laravel/ExceptionHandler.php(46): App\Exceptions\Handler->report()
#9 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(366): NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler->report()
#10 /var/www/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException()
#11 /var/www/snipe-it/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#12 {main}

at vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:146
142▕ restore_error_handler();
143▕ if (!is_resource($stream)) {
144▕ $this->stream = null;
145▕
➜ 146▕ throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened in append mode: '.$this->errorMessage, $url) . Utils::getRecordMessageForException($record));
147▕ }
148▕ stream_set_chunk_size($stream, $this->streamChunkSize);
149▕ $this->stream = $stream;
150▕ }

  +7 vendor frames

8 app/Exceptions/Handler.php:48
Illuminate\Support\Facades\Facade::__callStatic()

  +2 vendor frames

11 [internal]:0
Illuminate\Foundation\Bootstrap\HandleExceptions::handleException()
Generated optimized autoload files containing 8818 classes


STEP 9: Migrating database:

Nothing to migrate.


STEP 10: Checking for OAuth keys:

√ OAuth keys detected. Skipping passport install.


STEP 11: 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!

ankutsan@snipeit:/var/www/snipe-it$ ^C
ankutsan@snipeit:/var/www/snipe-it$ ^C
ankutsan@snipeit:/var/www/snipe-it$ Please check the permissions on the directories above and re-run this script.Please check the permissions on the directories above and re-run this script.^C
ankutsan@snipeit:/var/www/snipe-it$ ^C
ankutsan@snipeit:/var/www/snipe-it$

Describe the solution you'd like

I want permission to access the snipe-it folder.

Describe alternatives you've considered

No response

Additional context

No response

@snipe
Copy link
Owner

snipe commented Oct 25, 2023

The user you're trying to run the upgrader as does not have permission to write to those directories. https://snipe-it.readme.io/docs/debugging-permissions

Snipe-IT Documentation
❗️This article refers to web server file system permissions onlyIt does not address Snipe-IT application permissions.One of the most common issues folks newer to running web servers run into is how to manage the Linux/Windows/etc owners and groups of the Snipe-IT filesystem.As we mention many times ...

@snipe snipe closed this as completed Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants