BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
15.32k stars 1.91k forks source link

Updating to 22.11 from 22.09.1 - SQL error? #3919

Closed patsyk1 closed 1 year ago

patsyk1 commented 1 year ago

Attempted Debugging

Searched GitHub Issues

Describe the Scenario

Updating from 22.09.1 to 22.11 always results in an SQLSTATE[42S22] error on the debug page.

I've tried restoring a SQL database from a backup before the update, but this doesn't help.

I saw there was a similarly completed issue with the update for someone else that was permission-based. Still, the fix of restoring all Bookstack permissions didn't help me (as I assume this is linked to SQL more so than permissions to the directories Bookstack is being served from).

Exact BookStack Version

22.09.1

Log Content

Error Illuminate\View\ViewException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'view' in 'where clause' (SQL: select count(*) as aggregate from entity_permissions where view = 1 and role_id in (4) and entity_type = bookshelf) (View: /var/www/bookstack/resources/views/common/header.blade.php) (View: /var/www/bookstack/resources/views/common/header.blade.php) (View: /var/www/bookstack/resources/views/common/header.blade.php) (View: /var/www/bookstack/resources/views/common/header.blade.php)

Stack Trace /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(60): Illuminate\View\Engines\CompilerEngine->handleViewException() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(61): Illuminate\View\Engines\PhpEngine->evaluatePath() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(139): Illuminate\View\Engines\CompilerEngine->get() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(122): Illuminate\View\View->getContents() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(91): Illuminate\View\View->renderContents() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Http/Response.php(69): Illuminate\View\View->render() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Http/Response.php(35): Illuminate\Http\Response->setContent() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Router.php(820): Illuminate\Http\Response->__construct() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Router.php(789): Illuminate\Routing\Router::toResponse() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Router.php(721): Illuminate\Routing\Router->prepareResponse() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing{closure}() /var/www/bookstack/app/Http/Middleware/Authenticate.php(23): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): BookStack\Http\Middleware\Authenticate->handle() /var/www/bookstack/app/Http/Middleware/Localization.php(45): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): BookStack\Http\Middleware\Localization->handle() /var/www/bookstack/app/Http/Middleware/RunThemeActions.php(26): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): BookStack\Http\Middleware\RunThemeActions->handle() /var/www/bookstack/app/Http/Middleware/CheckEmailConfirmed.php(47): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): BookStack\Http\Middleware\CheckEmailConfirmed->handle() /var/www/bookstack/app/Http/Middleware/PreventAuthenticatedResponseCaching.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): BookStack\Http\Middleware\PreventAuthenticatedResponseCaching->handle() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\View\Middleware\ShareErrorsFromSession->handle() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Session\Middleware\StartSession->handle() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\EncryptCookies->handle() /var/www/bookstack/app/Http/Middleware/ApplyCspRules.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): BookStack\Http\Middleware\ApplyCspRules->handle() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Router.php(723): Illuminate\Pipeline\Pipeline->then() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Router.php(698): Illuminate\Routing\Router->runRouteWithinStack() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Router.php(662): Illuminate\Routing\Router->runRoute() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Router.php(651): Illuminate\Routing\Router->dispatchToRoute() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): Illuminate\Routing\Router->dispatch() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/app/Http/Middleware/TrustProxies.php(41): Illuminate\Http\Middleware\TrustProxies->handle() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): BookStack\Http\Middleware\TrustProxies->handle() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TrimStrings->handle() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\Pipeline\Pipeline->then() /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter() /var/www/bookstack/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle() {main}

PHP Version

7.4.3

Hosting Environment

Ubuntu 20.04 LTS

ssddanbrown commented 1 year ago

Hi @patsyk1, It sounds like the database is out of sync with the application files. Could you run each upgrade command, one at a time, and share the command line output observed at each stage?

patsyk1 commented 1 year ago

Hi @ssddanbrown,

Sure thing, I had to initially run the below as I was getting "error: Your local changes to the following files would be overwritten by merge:" when completing the initial git.

sudo git stash push --include-untracked sudo git stash drop

Output observed at each stage after is: sudo git pull origin release From https://github.com/BookStackApp/BookStack

patsyk1 commented 1 year ago

@ssddanbrown composer install --no-dev

@php -r "!file_exists('bootstrap/cache/services.php') || @unlink('bootstrap/cache/services.php');" Installing dependencies from lock file Verifying lock file contents can be installed on current platform. Package operations: 0 installs, 39 updates, 1 removal

  • Downloading symfony/polyfill-iconv (v1.27.0)
  • Downloading symfony/polyfill-iconv (v1.27.0)
  • Downloading symfony/polyfill-iconv (v1.27.0)
  • Downloading symfony/polyfill-iconv (v1.27.0) Failed to download symfony/polyfill-iconv from dist: The "https://api.github.com/repos/symfony/polyfill-iconv/zipball/927013f3aac555983a5059aada98e1907d842695" file could not be written to /var/www/bookstack/vendor/composer/tmp-b79732bd58347c2b5a38f88c7406d586: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/polyfill-iconv (v1.27.0) into cache
  • Downloading symfony/polyfill-php80 (v1.27.0)
  • Downloading symfony/polyfill-php80 (v1.27.0)
  • Downloading symfony/polyfill-php80 (v1.27.0)
  • Downloading symfony/polyfill-php80 (v1.27.0) Failed to download symfony/polyfill-php80 from dist: The "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" file could not be written to /var/www/bookstack/vendor/composer/tmp-297c8a4ca7e1999d2cc5e65a97990260: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/polyfill-php80 (v1.27.0) into cache
  • Downloading symfony/polyfill-mbstring (v1.27.0)
  • Downloading symfony/polyfill-mbstring (v1.27.0)
  • Downloading symfony/polyfill-mbstring (v1.27.0)
  • Downloading symfony/polyfill-mbstring (v1.27.0) Failed to download symfony/polyfill-mbstring from dist: The "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534" file could not be written to /var/www/bookstack/vendor/composer/tmp-9307a74084204f6e44d970bab99a61bd: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/polyfill-mbstring (v1.27.0) into cache
  • Downloading symfony/polyfill-ctype (v1.27.0)
  • Downloading symfony/polyfill-ctype (v1.27.0)
  • Downloading symfony/polyfill-ctype (v1.27.0)
  • Downloading symfony/polyfill-ctype (v1.27.0) Failed to download symfony/polyfill-ctype from dist: The "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a" file could not be written to /var/www/bookstack/vendor/composer/tmp-19fb76dce87e0c018a009ca2e50b8536: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/polyfill-ctype (v1.27.0) into cache
  • Downloading vlucas/phpdotenv (v5.5.0)
  • Downloading vlucas/phpdotenv (v5.5.0)
  • Downloading vlucas/phpdotenv (v5.5.0)
  • Downloading vlucas/phpdotenv (v5.5.0) Failed to download vlucas/phpdotenv from dist: The "https://api.github.com/repos/vlucas/phpdotenv/zipball/1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7" file could not be written to /var/www/bookstack/vendor/composer/tmp-01a3a92add3cfa7b29e67b3bab8ed1d9: failed to open stream: Permission denied Now trying to download from source
  • Syncing vlucas/phpdotenv (v5.5.0) into cache
  • Downloading tijsverkoyen/css-to-inline-styles (2.2.5)
  • Downloading tijsverkoyen/css-to-inline-styles (2.2.5)
  • Downloading tijsverkoyen/css-to-inline-styles (2.2.5)
  • Downloading tijsverkoyen/css-to-inline-styles (2.2.5) Failed to download tijsverkoyen/css-to-inline-styles from dist: The "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/4348a3a06651827a27d989ad1d13efec6bb49b19" file could not be written to /var/www/bookstack/vendor/composer/tmp-94526baf440403a809b4b48d4ecce599: failed to open stream: Permission denied Now trying to download from source
  • Syncing tijsverkoyen/css-to-inline-styles (2.2.5) into cache
  • Downloading symfony/var-dumper (v5.4.14)
  • Downloading symfony/var-dumper (v5.4.14)
  • Downloading symfony/var-dumper (v5.4.14)
  • Downloading symfony/var-dumper (v5.4.14) Failed to download symfony/var-dumper from dist: The "https://api.github.com/repos/symfony/var-dumper/zipball/6894d06145fefebd9a4c7272baa026a1c394a430" file could not be written to /var/www/bookstack/vendor/composer/tmp-242165efbd40e7ce5ca062ba74909d8f: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/var-dumper (v5.4.14) into cache
  • Downloading symfony/routing (v5.4.15)
  • Downloading symfony/routing (v5.4.15)
  • Downloading symfony/routing (v5.4.15)
  • Downloading symfony/routing (v5.4.15) Failed to download symfony/routing from dist: The "https://api.github.com/repos/symfony/routing/zipball/5c9b129efe9abce9470e384bf65d8a7e262eee69" file could not be written to /var/www/bookstack/vendor/composer/tmp-89ee8fba03a103ddf84e44ec395b00ed: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/routing (v5.4.15) into cache
  • Downloading symfony/polyfill-php72 (v1.27.0)
  • Downloading symfony/polyfill-php72 (v1.27.0)
  • Downloading symfony/polyfill-php72 (v1.27.0)
  • Downloading symfony/polyfill-php72 (v1.27.0) Failed to download symfony/polyfill-php72 from dist: The "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97" file could not be written to /var/www/bookstack/vendor/composer/tmp-496cdc5798585e02c4a114254d7a8e03: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/polyfill-php72 (v1.27.0) into cache
  • Downloading symfony/polyfill-intl-normalizer (v1.27.0)
  • Downloading symfony/polyfill-intl-normalizer (v1.27.0)
  • Downloading symfony/polyfill-intl-normalizer (v1.27.0)
  • Downloading symfony/polyfill-intl-normalizer (v1.27.0) Failed to download symfony/polyfill-intl-normalizer from dist: The "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6" file could not be written to /var/www/bookstack/vendor/composer/tmp-8c59bcd8349c209c4a3b50b915e9c390: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/polyfill-intl-normalizer (v1.27.0) into cache
  • Downloading symfony/polyfill-intl-idn (v1.27.0)
  • Downloading symfony/polyfill-intl-idn (v1.27.0)
  • Downloading symfony/polyfill-intl-idn (v1.27.0)
  • Downloading symfony/polyfill-intl-idn (v1.27.0) Failed to download symfony/polyfill-intl-idn from dist: The "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/639084e360537a19f9ee352433b84ce831f3d2da" file could not be written to /var/www/bookstack/vendor/composer/tmp-6d5164af7a6d2c4f5e1d9b740dd55296: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/polyfill-intl-idn (v1.27.0) into cache
  • Downloading symfony/mime (v5.4.14)
  • Downloading symfony/mime (v5.4.14)
  • Downloading symfony/mime (v5.4.14)
  • Downloading symfony/mime (v5.4.14) Failed to download symfony/mime from dist: The "https://api.github.com/repos/symfony/mime/zipball/1c118b253bb3495d81e95a6e3ec6c2766a98a0c4" file could not be written to /var/www/bookstack/vendor/composer/tmp-8dfa4fcea505f63dd32265756aa80ff4: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/mime (v5.4.14) into cache
  • Downloading symfony/polyfill-php73 (v1.27.0)
  • Downloading symfony/polyfill-php73 (v1.27.0)
  • Downloading symfony/polyfill-php73 (v1.27.0)
  • Downloading symfony/polyfill-php73 (v1.27.0) Failed to download symfony/polyfill-php73 from dist: The "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9" file could not be written to /var/www/bookstack/vendor/composer/tmp-43446fd5bb5312630cecdf63bfc6f6f5: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/polyfill-php73 (v1.27.0) into cache
  • Downloading symfony/http-foundation (v5.4.15)
  • Downloading symfony/http-foundation (v5.4.15)
  • Downloading symfony/http-foundation (v5.4.15)
  • Downloading symfony/http-foundation (v5.4.15) Failed to download symfony/http-foundation from dist: The "https://api.github.com/repos/symfony/http-foundation/zipball/75bd663ff2db90141bfb733682459d5bbe9e29c3" file could not be written to /var/www/bookstack/vendor/composer/tmp-d386ba14224ce57839097668f2157c2c: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/http-foundation (v5.4.15) into cache
  • Downloading symfony/error-handler (v5.4.15)
  • Downloading symfony/error-handler (v5.4.15)
  • Downloading symfony/error-handler (v5.4.15)
  • Downloading symfony/error-handler (v5.4.15) Failed to download symfony/error-handler from dist: The "https://api.github.com/repos/symfony/error-handler/zipball/539cf1428b8442303c6e876ad7bf5a7babd91091" file could not be written to /var/www/bookstack/vendor/composer/tmp-f087dbfbc0aaaa9cfef459a5335f432a: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/error-handler (v5.4.15) into cache
  • Downloading symfony/http-kernel (v5.4.15)
  • Downloading symfony/http-kernel (v5.4.15)
  • Downloading symfony/http-kernel (v5.4.15)
  • Downloading symfony/http-kernel (v5.4.15) Failed to download symfony/http-kernel from dist: The "https://api.github.com/repos/symfony/http-kernel/zipball/fc63c8c3e1036d424820cc993a4ea163778dc5c7" file could not be written to /var/www/bookstack/vendor/composer/tmp-985e3af0a1db05264f356779dc8f9696: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/http-kernel (v5.4.15) into cache
  • Downloading symfony/polyfill-intl-grapheme (v1.27.0)
  • Downloading symfony/polyfill-intl-grapheme (v1.27.0)
  • Downloading symfony/polyfill-intl-grapheme (v1.27.0)
  • Downloading symfony/polyfill-intl-grapheme (v1.27.0) Failed to download symfony/polyfill-intl-grapheme from dist: The "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354" file could not be written to /var/www/bookstack/vendor/composer/tmp-ad048d17899231fb52691e0726c1dda7: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/polyfill-intl-grapheme (v1.27.0) into cache
  • Downloading symfony/string (v5.4.15)
  • Downloading symfony/string (v5.4.15)
  • Downloading symfony/string (v5.4.15)
  • Downloading symfony/string (v5.4.15) Failed to download symfony/string from dist: The "https://api.github.com/repos/symfony/string/zipball/571334ce9f687e3e6af72db4d3b2a9431e4fd9ed" file could not be written to /var/www/bookstack/vendor/composer/tmp-498534722e2e6cd7fa9acf6dddb00a4d: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/string (v5.4.15) into cache
  • Downloading symfony/console (v5.4.15)
  • Downloading symfony/console (v5.4.15)
  • Downloading symfony/console (v5.4.15)
  • Downloading symfony/console (v5.4.15) Failed to download symfony/console from dist: The "https://api.github.com/repos/symfony/console/zipball/ea59bb0edfaf9f28d18d8791410ee0355f317669" file could not be written to /var/www/bookstack/vendor/composer/tmp-b4aade45c7e21f60877f818f075c74d4: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/console (v5.4.15) into cache
  • Downloading symfony/polyfill-php81 (v1.27.0)
  • Downloading symfony/polyfill-php81 (v1.27.0)
  • Downloading symfony/polyfill-php81 (v1.27.0)
  • Downloading symfony/polyfill-php81 (v1.27.0) Failed to download symfony/polyfill-php81 from dist: The "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a" file could not be written to /var/www/bookstack/vendor/composer/tmp-48927e38881f42c0feab17af6efd7b3f: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/polyfill-php81 (v1.27.0) into cache
  • Downloading symfony/translation (v5.4.14)
  • Downloading symfony/translation (v5.4.14)
  • Downloading symfony/translation (v5.4.14)
  • Downloading symfony/translation (v5.4.14) Failed to download symfony/translation from dist: The "https://api.github.com/repos/symfony/translation/zipball/f0ed07675863aa6e3939df8b1bc879450b585cab" file could not be written to /var/www/bookstack/vendor/composer/tmp-bdb4df825f646598f83b78c02846c7e7: failed to open stream: Permission denied Now trying to download from source
  • Syncing symfony/translation (v5.4.14) into cache
  • Downloading nesbot/carbon (2.63.0)
  • Downloading nesbot/carbon (2.63.0)
  • Downloading nesbot/carbon (2.63.0)
  • Downloading nesbot/carbon (2.63.0) Failed to download nesbot/carbon from dist: The "https://api.github.com/repos/briannesbitt/Carbon/zipball/ad35dd71a6a212b98e4b87e97389b6fa85f0e347" file could not be written to /var/www/bookstack/vendor/composer/tmp-05011d4ccc83b63a96a9e476497fee7e: failed to open stream: Permission denied Now trying to download from source
  • Syncing nesbot/carbon (2.63.0) into cache
  • Downloading league/flysystem (1.1.10)
  • Downloading league/flysystem (1.1.10)
  • Downloading league/flysystem (1.1.10)
  • Downloading league/flysystem (1.1.10) Failed to download league/flysystem from dist: The "https://api.github.com/repos/thephpleague/flysystem/zipball/3239285c825c152bcc315fe0e87d6b55f5972ed1" file could not be written to /var/www/bookstack/vendor/composer/tmp-75deb14da04e6bb8dbb17ce54a258011: failed to open stream: Permission denied Now trying to download from source
  • Syncing league/flysystem (1.1.10) into cache
  • Downloading laravel/serializable-closure (v1.2.2)
  • Downloading laravel/serializable-closure (v1.2.2)
  • Downloading laravel/serializable-closure (v1.2.2)
  • Downloading laravel/serializable-closure (v1.2.2) Failed to download laravel/serializable-closure from dist: The "https://api.github.com/repos/laravel/serializable-closure/zipball/47afb7fae28ed29057fdca37e16a84f90cc62fae" file could not be written to /var/www/bookstack/vendor/composer/tmp-e65a6578eadfa4b7efac9da6ef1849f7: failed to open stream: Permission denied Now trying to download from source
  • Syncing laravel/serializable-closure (v1.2.2) into cache
  • Downloading dragonmantank/cron-expression (v3.3.2)
  • Downloading dragonmantank/cron-expression (v3.3.2)
  • Downloading dragonmantank/cron-expression (v3.3.2)
  • Downloading dragonmantank/cron-expression (v3.3.2) Failed to download dragonmantank/cron-expression from dist: The "https://api.github.com/repos/dragonmantank/cron-expression/zipball/782ca5968ab8b954773518e9e49a6f892a34b2a8" file could not be written to /var/www/bookstack/vendor/composer/tmp-af2124337daa475347d08adc0aba2ac1: failed to open stream: Permission denied Now trying to download from source
  • Syncing dragonmantank/cron-expression (v3.3.2) into cache
  • Downloading doctrine/inflector (2.0.6)
  • Downloading doctrine/inflector (2.0.6)
  • Downloading doctrine/inflector (2.0.6)
  • Downloading doctrine/inflector (2.0.6) Failed to download doctrine/inflector from dist: The "https://api.github.com/repos/doctrine/inflector/zipball/d9d313a36c872fd6ee06d9a6cbcf713eaa40f024" file could not be written to /var/www/bookstack/vendor/composer/tmp-510b191f1b7d0106a2bed80438d64483: failed to open stream: Permission denied Now trying to download from source
  • Syncing doctrine/inflector (2.0.6) into cache
  • Downloading laravel/framework (v8.83.26)
  • Downloading laravel/framework (v8.83.26)
  • Downloading laravel/framework (v8.83.26)
  • Downloading laravel/framework (v8.83.26) Failed to download laravel/framework from dist: The "https://api.github.com/repos/laravel/framework/zipball/7411d9fa71c1b0fd73a33e225f14512b74e6c81e" file could not be written to /var/www/bookstack/vendor/composer/tmp-6aeb1cddb27009bb13dbc438494fb319: failed to open stream: Permission denied Now trying to download from source
  • Syncing laravel/framework (v8.83.26) into cache
  • Downloading phenx/php-svg-lib (0.5.0)
  • Downloading phenx/php-svg-lib (0.5.0)
  • Downloading phenx/php-svg-lib (0.5.0)
  • Downloading phenx/php-svg-lib (0.5.0) Failed to download phenx/php-svg-lib from dist: The "https://api.github.com/repos/dompdf/php-svg-lib/zipball/76876c6cf3080bcb6f249d7d59705108166a6685" file could not be written to /var/www/bookstack/vendor/composer/tmp-e4327d5d829c255526e922527acd24ef: failed to open stream: Permission denied Now trying to download from source
  • Syncing phenx/php-svg-lib (0.5.0) into cache
  • Downloading dompdf/dompdf (v2.0.1)
  • Downloading dompdf/dompdf (v2.0.1)
  • Downloading dompdf/dompdf (v2.0.1)
  • Downloading dompdf/dompdf (v2.0.1) Failed to download dompdf/dompdf from dist: The "https://api.github.com/repos/dompdf/dompdf/zipball/c5310df0e22c758c85ea5288175fc6cd777bc085" file could not be written to /var/www/bookstack/vendor/composer/tmp-a56a3567a92715add5e794d6a36eb49e: failed to open stream: Permission denied Now trying to download from source
  • Syncing dompdf/dompdf (v2.0.1) into cache
  • Downloading doctrine/event-manager (1.2.0)
  • Downloading doctrine/event-manager (1.2.0)
  • Downloading doctrine/event-manager (1.2.0)
  • Downloading doctrine/event-manager (1.2.0) Failed to download doctrine/event-manager from dist: The "https://api.github.com/repos/doctrine/event-manager/zipball/95aa4cb529f1e96576f3fda9f5705ada4056a520" file could not be written to /var/www/bookstack/vendor/composer/tmp-a3bcc5d9dc83b6e7214d309c12fbd862: failed to open stream: Permission denied Now trying to download from source
  • Syncing doctrine/event-manager (1.2.0) into cache
  • Downloading doctrine/dbal (3.5.1)
  • Downloading doctrine/dbal (3.5.1)
  • Downloading doctrine/dbal (3.5.1)
  • Downloading doctrine/dbal (3.5.1) Failed to download doctrine/dbal from dist: The "https://api.github.com/repos/doctrine/dbal/zipball/f38ee8aaca2d58ee88653cb34a6a3880c23f38a5" file could not be written to /var/www/bookstack/vendor/composer/tmp-9421ecf102f82270f5fec56f23b4583b: failed to open stream: Permission denied Now trying to download from source
  • Syncing doctrine/dbal (3.5.1) into cache
  • Downloading filp/whoops (2.14.6)
  • Downloading filp/whoops (2.14.6)
  • Downloading filp/whoops (2.14.6)
  • Downloading filp/whoops (2.14.6) Failed to download filp/whoops from dist: The "https://api.github.com/repos/filp/whoops/zipball/f7948baaa0330277c729714910336383286305da" file could not be written to /var/www/bookstack/vendor/composer/tmp-a607800631d892639449c21d410ee4ba: failed to open stream: Permission denied Now trying to download from source
  • Syncing filp/whoops (2.14.6) into cache
  • Downloading guzzlehttp/psr7 (2.4.3)
  • Downloading guzzlehttp/psr7 (2.4.3)
  • Downloading guzzlehttp/psr7 (2.4.3)
  • Downloading guzzlehttp/psr7 (2.4.3) Failed to download guzzlehttp/psr7 from dist: The "https://api.github.com/repos/guzzle/psr7/zipball/67c26b443f348a51926030c83481b85718457d3d" file could not be written to /var/www/bookstack/vendor/composer/tmp-525537f47217fabcadddd1ab5144cdf0: failed to open stream: Permission denied Now trying to download from source
  • Syncing guzzlehttp/psr7 (2.4.3) into cache
  • Downloading laravel/socialite (v5.5.6)
  • Downloading laravel/socialite (v5.5.6)
  • Downloading laravel/socialite (v5.5.6)
  • Downloading laravel/socialite (v5.5.6) Failed to download laravel/socialite from dist: The "https://api.github.com/repos/laravel/socialite/zipball/1cd1682b709b8808a5b5dbb68179a58d1342aa7b" file could not be written to /var/www/bookstack/vendor/composer/tmp-1a1920ccabce1dc6a181166495f01cb0: failed to open stream: Permission denied Now trying to download from source
  • Syncing laravel/socialite (v5.5.6) into cache
  • Downloading nikic/php-parser (v4.15.2)
  • Downloading nikic/php-parser (v4.15.2)
  • Downloading nikic/php-parser (v4.15.2)
  • Downloading nikic/php-parser (v4.15.2) Failed to download nikic/php-parser from dist: The "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" file could not be written to /var/www/bookstack/vendor/composer/tmp-12e985414108bb70b728e57d401ba99e: failed to open stream: Permission denied Now trying to download from source
  • Syncing nikic/php-parser (v4.15.2) into cache
  • Downloading psy/psysh (v0.11.9)
  • Downloading psy/psysh (v0.11.9)
  • Downloading psy/psysh (v0.11.9)
  • Downloading psy/psysh (v0.11.9) Failed to download psy/psysh from dist: The "https://api.github.com/repos/bobthecow/psysh/zipball/1acec99d6684a54ff92f8b548a4e41b566963778" file could not be written to /var/www/bookstack/vendor/composer/tmp-f7be6f87b6a0597f7db3f1f92be4b237: failed to open stream: Permission denied Now trying to download from source
  • Syncing psy/psysh (v0.11.9) into cache
  • Downloading laravel/tinker (v2.7.3)
  • Downloading laravel/tinker (v2.7.3)
  • Downloading laravel/tinker (v2.7.3)
  • Downloading laravel/tinker (v2.7.3) Failed to download laravel/tinker from dist: The "https://api.github.com/repos/laravel/tinker/zipball/5062061b4924af3392225dd482ca7b4d85d8b8ef" file could not be written to /var/www/bookstack/vendor/composer/tmp-ef7d025809c212d532c894adea2d954f: failed to open stream: Permission denied Now trying to download from source
  • Syncing laravel/tinker (v2.7.3) into cache
  • Downloading aws/aws-sdk-php (3.247.1)
  • Downloading aws/aws-sdk-php (3.247.1)
  • Downloading aws/aws-sdk-php (3.247.1)
  • Downloading aws/aws-sdk-php (3.247.1) Failed to download aws/aws-sdk-php from dist: The "https://api.github.com/repos/aws/aws-sdk-php/zipball/337e447997148b9e5024c2d0ae69618b1cbf80d6" file could not be written to /var/www/bookstack/vendor/composer/tmp-d0cbacc884eed31b734928ae3f5e2128: failed to open stream: Permission denied Now trying to download from source
  • Syncing aws/aws-sdk-php (3.247.1) into cache
  • Downloading phpseclib/phpseclib (3.0.17)
  • Downloading phpseclib/phpseclib (3.0.17)
  • Downloading phpseclib/phpseclib (3.0.17)
  • Downloading phpseclib/phpseclib (3.0.17) Failed to download phpseclib/phpseclib from dist: The "https://api.github.com/repos/phpseclib/phpseclib/zipball/dbc2307d5c69aeb22db136c52e91130d7f2ca761" file could not be written to /var/www/bookstack/vendor/composer/tmp-31c01ceb0d65fb9f8f31cd6ab01d4ab2: failed to open stream: Permission denied Now trying to download from source
  • Syncing phpseclib/phpseclib (3.0.17) into cache
  • Removing laravel/ui (v3.4.6)
  • Removing symfony/polyfill-iconv (v1.26.0)
  • Removing symfony/polyfill-php80 (v1.26.0)
  • Removing symfony/polyfill-mbstring (v1.26.0)
  • Removing symfony/polyfill-ctype (v1.26.0)
  • Removing vlucas/phpdotenv (v5.4.1)
  • Removing tijsverkoyen/css-to-inline-styles (2.2.4) Update of symfony/var-dumper failed
  • Removing symfony/routing (v5.4.11)
  • Removing symfony/polyfill-php72 (v1.26.0)
  • Removing symfony/polyfill-intl-normalizer (v1.26.0)
  • Removing symfony/polyfill-intl-idn (v1.26.0)
  • Removing symfony/mime (v5.4.12)
  • Removing symfony/polyfill-php73 (v1.26.0)
  • Removing symfony/http-foundation (v5.4.12) Update of symfony/error-handler failed
  • Removing symfony/http-kernel (v5.4.12)
  • Removing symfony/polyfill-intl-grapheme (v1.26.0)
  • Removing symfony/string (v5.4.12)
  • Removing symfony/console (v5.4.12)
  • Removing symfony/polyfill-php81 (v1.26.0)
  • Removing symfony/translation (v5.4.12) Update of nesbot/carbon failed
  • Removing league/flysystem (1.1.9)
  • Removing laravel/serializable-closure (v1.2.1)
  • Removing dragonmantank/cron-expression (v3.3.1)
  • Removing doctrine/inflector (2.0.4)
  • Removing laravel/framework (v8.83.23)
  • Removing phenx/php-svg-lib (0.4.1)
  • Removing dompdf/dompdf (v2.0.0)
  • Removing doctrine/event-manager (1.1.2) Update of doctrine/dbal failed
  • Removing filp/whoops (2.14.5)
  • Removing guzzlehttp/psr7 (2.4.1)
  • Removing laravel/socialite (v5.5.5) Update of nikic/php-parser failed Update of psy/psysh failed
  • Removing laravel/tinker (v2.7.2)
  • Removing aws/aws-sdk-php (3.235.1)
  • Removing phpseclib/phpseclib (3.0.15) Uninstall of laravel/ui failed Update of symfony/polyfill-iconv failed Update of symfony/polyfill-php80 failed Update of symfony/polyfill-mbstring failed Update of symfony/polyfill-ctype failed Update of vlucas/phpdotenv failed Update of tijsverkoyen/css-to-inline-styles failed Update of symfony/routing failed Update of symfony/polyfill-php72 failed Update of symfony/polyfill-intl-normalizer failed 0/24 [>---------------------------] 0% Update of symfony/polyfill-intl-idn failed Update of symfony/polyfill-php73 failed Update of symfony/polyfill-intl-grapheme failed 3/24 [===>------------------------] 12% Update of symfony/mime failed Update of symfony/http-foundation failed Update of symfony/string failed Update of symfony/console failed Update of symfony/polyfill-php81 failed Update of symfony/translation failed Update of symfony/http-kernel failed Update of league/flysystem failed Update of laravel/serializable-closure failed Update of dragonmantank/cron-expression failed Update of phenx/php-svg-lib failed Update of doctrine/inflector failed Update of dompdf/dompdf failed Update of doctrine/event-manager failed Update of guzzlehttp/psr7 failed Update of laravel/socialite failed Update of laravel/tinker failed Update of filp/whoops failed 21/24 [========================>---] 87% Update of phpseclib/phpseclib failed Update of laravel/framework failed 23/24 [==========================>-] 95% Update of aws/aws-sdk-php failed 24/24 [============================] 100%

[RuntimeException] Could not delete /var/www/bookstack/vendor/bin/var-dump-server:

install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-scripts] [--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] [--] []...

patsyk1 commented 1 year ago

sudo php artisan migrate


Migrating: 2022_07_16_170051_drop_joint_permission_type Migrated: 2022_07_16_170051_drop_joint_permission_type (15,988.30ms) Migrating: 2022_08_17_092941_create_references_table

In Connection.php line 712:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'references' already exists (SQL: create table refe rences (id bigint unsigned not null auto_increment primary key, from_id int unsigned not null, from_type var char(25) not null, to_id int unsigned not null, to_type varchar(25) not null) default character set utf8mb4 col late 'utf8mb4_unicode_ci')

In Connection.php line 501:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'references' already exists

patsyk1 commented 1 year ago

@ssddanbrown I realise I've given you what was outputted when the update was initially run. Do you need me to re-run the above and provide outputs?

ssddanbrown commented 1 year ago

Okay, looks like there are a couple of issues at play right now:

  1. The composer install --no-dev step is not completing properly due to permission errors. The vendor/ folder in the BookStack directory needs to be fully writable by the user running the command.
  2. The database migration is failing since the database state is not as expected. Hard to state why this is occuring, but it's most common when an upgrade has been attempted before but has failed for another reason. Could also be related to the failing step above or the originally altered files.

To fix 1, you'll need to run the command with a more privileged user (or via sudo for example) or update the permissions of all in that folder. Let me know if you need guidance on that, just confirm the user used to run commands.

To fix 2, You'd need to drop the references table in the bookstack database. Let me know if you need guidance on this. Ideally backup the system/database before attempting any changes.

patsyk1 commented 1 year ago

Thanks @ssddanbrown.

Could you provide some guidance on fix 2. Backing up database and files I can do, but SQL is a weak point.

I have a checkpoint of Ubuntu install prior to the updated. So I'll roll back to this and elevate the composer install --no-dev step.

Many thanks in advance.

ssddanbrown commented 1 year ago

Sure. In the below, replaced any <variables> marked as so, including the angled quotes. Use the variables from your /var/www/bookstack/.env file.

# Login to MySQL
mysql -u <database_username> -p<database_password>

# Enter the BookStack database
use <database_name>;

# Drop the references table
drop table references;

# Exit MySQL
exit;

Then re-run the update commands if all was successfull. Upon any error, record and report back the first error without progressing. Errors can be different a second time around so it's important we see the first errors.

patsyk1 commented 1 year ago

Hi @ssddanbrown,

Dropping that table worked and I was able to run sudo php artisan migrate. However, now I have the same issue as before (when I updated to 22.09.01) wherein there are a large number of Books, Chapters and Pages missing.

Restoring the database then just takes me back to the above errors again. :)

ssddanbrown commented 1 year ago

However, now I have the same issue as before (when I updated to 22.09.01) wherein there are a large number of Books, Chapters and Pages missing.

Okay, this indicates that the database might have been out of sync with the codebase before, which may have led to the further errors you've solved above. This is just a case of the permission handling though, regenerating the "cached" permissions via this command should solve this particular issue. Just need to run this from your BookStack folder.

php artisan bookstack:regenerate-permissions
patsyk1 commented 1 year ago

Brilliant - that's done it. Many thanks, @ssddanbrown. Very much appreciate the quick responses and help here.

Bookstack is a great product so I look forward to seeing future updates and watching it grow in popularity!

ssddanbrown commented 1 year ago

Awesome, Good to hear! Will therefore close this off.