[Bug Report]: OIDC Login #2474

Closed
opened 2026-02-05 04:16:00 +03:00 by OVERLORD · 13 comments
Owner

Originally created by @git-noise on GitHub (Nov 1, 2021).

Describe the Bug

OIDC login leads to a blank page and a HTTP 500 query answer

Steps to Reproduce

  1. Configure OIDC
  2. Go to login page and click on OIDC Login

Expected Behaviour

OIDC Login should redirect to the OIDC provider login page or log the user into Bookstack if already logged-in

Screenshots or Additional Context

Laravel logs:

production.ERROR: Uncaught ErrorException: Undefined variable: cspNonce in /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php:53

Exact BookStack Version

v21.10.3 - same on v21.10.2

PHP Version

7.2

Hosting Environment

Ubuntu 18.04 LTS, Apachee2 reverse-proxy, manual installation.

Originally created by @git-noise on GitHub (Nov 1, 2021). ### Describe the Bug OIDC login leads to a blank page and a HTTP 500 query answer ### Steps to Reproduce 1. Configure OIDC 2. Go to login page and click on OIDC Login ### Expected Behaviour OIDC Login should redirect to the OIDC provider login page or log the user into Bookstack if already logged-in ### Screenshots or Additional Context Laravel logs: ``` production.ERROR: Uncaught ErrorException: Undefined variable: cspNonce in /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php:53 ``` ### Exact BookStack Version v21.10.3 - same on v21.10.2 ### PHP Version 7.2 ### Hosting Environment Ubuntu 18.04 LTS, Apachee2 reverse-proxy, manual installation.
OVERLORD added the 🐛 Bug label 2026-02-05 04:16:00 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Nov 1, 2021):

Hi @git-noise,

Could you open the file /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php on your instance, scroll to the bottom and find a line that contains "PATH" and "ENDPATH" then provide the show path? I just need to understand where this may be originating from.

@ssddanbrown commented on GitHub (Nov 1, 2021): Hi @git-noise, Could you open the file `/opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php` on your instance, scroll to the bottom and find a line that contains "PATH" and "ENDPATH" then provide the show path? I just need to understand where this may be originating from.
Author
Owner

@git-noise commented on GitHub (Nov 1, 2021):

Hello and thanks for your answer.
Sure thing it is:
/opt/bookstack/BookStack/resources/views/layouts/base.blade.php

Thanks,

@git-noise commented on GitHub (Nov 1, 2021): Hello and thanks for your answer. Sure thing it is: ```/opt/bookstack/BookStack/resources/views/layouts/base.blade.php``` Thanks,
Author
Owner

@ssddanbrown commented on GitHub (Nov 1, 2021):

Thanks @git-noise, Not really sure why you'd be getting that error.

Could you:

  1. Confirm the output of running git status within the BookStack install folder.
  2. Confirm the URL path (Just the part after your own domain) in the browser when this error occurs.
  3. Confirm, if existing, any more of the stack trace in the error log (List of lines after the shared error mesage).
@ssddanbrown commented on GitHub (Nov 1, 2021): Thanks @git-noise, Not really sure why you'd be getting that error. Could you: 1. Confirm the output of running `git status` within the BookStack install folder. 2. Confirm the URL path (Just the part after your own domain) in the browser when this error occurs. 3. Confirm, if existing, any more of the stack trace in the error log (List of lines after the shared error mesage).
Author
Owner

@git-noise commented on GitHub (Nov 2, 2021):

Here it is:

  1. git status
On branch release
Your branch is up to date with 'origin/release'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   app/Config/database.php

no changes added to commit (use "git add" and/or "git commit -a")

This change comes from mysql TLS config

  1. URL path:
    /oidc/login

  2. Stack trace:

production.ERROR: Uncaught ErrorException: Undefined variable: cspNonce in /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php:53
Stack trace:
#0 /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php(53): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined varia...', '/opt/bookstack/...', 53, Array)
#1 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(43): include('/opt/bookstack/...')
#2 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('/opt/bookstack/...', Array)
#3 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/View.php(143): Illuminate\View\Engines\CompilerEngine->get('/opt/bookstack/...', Array)
#4 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/View.php(126): Illuminate\View\View->getContents()
#5 /opt/bookstack/BookStack/vendor/lar {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Uncaught ErrorException: Undefined variable: cspNonce in /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php:53
Stack trace:
#0 /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php(53): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'Undefined varia...', '/opt/bookstack/...', 53, Array)
#1 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(43): include('/opt/bookstack/...')
#2 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\\View\\Engines\\PhpEngine->evaluatePath('/opt/bookstack/...', Array)
#3 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/View.php(143): Illuminate\\View\\Engines\\CompilerEngine->get('/opt/bookstack/...', Array)
#4 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/View.php(126): Illuminate\\View\\View->getContents()
#5 /opt/bookstack/BookStack/vendor/lar at /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php:53)
[stacktrace]
#0 {main}
"} 

Many thanks,

@git-noise commented on GitHub (Nov 2, 2021): Here it is: 1. git status ``` On branch release Your branch is up to date with 'origin/release'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: app/Config/database.php no changes added to commit (use "git add" and/or "git commit -a") ``` This change comes from mysql TLS config 2. URL path: ```/oidc/login``` 3. Stack trace: ``` production.ERROR: Uncaught ErrorException: Undefined variable: cspNonce in /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php:53 Stack trace: #0 /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php(53): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined varia...', '/opt/bookstack/...', 53, Array) #1 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(43): include('/opt/bookstack/...') #2 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('/opt/bookstack/...', Array) #3 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/View.php(143): Illuminate\View\Engines\CompilerEngine->get('/opt/bookstack/...', Array) #4 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/View.php(126): Illuminate\View\View->getContents() #5 /opt/bookstack/BookStack/vendor/lar {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Uncaught ErrorException: Undefined variable: cspNonce in /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php:53 Stack trace: #0 /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php(53): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'Undefined varia...', '/opt/bookstack/...', 53, Array) #1 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(43): include('/opt/bookstack/...') #2 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\\View\\Engines\\PhpEngine->evaluatePath('/opt/bookstack/...', Array) #3 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/View.php(143): Illuminate\\View\\Engines\\CompilerEngine->get('/opt/bookstack/...', Array) #4 /opt/bookstack/BookStack/vendor/laravel/framework/src/Illuminate/View/View.php(126): Illuminate\\View\\View->getContents() #5 /opt/bookstack/BookStack/vendor/lar at /opt/bookstack/BookStack/storage/framework/views/1a15a2c52c34a48c83eaeee648b7bab225c2ed2d.php:53) [stacktrace] #0 {main} "} ``` Many thanks,
Author
Owner

@ssddanbrown commented on GitHub (Nov 2, 2021):

@git-noise Thanks for providing the information but I really don't understand this one.

The /oidc/login endpoint should not even utilise a view which is what the system is attempting use here and erroring out upon. Additionally, the cspNonce value should be available to all web endpoint views.

Does everything in a non-oidc context work without issue? So with standard authentication can you access the system and perform all common functions without issue?

@ssddanbrown commented on GitHub (Nov 2, 2021): @git-noise Thanks for providing the information but I really don't understand this one. The `/oidc/login` endpoint should not even utilise a view which is what the system is attempting use here and erroring out upon. Additionally, the cspNonce value should be available to all web endpoint views. Does everything in a non-oidc context work without issue? So with standard authentication can you access the system and perform all common functions without issue?
Author
Owner

@git-noise commented on GitHub (Nov 2, 2021):

@ssddanbrown
Indeed I can, either via local database or gitlab and everything works well.

Regarding OIDC case, nothing in the web console either, except for that 500 internal error to https://mydomain/oidc/login.
That being said, I am getting a 404 on that /oidc/login when I am doing a get on it. Am I redirected to the right page?

@git-noise commented on GitHub (Nov 2, 2021): @ssddanbrown Indeed I can, either via local database or gitlab and everything works well. Regarding OIDC case, nothing in the web console either, except for that 500 internal error to https://mydomain/oidc/login. That being said, I am getting a 404 on that /oidc/login when I am doing a get on it. Am I redirected to the right page?
Author
Owner

@ssddanbrown commented on GitHub (Nov 2, 2021):

Regarding OIDC case, nothing in the web console either, except for that 500 internal error to https://mydomain/oidc/login.
That being said, I am getting a 404 on that /oidc/login when I am doing a get on it. Am I redirected to the right page?

404 on GET is expected, since it's a post endpoint.

Can you list any .php files that are in the bootstrap/cache directory within your instance?

@ssddanbrown commented on GitHub (Nov 2, 2021): > Regarding OIDC case, nothing in the web console either, except for that 500 internal error to https://mydomain/oidc/login. That being said, I am getting a 404 on that /oidc/login when I am doing a get on it. Am I redirected to the right page? 404 on `GET` is expected, since it's a post endpoint. Can you list any `.php` files that are in the `bootstrap/cache` directory within your instance?
Author
Owner

@git-noise commented on GitHub (Nov 2, 2021):

Regarding OIDC case, nothing in the web console either, except for that 500 internal error to https://mydomain/oidc/login.
That being said, I am getting a 404 on that /oidc/login when I am doing a get on it. Am I redirected to the right page?

404 on GET is expected, since it's a post endpoint.

I figured, makes sense, but you never know

Can you list any .php files that are in the bootstrap/cache directory within your instance?

Yes so I have:

packages.php
services.php
@git-noise commented on GitHub (Nov 2, 2021): > > Regarding OIDC case, nothing in the web console either, except for that 500 internal error to https://mydomain/oidc/login. > > That being said, I am getting a 404 on that /oidc/login when I am doing a get on it. Am I redirected to the right page? > > 404 on `GET` is expected, since it's a post endpoint. I figured, makes sense, but you never know > Can you list any `.php` files that are in the `bootstrap/cache` directory within your instance? Yes so I have: ``` packages.php services.php ```
Author
Owner

@git-noise commented on GitHub (Nov 3, 2021):

@ssddanbrown

Hello,

If it makes sense I'll try to redeploy things in a containerized environment and report back. If I am the only one with this error it may be linked to some legacy things from previous installation that are not playing too well. It won't be immediate, but I'll get to it when I can.

Best,

@git-noise commented on GitHub (Nov 3, 2021): @ssddanbrown Hello, If it makes sense I'll try to redeploy things in a containerized environment and report back. If I am the only one with this error it may be linked to some legacy things from previous installation that are not playing too well. It won't be immediate, but I'll get to it when I can. Best,
Author
Owner

@santiago-mooser commented on GitHub (Nov 8, 2021):

I'm having the same issue, but I think it may have to do with a broken foreign key constraint in my database. I upgraded from MariaDB 10.4.x to 10.5.12 and bookstack 21.04.2 to 21.08.5 and I'm getting a 500 error when I try to sign in.

The setup I'm currently running is using docker-compose:

  bookstack_db:
    image: linuxserver/mariadb:10.5.12
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=${bookstack_pass}
      - TZ=Asia/Hong_Kong
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=${bookstack_pass}
    volumes:
      - ${volume_folder}/bookstack/db:/config
    restart: unless-stopped
    networks:
      - bookstack_network



  bookstack:
    image: linuxserver/bookstack:10.08.6
    environment:
      - PUID=1000
      - PGID=1000
      - APP_URL=${bookstack_url}
      - DB_HOST=bookstack_db
      - DB_USER=bookstack
      - DB_DATABASE=bookstackapp
      - DB_PASS=${bookstack_pass}
      - MAIL_HOST=${mail_host}
      - MAIL_USERNAME=${mail_username}
      - MAIL_PASSWORD=${mail_password}
      - MAIL_PORT=${mail_port}
      - MAIL_FROM=${mail_from}
      - MAIL_FROM_NAME=${mail_from_name}
      - MAIL_ENCRYPTION=${mail_encryption}
      - SESSION_LIFETIME=${bookstack_session_lifetime}
      - MEMCACHED_SERVERS='${memcached_host}:${memcached_port}'
    volumes:
      - ${volume_folder}/bookstack/bookstack:/config
    restart: unless-stopped
    depends_on:
      - bookstack_db
    networks:
      - bookstack_network
[...]

And I made the mistake of upgrading both containers without checking whether I needed to go through an upgrade procedure (my mistake...), so I'm in the process of figuring out what the problem is.

This is the nginx error log:

Stack trace:
#0 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(40): PDO->__construct()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(67): Doctrine\DBAL\Driver\PDOConnection->__construct()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(100): Illuminate\Database\Connectors\Connector->createPdoConnection()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(50): Illuminate\Database\Connectors\Connector->tryAgainIfCausedByLostConnection()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection()
#5 /var/www/html/vendor/la

And this is the php error log (there doesn't seem to be anything unusual here):

[08-Nov-2021 02:42:42] NOTICE: fpm is running, pid 376
[08-Nov-2021 02:42:42] NOTICE: ready to handle connections

However, I am getting some weird errors with MariaDB when I try to export it with mysqldump:

-- MariaDB dump 10.19  Distrib 10.5.12-MariaDB, for Linux (x86_64)
--
-- Host: localhost    Database: bookstackapp
-- ------------------------------------------------------
-- Server version       10.5.12-MariaDB-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `activities`
--

DROP TABLE IF EXISTS `activities`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `activities` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `detail` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int(11) NOT NULL,
  `ip` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL,
  `entity_id` int(11) DEFAULT NULL,
  `entity_type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `activities_user_id_index` (`user_id`),
  KEY `activities_entity_id_index` (`entity_id`),
  KEY `activities_key_index` (`type`),
  KEY `activities_created_at_index` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=392 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `activities`
--

mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ `id`, `type`, `detail`, `user_id`, `ip`, `entity_id`, `entity_type`, `created_at`, `updated_at` FROM `activities`': Lost connection to MySQL server during query (2013)

Considering that someone got a similar error when there was a piece of data that broke a foreign key contraint, I think something happened in the update from 21.04.2 to 21.08.6 that fucked a database row up and is now preventing the database from properly working.

I'll look into it a bit more and update as soon as I figure out the problem.

@santiago-mooser commented on GitHub (Nov 8, 2021): I'm having the same issue, but I think it may have to do with a broken foreign key constraint in my database. I upgraded from MariaDB 10.4.x to 10.5.12 and bookstack 21.04.2 to 21.08.5 and I'm getting a 500 error when I try to sign in. The setup I'm currently running is using docker-compose: ```yaml bookstack_db: image: linuxserver/mariadb:10.5.12 environment: - PUID=1000 - PGID=1000 - MYSQL_ROOT_PASSWORD=${bookstack_pass} - TZ=Asia/Hong_Kong - MYSQL_DATABASE=bookstackapp - MYSQL_USER=bookstack - MYSQL_PASSWORD=${bookstack_pass} volumes: - ${volume_folder}/bookstack/db:/config restart: unless-stopped networks: - bookstack_network bookstack: image: linuxserver/bookstack:10.08.6 environment: - PUID=1000 - PGID=1000 - APP_URL=${bookstack_url} - DB_HOST=bookstack_db - DB_USER=bookstack - DB_DATABASE=bookstackapp - DB_PASS=${bookstack_pass} - MAIL_HOST=${mail_host} - MAIL_USERNAME=${mail_username} - MAIL_PASSWORD=${mail_password} - MAIL_PORT=${mail_port} - MAIL_FROM=${mail_from} - MAIL_FROM_NAME=${mail_from_name} - MAIL_ENCRYPTION=${mail_encryption} - SESSION_LIFETIME=${bookstack_session_lifetime} - MEMCACHED_SERVERS='${memcached_host}:${memcached_port}' volumes: - ${volume_folder}/bookstack/bookstack:/config restart: unless-stopped depends_on: - bookstack_db networks: - bookstack_network [...] ``` And I made the mistake of upgrading both containers without checking whether I needed to go through an upgrade procedure (my mistake...), so I'm in the process of figuring out what the problem is. This is the nginx error log: ```log Stack trace: #0 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(40): PDO->__construct() #1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(67): Doctrine\DBAL\Driver\PDOConnection->__construct() #2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(100): Illuminate\Database\Connectors\Connector->createPdoConnection() #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(50): Illuminate\Database\Connectors\Connector->tryAgainIfCausedByLostConnection() #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection() #5 /var/www/html/vendor/la ``` And this is the php error log (there doesn't seem to be anything unusual here): ```log [08-Nov-2021 02:42:42] NOTICE: fpm is running, pid 376 [08-Nov-2021 02:42:42] NOTICE: ready to handle connections ``` However, I am getting some weird errors with MariaDB when I try to export it with mysqldump: ```bash -- MariaDB dump 10.19 Distrib 10.5.12-MariaDB, for Linux (x86_64) -- -- Host: localhost Database: bookstackapp -- ------------------------------------------------------ -- Server version 10.5.12-MariaDB-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `activities` -- DROP TABLE IF EXISTS `activities`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `activities` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `detail` text COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` int(11) NOT NULL, `ip` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL, `entity_id` int(11) DEFAULT NULL, `entity_type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `activities_user_id_index` (`user_id`), KEY `activities_entity_id_index` (`entity_id`), KEY `activities_key_index` (`type`), KEY `activities_created_at_index` (`created_at`) ) ENGINE=InnoDB AUTO_INCREMENT=392 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `activities` -- mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ `id`, `type`, `detail`, `user_id`, `ip`, `entity_id`, `entity_type`, `created_at`, `updated_at` FROM `activities`': Lost connection to MySQL server during query (2013) ``` Considering that someone [got a similar error when there was a piece of data that broke a foreign key contraint](https://stackoverflow.com/questions/30554280/error-2013-hy000-lost-connection-to-mysql-server-during-query-while-loading), I think something happened in the update from 21.04.2 to 21.08.6 that fucked a database row up and is now preventing the database from properly working. I'll look into it a bit more and update as soon as I figure out the problem.
Author
Owner

@santiago-mooser commented on GitHub (Nov 8, 2021):

So, it seems that there is some type of corruption or attribute break in the activities table. I was able to figure out by manually dumping all the different tables.

I got the full table list:

root@8a434e1bdfa0:/config# mysql -u bookstack -pObviouslyNOtMyPassword bookstackapp -e 'show tables'
+------------------------+
| Tables_in_bookstackapp |
+------------------------+
| activities             |
| api_tokens             |
| attachments            |
| books                  |
| bookshelves            |
| bookshelves_books      |
| cache                  |
| chapters               |
| comments               |
| deletions              |
| email_confirmations    |
| entity_permissions     |
| favourites             |
| images                 |
| joint_permissions      |
| mfa_values             |
| migrations             |
| page_revisions         |
| pages                  |
| password_resets        |
| permission_role        |
| role_permissions       |
| role_user              |
| roles                  |
| search_terms           |
| sessions               |
| settings               |
| social_accounts        |
| tags                   |
| user_invites           |
| users                  |
| views                  |
+------------------------+

Then wrote up a really dirty mysqldump script:

root@8a434e1bdfa0:/config# cat extract_tables.sh
TABLES=('activities' 'api_tokens' 'attachments' 'books' 'bookshelves' 'bookshelves_books' 'cache' 'chapters' 'comments' 'deletions' 'email_confirmations' 'entity_permissions' 'favourites' 'images' 'joint_permissions' 'mfa_values' 'migrations' 'page_revisions' 'pages' 'password_resets' 'permission_role' 'role_permissions' 'role_user' 'roles' 'search_terms' 'sessions' 'settings' 'social_accounts' 'tags' 'user_invites' 'users' 'views')

for table in "${TABLES[@]}"; do 
  echo "extracting table $table"
  mysqldump -u bookstack -pObviouslyNOtMyPassword bookstackapp -e "$table" > "$table.sql"
done

This would crash my database(?) which would then refuse to do anything:

mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ `id`, `type`, `detail`, `user_id`, `ip`, `entity_id`, `entity_type`, `created_at`, `updated_at` FROM `activities`': Lost connection to MySQL server during query (2013)
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect

From here, I simply removed the activities table from the dump script:

root@8a434e1bdfa0:/config# cat extract_tables.sh
TABLES=('api_tokens' 'attachments' 'books' 'bookshelves' 'bookshelves_books' 'cache' 'chapters' 'comments' 'deletions' 'email_confirmations' 'entity_permissions' 'favourites' 'images' 'joint_permissions' 'mfa_values' 'migrations' 'page_revisions' 'pages' 'password_resets' 'permission_role' 'role_permissions' 'role_user' 'roles' 'search_terms' 'sessions' 'settings' 'social_accounts' 'tags' 'user_invites' 'users' 'views')

for table in "${TABLES[@]}"; do 
  echo "extracting table $table"
  mysqldump -u bookstack -pObviouslyNOtMyPassword bookstackapp -e "$table" > "$table.sql"
done

And was able to successfully extract all other tables:

root@8a434e1bdfa0:/config# ./extract_tables.sh 
extracting table api_tokens
extracting table attachments
extracting table books
extracting table bookshelves
extracting table bookshelves_books
extracting table cache
extracting table chapters
extracting table comments
extracting table deletions
extracting table email_confirmations
extracting table entity_permissions
extracting table favourites
extracting table images
extracting table joint_permissions
extracting table mfa_values
extracting table migrations
extracting table page_revisions
extracting table pages
extracting table password_resets
extracting table permission_role
extracting table role_permissions
extracting table role_user
extracting table roles
extracting table search_terms
extracting table sessions
extracting table settings
extracting table social_accounts
extracting table tags
extracting table user_invites
extracting table users
extracting table views

Conclusion

Something in the upgrade process of either the database or bookstack corrupted or changed the values in the activities table to the point where not even the DBMS is able to open the table correctly. I'll have to see whether I'm able to re-import the information without the activities table into a new bookstack instance.

I have no idea what happened but I'll update you guys as I figure it out 🤷🏼

@santiago-mooser commented on GitHub (Nov 8, 2021): So, it seems that there is some type of corruption or attribute break in the `activities` table. I was able to figure out by manually dumping all the different tables. I got the full table list: ```bash root@8a434e1bdfa0:/config# mysql -u bookstack -pObviouslyNOtMyPassword bookstackapp -e 'show tables' +------------------------+ | Tables_in_bookstackapp | +------------------------+ | activities | | api_tokens | | attachments | | books | | bookshelves | | bookshelves_books | | cache | | chapters | | comments | | deletions | | email_confirmations | | entity_permissions | | favourites | | images | | joint_permissions | | mfa_values | | migrations | | page_revisions | | pages | | password_resets | | permission_role | | role_permissions | | role_user | | roles | | search_terms | | sessions | | settings | | social_accounts | | tags | | user_invites | | users | | views | +------------------------+ ``` Then wrote up a really dirty mysqldump script: ```bash root@8a434e1bdfa0:/config# cat extract_tables.sh TABLES=('activities' 'api_tokens' 'attachments' 'books' 'bookshelves' 'bookshelves_books' 'cache' 'chapters' 'comments' 'deletions' 'email_confirmations' 'entity_permissions' 'favourites' 'images' 'joint_permissions' 'mfa_values' 'migrations' 'page_revisions' 'pages' 'password_resets' 'permission_role' 'role_permissions' 'role_user' 'roles' 'search_terms' 'sessions' 'settings' 'social_accounts' 'tags' 'user_invites' 'users' 'views') for table in "${TABLES[@]}"; do echo "extracting table $table" mysqldump -u bookstack -pObviouslyNOtMyPassword bookstackapp -e "$table" > "$table.sql" done ``` This would crash my database(?) which would then refuse to do anything: ```bash mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ `id`, `type`, `detail`, `user_id`, `ip`, `entity_id`, `entity_type`, `created_at`, `updated_at` FROM `activities`': Lost connection to MySQL server during query (2013) mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (111)" when trying to connect ``` From here, I simply removed the `activities` table from the dump script: ```bash root@8a434e1bdfa0:/config# cat extract_tables.sh TABLES=('api_tokens' 'attachments' 'books' 'bookshelves' 'bookshelves_books' 'cache' 'chapters' 'comments' 'deletions' 'email_confirmations' 'entity_permissions' 'favourites' 'images' 'joint_permissions' 'mfa_values' 'migrations' 'page_revisions' 'pages' 'password_resets' 'permission_role' 'role_permissions' 'role_user' 'roles' 'search_terms' 'sessions' 'settings' 'social_accounts' 'tags' 'user_invites' 'users' 'views') for table in "${TABLES[@]}"; do echo "extracting table $table" mysqldump -u bookstack -pObviouslyNOtMyPassword bookstackapp -e "$table" > "$table.sql" done ``` And was able to successfully extract all other tables: ```bash root@8a434e1bdfa0:/config# ./extract_tables.sh extracting table api_tokens extracting table attachments extracting table books extracting table bookshelves extracting table bookshelves_books extracting table cache extracting table chapters extracting table comments extracting table deletions extracting table email_confirmations extracting table entity_permissions extracting table favourites extracting table images extracting table joint_permissions extracting table mfa_values extracting table migrations extracting table page_revisions extracting table pages extracting table password_resets extracting table permission_role extracting table role_permissions extracting table role_user extracting table roles extracting table search_terms extracting table sessions extracting table settings extracting table social_accounts extracting table tags extracting table user_invites extracting table users extracting table views ``` # Conclusion Something in the upgrade process of either the database or bookstack corrupted or changed the values in the `activities` table to the point where not even the DBMS is able to open the table correctly. I'll have to see whether I'm able to re-import the information without the `activities` table into a new bookstack instance. I have no idea what happened but I'll update you guys as I figure it out 🤷🏼
Author
Owner

@git-noise commented on GitHub (Nov 8, 2021):

Interesting @santiago-mooser. I am not using mariadb and do not have any DB issues afaik, but that maybe points to some upgrade silently gone wrong then.

@git-noise commented on GitHub (Nov 8, 2021): Interesting @santiago-mooser. I am not using mariadb and do not have any DB issues afaik, but that maybe points to some upgrade silently gone wrong then.
Author
Owner

@ssddanbrown commented on GitHub (Apr 25, 2022):

Since there's been no recent activity here I'm going to close this. If the issue remains and is something you still require to be fixed respond to my comment with the current status and this can then be re-opened.

@ssddanbrown commented on GitHub (Apr 25, 2022): Since there's been no recent activity here I'm going to close this. If the issue remains and is something you still require to be fixed respond to my comment with the current status and this can then be re-opened.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2474