BookStack
BookStack copied to clipboard
Issue upgrading to v22.09 from v22.07.3
Describe the Bug
After upgrading to v22.09 from v22.07.3 I cannot access any of my books. Instead, when I click on them I get An Error Occurred An unknown error occurred (See screenshot below). I get the same behavior when I attempt to login. I have attached the error logs.
Seems like a bug to me, but if anyone has any ideas for me to try please let me know. Thanks!
Rolling back to v22.07.3 and the app fires up as normal and there are no errors in the logs.
Steps to Reproduce
- Upgrade to v22.09. :)
Expected Behaviour
I can login and access books without error.
Screenshots or Additional Context

cont-init: info: running /etc/cont-init.d/10-adduser
-------------------------------------
_ ()
| | ___ _ __
| | / __| | | / \
| | \__ \ | | | () |
|_| |___/ |_| \__/
Brought to you by linuxserver.io
-------------------------------------
To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------
User uid: 1000
User gid: 1000
-------------------------------------
cont-init: info: /etc/cont-init.d/10-adduser exited 0
cont-init: info: running /etc/cont-init.d/11-folders
cont-init: info: /etc/cont-init.d/11-folders exited 0
cont-init: info: running /etc/cont-init.d/12-samples
cont-init: info: /etc/cont-init.d/12-samples exited 0
cont-init: info: running /etc/cont-init.d/13-nginx
cont-init: info: /etc/cont-init.d/13-nginx exited 0
cont-init: info: running /etc/cont-init.d/14-php
cont-init: info: /etc/cont-init.d/14-php exited 0
cont-init: info: running /etc/cont-init.d/15-keygen
using keys found in /config/keys
cont-init: info: /etc/cont-init.d/15-keygen exited 0
cont-init: info: running /etc/cont-init.d/20-permissions
cont-init: info: /etc/cont-init.d/20-permissions exited 0
cont-init: info: running /etc/cont-init.d/50-config
New container detected. Setting up app folder and fixing permissions.
App Key found - setting variable for seds
Running config - db_user set
/etc/cont-init.d/50-config: line 103: warning: command substitution: ignored null byte in input
/etc/cont-init.d/50-config: line 103: warning: command substitution: ignored null byte in input
Migrating: 2022_07_16_170051_drop_joint_permission_type
Illuminate\Database\QueryException
SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP INDEX `PRIMARY`; check that it exists (SQL: alter table `joint_permissions` drop primary key)
at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
708▕ // If an exception occurs when attempting to run a query, we'll format the error
709▕ // message to include the bindings with SQL, which will make this exception a
710▕ // lot more helpful to the developer instead of just the database's errors.
711▕ catch (Exception $e) {
➜ 712▕ throw new QueryException(
713▕ $query, $this->prepareBindings($bindings), $e
714▕ );
715▕ }
716▕ }
+9 vendor frames
10 /app/www/database/migrations/2022_07_16_170051_drop_joint_permission_type.php:25
Illuminate\Support\Facades\Facade::__callStatic()
+22 vendor frames
33 /app/www/artisan:37
Illuminate\Foundation\Console\Kernel::handle()
cont-init: info: /etc/cont-init.d/50-config exited 0
cont-init: info: running /etc/cont-init.d/85-version-checks
**** The following active confs have different version dates than the samples that are shipped. ****
**** This may be due to user customization or an update to the samples. ****
**** You should compare the following files to the samples in the same folder and update them. ****
**** Use the link at the top of the file to view the changelog. ****
/config/nginx/site-confs/default.conf
/config/nginx/nginx.conf
cont-init: info: /etc/cont-init.d/85-version-checks exited 0
cont-init: info: running /etc/cont-init.d/90-custom-folders
cont-init: info: /etc/cont-init.d/90-custom-folders exited 0
cont-init: info: running /etc/cont-init.d/99-custom-files
[custom-init] no custom files found, skipping...
cont-init: info: /etc/cont-init.d/99-custom-files exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-mods: starting
s6-rc: info: service init-mods successfully started
s6-rc: info: service init-mods-package-install: starting
s6-rc: info: service init-mods-package-install successfully started
s6-rc: info: service init-mods-end: starting
s6-rc: info: service init-mods-end successfully started
s6-rc: info: service init-services: starting
s6-rc: info: service init-services successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun cron (no readiness notification)
services-up: info: copying legacy longrun memcached (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
services-up: info: copying legacy longrun php-fpm (no readiness notification)
s6-rc: info: service legacy-services successfully started
s6-rc: info: service 99-ci-service-check: starting
[ls.io-init] done.
s6-rc: info: service 99-ci-service-check successfully started
Browser Details
Chrome Version 104.0.5112.102 (Official Build) (64-bit)
Exact BookStack Version
v22.09
PHP Version
No response
Hosting Environment
Docker on Ubuntu 22.04.
Hi
Just a thought...have you tried re-running
php artisan bookstack:regenerate-comment-content
php artisan migrate
php artisan cache:clear
php artisan view:clear
after doing the upgrade? Might help? I'm far from being an expert, so sorry in advance if this is of no use!
Hi @joe-eklund, Sorry for the late reply, had missed this one.
Looks like the database migrations are going wrong. Before following any of the below, please backup everything before proceeding. Please could you access the BookStack database and run the following command:
alter table joint_permissions add primary key (role_id, entity_type, entity_id, action);
This will add back-in the primary index that the migrations are expecting. It's likely that the issue may be elsewhere, so please watch the logs on the first start-up of the BookStack container after running the above, and note & report-back any errors. The errors may be different after the first start-up and therefore note helpful, it's important we see the first errors (If existing).
If you're not sure about accessing your database, I'm happy to provide guidance but I'd need some details on your setup (docker-compose.yml if using, or details on the database container in use and the environment variables used (Can omit any passwords of course)).
Since there's been no follow-up I'm going to close this. If the issue remains and is something you still require to be fixed respond to my previous comment and this can then be re-opened.
Since there's been no follow-up I'm going to close this. If the issue remains and is something you still require to be fixed respond to my previous comment and this can then be re-opened.
I haven't had a chance to test out your fix, but I will attempt to this weekend. If I still need help I can reopen. Thanks!
Hey @ssddanbrown I am still having an issue with this and started looking into it again.
I ran your commands and my current behavior is that I am missing some books, but not all of them. When I rebooted the bookstack container after running your alter table command I didn't see any errors. After it had been running for a few days I did notice I am getting the same error log as was detailed in the original post.
Any thoughts on other things to try?
@joe-eklund For clarity, can you confirm exactly what you're seeing again? Just want to be sure of the current state of things.
@joe-eklund For clarity, can you confirm exactly what you're seeing again? Just want to be sure of the current state of things.
The current state is that I am missing some of my books and pages after upgrading. Sometimes they would reappear after running for a day or two after rebooting, but it seems this time the missing ones are not coming back. I don't see any errors currently in my logs for bookstack or my database. Been running for a few days now.
Here is my most recent logs for my Bookstack container:
[custom-init] No custom services found, skipping...
[custom-init] Legacy service folder /config/custom-services.d is empty, deleting...
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service 00-legacy: starting
s6-rc: info: service 00-legacy successfully started
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/01-envfile
cont-init: info: /etc/cont-init.d/01-envfile exited 0
cont-init: info: running /etc/cont-init.d/01-migrations
[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] 02-default-location: skipped
[migrations] done
cont-init: info: /etc/cont-init.d/01-migrations exited 0
cont-init: info: running /etc/cont-init.d/10-adduser
-------------------------------------
_ ()
| | ___ _ __
| | / __| | | / \
| | \__ \ | | | () |
|_| |___/ |_| \__/
Brought to you by linuxserver.io
-------------------------------------
To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------
User uid: 1000
User gid: 1000
-------------------------------------
cont-init: info: /etc/cont-init.d/10-adduser exited 0
cont-init: info: running /etc/cont-init.d/11-folders
cont-init: info: /etc/cont-init.d/11-folders exited 0
cont-init: info: running /etc/cont-init.d/12-samples
cont-init: info: /etc/cont-init.d/12-samples exited 0
cont-init: info: running /etc/cont-init.d/13-nginx
cont-init: info: /etc/cont-init.d/13-nginx exited 0
cont-init: info: running /etc/cont-init.d/14-php
cont-init: info: /etc/cont-init.d/14-php exited 0
cont-init: info: running /etc/cont-init.d/15-keygen
using keys found in /config/keys
cont-init: info: /etc/cont-init.d/15-keygen exited 0
cont-init: info: running /etc/cont-init.d/20-permissions
cont-init: info: /etc/cont-init.d/20-permissions exited 0
cont-init: info: running /etc/cont-init.d/50-config
New container detected. Setting up app folder and fixing permissions.
App Key found - setting variable for seds
Running config - db_user set
/etc/cont-init.d/50-config: line 102: warning: command substitution: ignored null byte in input
/etc/cont-init.d/50-config: line 102: warning: command substitution: ignored null byte in input
Migrating: 2022_08_17_092941_create_references_table
Migrated: 2022_08_17_092941_create_references_table (209.16ms)
Migrating: 2022_09_02_082910_fix_shelf_cover_image_types
Migrated: 2022_09_02_082910_fix_shelf_cover_image_types (5.59ms)
Migrating: 2022_10_07_091406_flatten_entity_permissions_table
Migrated: 2022_10_07_091406_flatten_entity_permissions_table (143.65ms)
Migrating: 2022_10_08_104202_drop_entity_restricted_field
Migrated: 2022_10_08_104202_drop_entity_restricted_field (124.37ms)
cont-init: info: /etc/cont-init.d/50-config exited 0
cont-init: info: running /etc/cont-init.d/85-version-checks
**** The following active confs have different version dates than the samples that are shipped. ****
**** This may be due to user customization or an update to the samples. ****
**** You should compare the following files to the samples in the same folder and update them. ****
**** Use the link at the top of the file to view the changelog. ****
/config/nginx/site-confs/default.conf
/config/nginx/ssl.conf
/config/nginx/nginx.conf
cont-init: info: /etc/cont-init.d/85-version-checks exited 0
cont-init: info: running /etc/cont-init.d/99-custom-files
[custom-init] Legacy files folder /config/custom-cont-init.d is empty, deleting...
cont-init: info: /etc/cont-init.d/99-custom-files exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-mods: starting
s6-rc: info: service init-mods successfully started
s6-rc: info: service init-mods-package-install: starting
s6-rc: info: service init-mods-package-install successfully started
s6-rc: info: service init-mods-end: starting
s6-rc: info: service init-mods-end successfully started
s6-rc: info: service init-services: starting
s6-rc: info: service init-services successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun cron (no readiness notification)
services-up: info: copying legacy longrun memcached (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
services-up: info: copying legacy longrun php-fpm (no readiness notification)
s6-rc: info: service legacy-services successfully started
s6-rc: info: service 99-ci-service-check: starting
[ls.io-init] done.
s6-rc: info: service 99-ci-service-check successfully started
Okay, Good, looks like the database migrations are working correctly now, should mean the database is in a good state. For the missing items, try running the regenerate permissions command: https://www.bookstackapp.com/docs/admin/commands/#regenerate-access-permissions
Okay, Good, looks like the database migrations are working correctly now, should mean the database is in a good state. For the missing items, try running the regenerate permissions command: https://www.bookstackapp.com/docs/admin/commands/#regenerate-access-permissions
That fixed it! All my pages and books are available now. Thanks a bunch @ssddanbrown!
Awesome! Glad to hear things are good.