Can't install Bookstack: create_joint_permissions_table ................. 12ms FAIL #4432

Closed
opened 2026-02-05 08:52:35 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @Ultragian on GitHub (Jan 27, 2024).

Describe the Bug

Trying to install Bookstack through Portainer on CasaOS (doesn't matter much, basically Ubuntu).
It gives me this error:

Waiting for DB to be available
   INFO  Running migrations.  
  2016_04_20_192649_create_joint_permissions_table ................. 12ms FAIL
   Illuminate\Database\QueryException 
  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'joint_permissions' already exists (SQL: create table `joint_permissions` (`id` int unsigned not null auto_increment primary key, `role_id` int not null, `entity_type` varchar(191) not null, `entity_id` int not null, `action` varchar(191) not null, `has_permission` tinyint(1) not null default '0', `has_permission_own` tinyint(1) not null default '0', `created_by` int not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
  at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
    756▕         // If an exception occurs when attempting to run a query, we'll format the error
    757▕         // message to include the bindings with SQL, which will make this exception a
    758▕         // lot more helpful to the developer instead of just the database's errors.
    759▕         catch (Exception $e) {
  ➜ 760▕             throw new QueryException(
    761▕                 $query, $this->prepareBindings($bindings), $e
    762▕             );
    763▕         }
    764▕     }
      +9 vendor frames 
  10  /app/www/database/migrations/2016_04_20_192649_create_joint_permissions_table.php:16
      Illuminate\Support\Facades\Facade::__callStatic()
      +25 vendor frames 
  36  /app/www/artisan:35
      Illuminate\Foundation\Console\Kernel::handle()
[custom-init] No custom files found, skipping...
[ls.io-init] done.

Webpage won't ever load, apparently it cannot build itself completely, even if I delete all the files in it's directory and try again.
Here is my docker-compose:

version: "2"

services:
  # Service definition for BookStack
  bookstack:
    image: lscr.io/linuxserver/bookstack:latest # The Docker image for BookStack
    container_name: bookstack # Name of the container
    environment: # Environment variables for the BookStack service
      - PUID=1000 # User ID for the process
      - PGID=1000 # Group ID for the process
      - APP_URL=http://192.168.0.29:6875 # URL for accessing BookStack
      - DB_HOST=bookstack_db # Hostname of the database service
      - DB_PORT=3306 # Port for the database service
      - DB_USER=bookstack # Database user
      - DB_PASS=dbpassword # Database password
      - DB_DATABASE=bookstackapp # Database name
      - APP_DEFAULT_DARK_MODE=true # Enable dark mode by default
      - TZ=Europe/London
    volumes:
      - /DATA/AppData/bookstack/config:/config # Mount the volume for BookStack configuration
    ports:
      - 6875:80 # Map port 6875 on the host to port 80 in the container
    restart: unless-stopped # Restart policy
    depends_on:
      - bookstack_db # This service depends on the bookstack_db service
    networks:
      - bookstack-network # Connect to the bookstack-network

  # Service definition for the database (MariaDB)
  bookstack_db:
    image: lscr.io/linuxserver/mariadb:latest # The Docker image for MariaDB
    container_name: bookstack_db # Name of the container
    environment: # Environment variables for the MariaDB service
      - MYSQL_ROOT_PASSWORD=dbrootpassword # Root password for MariaDB
      - MYSQL_DATABASE=bookstackapp # Database name
      - MYSQL_USER=bookstack # Database user
      - MYSQL_PASSWORD=dbpassword # Database password
      - PUID=1000 # User ID for the process
      - PGID=1000 # Group ID for the process
      - TZ=Europe/London
    volumes:
      - /DATA/AppData/bookstack/db:/var/lib/mysql # Mount the volume for MariaDB data
    restart: unless-stopped # Restart policy
    networks:
      - bookstack-network # Connect to the bookstack-network

volumes:
  bookstack_config: # Volume for storing BookStack configuration
    driver: local
  bookstack_db_data: # Volume for storing MariaDB data
    driver: local

# Define the network configuration
networks:
  bookstack-network: # Custom network for inter-container communication
    driver: bridge # Use the bridge driver for the network

Steps to Reproduce

  1. Install bookstack through Portainer as a stack
  2. Get the error

Expected Behaviour

I should be able to build Bookstack normally and connect to it on http://192.168.0.29:6875

Screenshots or Additional Context

No response

Browser Details

Doesn't matter

Exact BookStack Version

Linuxserver.io version:- v23.12.2-ls127

Originally created by @Ultragian on GitHub (Jan 27, 2024). ### Describe the Bug Trying to install Bookstack through Portainer on CasaOS (doesn't matter much, basically Ubuntu). It gives me this error: ``` Waiting for DB to be available INFO Running migrations. 2016_04_20_192649_create_joint_permissions_table ................. 12ms FAIL Illuminate\Database\QueryException SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'joint_permissions' already exists (SQL: create table `joint_permissions` (`id` int unsigned not null auto_increment primary key, `role_id` int not null, `entity_type` varchar(191) not null, `entity_id` int not null, `action` varchar(191) not null, `has_permission` tinyint(1) not null default '0', `has_permission_own` tinyint(1) not null default '0', `created_by` int not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci') at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760 756▕ // If an exception occurs when attempting to run a query, we'll format the error 757▕ // message to include the bindings with SQL, which will make this exception a 758▕ // lot more helpful to the developer instead of just the database's errors. 759▕ catch (Exception $e) { ➜ 760▕ throw new QueryException( 761▕ $query, $this->prepareBindings($bindings), $e 762▕ ); 763▕ } 764▕ } +9 vendor frames 10 /app/www/database/migrations/2016_04_20_192649_create_joint_permissions_table.php:16 Illuminate\Support\Facades\Facade::__callStatic() +25 vendor frames 36 /app/www/artisan:35 Illuminate\Foundation\Console\Kernel::handle() [custom-init] No custom files found, skipping... [ls.io-init] done. ``` Webpage won't ever load, apparently it cannot build itself completely, even if I delete all the files in it's directory and try again. Here is my docker-compose: ```yaml version: "2" services: # Service definition for BookStack bookstack: image: lscr.io/linuxserver/bookstack:latest # The Docker image for BookStack container_name: bookstack # Name of the container environment: # Environment variables for the BookStack service - PUID=1000 # User ID for the process - PGID=1000 # Group ID for the process - APP_URL=http://192.168.0.29:6875 # URL for accessing BookStack - DB_HOST=bookstack_db # Hostname of the database service - DB_PORT=3306 # Port for the database service - DB_USER=bookstack # Database user - DB_PASS=dbpassword # Database password - DB_DATABASE=bookstackapp # Database name - APP_DEFAULT_DARK_MODE=true # Enable dark mode by default - TZ=Europe/London volumes: - /DATA/AppData/bookstack/config:/config # Mount the volume for BookStack configuration ports: - 6875:80 # Map port 6875 on the host to port 80 in the container restart: unless-stopped # Restart policy depends_on: - bookstack_db # This service depends on the bookstack_db service networks: - bookstack-network # Connect to the bookstack-network # Service definition for the database (MariaDB) bookstack_db: image: lscr.io/linuxserver/mariadb:latest # The Docker image for MariaDB container_name: bookstack_db # Name of the container environment: # Environment variables for the MariaDB service - MYSQL_ROOT_PASSWORD=dbrootpassword # Root password for MariaDB - MYSQL_DATABASE=bookstackapp # Database name - MYSQL_USER=bookstack # Database user - MYSQL_PASSWORD=dbpassword # Database password - PUID=1000 # User ID for the process - PGID=1000 # Group ID for the process - TZ=Europe/London volumes: - /DATA/AppData/bookstack/db:/var/lib/mysql # Mount the volume for MariaDB data restart: unless-stopped # Restart policy networks: - bookstack-network # Connect to the bookstack-network volumes: bookstack_config: # Volume for storing BookStack configuration driver: local bookstack_db_data: # Volume for storing MariaDB data driver: local # Define the network configuration networks: bookstack-network: # Custom network for inter-container communication driver: bridge # Use the bridge driver for the network ``` ### Steps to Reproduce 1) Install bookstack through Portainer as a stack 2) Get the error ### Expected Behaviour I should be able to build Bookstack normally and connect to it on http://192.168.0.29:6875 ### Screenshots or Additional Context _No response_ ### Browser Details Doesn't matter ### Exact BookStack Version Linuxserver.io version:- v23.12.2-ls127
OVERLORD added the 🐛 Bug label 2026-02-05 08:52:35 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jan 27, 2024):

Hi @Ultragian,
That kind of errors is something typically seen on a secondary/non-primary run of the app (since it's reporting existing database tables).
Could you potentially perform a run from a completely clear/empty database, then report the error upon first-start-up-run?

@ssddanbrown commented on GitHub (Jan 27, 2024): Hi @Ultragian, That kind of errors is something typically seen on a secondary/non-primary run of the app (since it's reporting existing database tables). Could you potentially perform a run from a completely clear/empty database, then report the error upon first-start-up-run?
Author
Owner

@Ultragian commented on GitHub (Jan 27, 2024):

Hey @ssddanbrown, as far as I understand, it is a primary run. I deleted all the files present in "/DATA/AppData/bookstack/" and reinstalled/restarted the container multiple times. Unless there is a different volume I don't know about.

@Ultragian commented on GitHub (Jan 27, 2024): Hey @ssddanbrown, as far as I understand, it is a primary run. I deleted all the files present in "/DATA/AppData/bookstack/" and reinstalled/restarted the container multiple times. Unless there is a different volume I don't know about.
Author
Owner

@ssddanbrown commented on GitHub (Jan 27, 2024):

as far as I understand, it is a primary run

You'd only see that reported error if there was pre-existing data in the database.
This indicates the database (bookstack_db) container has pre-existing data.
Take down the stack, then delete the existing containers, then remove all volume data, then re-up the stack.

Your volume for the mariadb container also looks wrong, as most linuxserver containers manage everything so you just mount to /config.

@ssddanbrown commented on GitHub (Jan 27, 2024): > as far as I understand, it is a primary run You'd only see that reported error if there was pre-existing data in the database. This indicates the database (`bookstack_db`) container has pre-existing data. Take down the stack, then delete the existing containers, then remove all volume data, then re-up the stack. Your volume for the mariadb container also looks wrong, as most linuxserver containers manage everything so you just mount to `/config`.
Author
Owner

@Ultragian commented on GitHub (Jan 28, 2024):

I managed to install it under a different system, there's probably a hidden volume somewhere. I changed the db volume to /config like u said, no changes on the first system.
Nevermind, ty anyway!

@Ultragian commented on GitHub (Jan 28, 2024): I managed to install it under a different system, there's probably a hidden volume somewhere. I changed the db volume to /config like u said, no changes on the first system. Nevermind, ty anyway!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4432