Backup and Restore failed with php artisan migrate #5505

Closed
opened 2026-02-05 10:07:30 +03:00 by OVERLORD · 9 comments
Owner

Originally created by @unknownFalleN on GitHub (Nov 18, 2025).

Describe the Bug

I want to backup and restore my old bookstack lxc in a new lxc in my proxmox env.

The step "create_entities_table" failed in connection.php line 824 and line 570 (details see screenshot).

Using the Script https://community-scripts.github.io/ProxmoxVE/scripts?id=bookstack to install and comment out the "php artisan migrate"

Steps to Reproduce

Like https://www.bookstackapp.com/docs/admin/backup-restore/

  1. mysqldump -u bookstack -p bookstack > 2025-10-11_bookstack_db
  2. tar -czvf bookstack-files-backup.tar.gz .env public/uploads storage/uploads themes
  3. Move backup to new lxc
  4. mysql -u bookstack -p bookstack < 2025-10-11_bookstack_db.sql
  5. tar -xvzf bookstack-files-backup.tar.gz
  6. php artisan migrate

Expected Behaviour

Restore all Book, Chapter, etc.

Screenshots or Additional Context

Image

Browser Details

No response

Exact BookStack Version

v25.11

Originally created by @unknownFalleN on GitHub (Nov 18, 2025). ### Describe the Bug I want to backup and restore my old bookstack lxc in a new lxc in my proxmox env. The step "create_entities_table" failed in connection.php line 824 and line 570 (details see screenshot). Using the Script https://community-scripts.github.io/ProxmoxVE/scripts?id=bookstack to install and comment out the "php artisan migrate" ### Steps to Reproduce Like https://www.bookstackapp.com/docs/admin/backup-restore/ 1. mysqldump -u bookstack -p bookstack > 2025-10-11_bookstack_db 2. tar -czvf bookstack-files-backup.tar.gz .env public/uploads storage/uploads themes 3. Move backup to new lxc 4. mysql -u bookstack -p bookstack < 2025-10-11_bookstack_db.sql 5. tar -xvzf bookstack-files-backup.tar.gz 6. php artisan migrate ### Expected Behaviour Restore all Book, Chapter, etc. ### Screenshots or Additional Context <img width="2028" height="463" alt="Image" src="https://github.com/user-attachments/assets/4c11e4d5-1a59-42b0-8651-ef6508477871" /> ### Browser Details _No response_ ### Exact BookStack Version v25.11
OVERLORD added the 🐕 Support label 2026-02-05 10:07:30 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Nov 18, 2025):

Hi @unknownFalleN,

That error is commonly a sign that you are not restoring into an empty database.
Either that, or the database you are originally backed-up is in a questionable state.

  • If you access the original instance database (mysql -u bookstack -p bookstack) and check the tables show tables; do you see the entities table in the output?
  • Had you attempted upgrade to v25.11 at all on the old instance?
@ssddanbrown commented on GitHub (Nov 18, 2025): Hi @unknownFalleN, That error is commonly a sign that you are not restoring into an empty database. Either that, or the database you are originally backed-up is in a questionable state. - If you access the original instance database (`mysql -u bookstack -p bookstack`) and check the tables `show tables;` do you see the `entities` table in the output? - Had you attempted upgrade to v25.11 at all on the old instance?
Author
Owner

@unknownFalleN commented on GitHub (Nov 18, 2025):

Hi @ssddanbrown,

thanks for the reply.

  • I have check the db. The entities table is there, but empty.
  • I had problems with the updater on the old instance. That's why I wanted to install a new one and restore the backup.

I have used the script to install the new instance and comment out the php artisan migrate --force

#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (Canbiz)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/BookStackApp/BookStack

APP="Bookstack"
var_tags="${var_tags:-organizer}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-1024}"
var_disk="${var_disk:-4}"
var_os="${var_os:-debian}"
var_version="${var_version:-12}"
var_unprivileged="${var_unprivileged:-1}"

header_info "$APP"
variables
color
catch_errors

function update_script() {
  header_info
  check_container_storage
  check_container_resources

  if [[ ! -d /opt/bookstack ]]; then
    msg_error "No ${APP} Installation Found!"
    exit
  fi
  if check_for_gh_release "bookstack" "BookStackApp/BookStack"; then
    msg_info "Stopping Apache2"
    systemctl stop apache2
    msg_ok "Services Stopped"

    msg_info "Backing up data"
    mv /opt/bookstack /opt/bookstack-backup
    msg_ok "Backup finished"

    fetch_and_deploy_gh_release "bookstack" "BookStackApp/BookStack"
    PHP_MODULE="ldap,tidy,bz2,mysqli" PHP_FPM="YES" PHP_APACHE="YES" PHP_VERSION="8.3" setup_php
    setup_composer

    msg_info "Restoring backup"
    cp /opt/bookstack-backup/.env /opt/bookstack/.env
    [[ -d /opt/bookstack-backup/public/uploads ]] && cp -a /opt/bookstack-backup/public/uploads/. /opt/bookstack/public/uploads/
    [[ -d /opt/bookstack-backup/storage/uploads ]] && cp -a /opt/bookstack-backup/storage/uploads/. /opt/bookstack/storage/uploads/
    [[ -d /opt/bookstack-backup/themes ]] && cp -a /opt/bookstack-backup/themes/. /opt/bookstack/themes/
    msg_ok "Backup restored"

    msg_info "Configuring BookStack"
    cd /opt/bookstack
    export COMPOSER_ALLOW_SUPERUSER=1
    $STD composer install --no-dev
    #$STD php artisan migrate --force
    chown www-data:www-data -R /opt/bookstack /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads /opt/bookstack/storage
    chmod -R 755 /opt/bookstack /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads /opt/bookstack/storage
    chmod -R 775 /opt/bookstack/storage /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads
    chmod -R 640 /opt/bookstack/.env
    msg_ok "Configured BookStack"

    msg_info "Starting Apache2"
    systemctl start apache2
    msg_ok "Started Apache2"

    msg_info "Cleaning Up"
    rm -rf /opt/bookstack-backup
    msg_ok "Cleaned"
    msg_ok "Updated successfully!"
  fi
  exit
}
start
build_container
description

msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"

I have already tried to delete the empty tables

drop table entities;
drop table entity_container_data;
drop table entity_page_data;
drop table entity_permissions;

Unfortunately, this does not work.

@unknownFalleN commented on GitHub (Nov 18, 2025): Hi @ssddanbrown, thanks for the reply. - I have check the db. The `entities` table is there, but empty. - I had problems with the updater on the old instance. That's why I wanted to install a new one and restore the backup. I have used the script to install the new instance and comment out the `php artisan migrate --force` ```bash #!/usr/bin/env bash source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: MickLesk (Canbiz) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://github.com/BookStackApp/BookStack APP="Bookstack" var_tags="${var_tags:-organizer}" var_cpu="${var_cpu:-1}" var_ram="${var_ram:-1024}" var_disk="${var_disk:-4}" var_os="${var_os:-debian}" var_version="${var_version:-12}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" variables color catch_errors function update_script() { header_info check_container_storage check_container_resources if [[ ! -d /opt/bookstack ]]; then msg_error "No ${APP} Installation Found!" exit fi if check_for_gh_release "bookstack" "BookStackApp/BookStack"; then msg_info "Stopping Apache2" systemctl stop apache2 msg_ok "Services Stopped" msg_info "Backing up data" mv /opt/bookstack /opt/bookstack-backup msg_ok "Backup finished" fetch_and_deploy_gh_release "bookstack" "BookStackApp/BookStack" PHP_MODULE="ldap,tidy,bz2,mysqli" PHP_FPM="YES" PHP_APACHE="YES" PHP_VERSION="8.3" setup_php setup_composer msg_info "Restoring backup" cp /opt/bookstack-backup/.env /opt/bookstack/.env [[ -d /opt/bookstack-backup/public/uploads ]] && cp -a /opt/bookstack-backup/public/uploads/. /opt/bookstack/public/uploads/ [[ -d /opt/bookstack-backup/storage/uploads ]] && cp -a /opt/bookstack-backup/storage/uploads/. /opt/bookstack/storage/uploads/ [[ -d /opt/bookstack-backup/themes ]] && cp -a /opt/bookstack-backup/themes/. /opt/bookstack/themes/ msg_ok "Backup restored" msg_info "Configuring BookStack" cd /opt/bookstack export COMPOSER_ALLOW_SUPERUSER=1 $STD composer install --no-dev #$STD php artisan migrate --force chown www-data:www-data -R /opt/bookstack /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads /opt/bookstack/storage chmod -R 755 /opt/bookstack /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads /opt/bookstack/storage chmod -R 775 /opt/bookstack/storage /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads chmod -R 640 /opt/bookstack/.env msg_ok "Configured BookStack" msg_info "Starting Apache2" systemctl start apache2 msg_ok "Started Apache2" msg_info "Cleaning Up" rm -rf /opt/bookstack-backup msg_ok "Cleaned" msg_ok "Updated successfully!" fi exit } start build_container description msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}" ``` I have already tried to delete the empty tables ``` drop table entities; drop table entity_container_data; drop table entity_page_data; drop table entity_permissions; ``` Unfortunately, this does not work.
Author
Owner

@ssddanbrown commented on GitHub (Nov 18, 2025):

Okay, so it sounds like you are restoring from a messy/error state to begin with, leading to the issues experienced.

Without knowing what the issue was before, it may make things a little tricky to predict what's going on.
Please ensure you retain safe copies of the old system backups before attempting much else.

I have already tried to delete the empty tables

At what point in the process are you attempting this?

@ssddanbrown commented on GitHub (Nov 18, 2025): Okay, so it sounds like you are restoring from a messy/error state to begin with, leading to the issues experienced. Without knowing what the issue was before, it may make things a little tricky to predict what's going on. Please ensure you retain safe copies of the old system backups before attempting much else. > I have already tried to delete the empty tables At what point in the process are you attempting this?
Author
Owner

@unknownFalleN commented on GitHub (Nov 19, 2025):

I managed to start a working version of BookStack v25.07.3 in Docker Compose locally and was able to restore the backup :)

Is there an easy way to update the containers to the latest version, then create a backup and insert it into the LXE server?

I accidentally closed the issue...

@unknownFalleN commented on GitHub (Nov 19, 2025): I managed to start a working version of BookStack v25.07.3 in Docker Compose locally and was able to restore the backup :) Is there an easy way to update the containers to the latest version, then create a backup and insert it into the LXE server? I accidentally closed the issue...
Author
Owner

@ssddanbrown commented on GitHub (Nov 19, 2025):

Is there an easy way to update the containers to the latest version, then create a backup and insert it into the LXE server?

I'm not too sure, since you are using the proxmoxve community script, which is not under my management and (from when I last looked into it) did things a little funky relative to most installs.

@ssddanbrown commented on GitHub (Nov 19, 2025): > Is there an easy way to update the containers to the latest version, then create a backup and insert it into the LXE server? I'm not too sure, since you are using the proxmoxve community script, which is not under my management and (from when I last looked into it) did things a little funky relative to most installs.
Author
Owner

@unknownFalleN commented on GitHub (Nov 19, 2025):

I'm not too sure, since you are using the proxmoxve community script, which is not under my management and (from when I last looked into it) did things a little funky relative to most installs.

I currently have Docker Compose running directly from the bookstack releases. I would like to perform the update and then make another backup. I would import this backup into LXC.

@unknownFalleN commented on GitHub (Nov 19, 2025): > I'm not too sure, since you are using the proxmoxve community script, which is not under my management and (from when I last looked into it) did things a little funky relative to most installs. I currently have Docker Compose running directly from the bookstack releases. I would like to perform the update and then make another backup. I would import this backup into LXC.
Author
Owner

@ssddanbrown commented on GitHub (Nov 19, 2025):

By LXC, do you specifically mean the proxmoxve community script version of Bookstack?
Also, what docker image are you currently using?

@ssddanbrown commented on GitHub (Nov 19, 2025): By LXC, do you specifically mean the proxmoxve community script version of Bookstack? Also, what docker image are you currently using?
Author
Owner

@unknownFalleN commented on GitHub (Nov 20, 2025):

I have downloaded the v25.07.3.tar.gz. Modified the entrypoint.app.sh that php artisan migrate --database=mysql --force comment out and started the docker compose docker compose up -d. Modified the entrypoint.app.sh that php artisan migrate --database=mysql --force comment out and restore my bookstack backup. So far, everything is going great.

Now I want to upgrade bookstack in Docker. After everything is running I will install Bookstack in a LXC with the official install guide.

@unknownFalleN commented on GitHub (Nov 20, 2025): I have downloaded the [v25.07.3.tar.gz](https://github.com/BookStackApp/BookStack/archive/refs/tags/v25.07.3.tar.gz). Modified the `entrypoint.app.sh` that `php artisan migrate --database=mysql --force` comment out and started the docker compose `docker compose up -d`. Modified the `entrypoint.app.sh` that `php artisan migrate --database=mysql --force` comment out and restore my bookstack backup. So far, everything is going great. Now I want to upgrade bookstack in Docker. After everything is running I will install Bookstack in a LXC with the official install guide.
Author
Owner

@ssddanbrown commented on GitHub (Nov 21, 2025):

@unknownFalleN Okay, then everything sounds standard enough to follow our general backup and restore guidance.

There's also the system CLI which provides backup and restore via much more automated means, but is a bit more experimental:
https://www.bookstackapp.com/docs/admin/system-cli/

Either way, just keep good backups/snapshots of the old system around until you're confident the new system is working okay.

@ssddanbrown commented on GitHub (Nov 21, 2025): @unknownFalleN Okay, then everything sounds standard enough to follow our general [backup and restore guidance](https://www.bookstackapp.com/docs/admin/backup-restore/). There's also the system CLI which provides backup and restore via much more automated means, but is a bit more experimental: https://www.bookstackapp.com/docs/admin/system-cli/ Either way, just keep good backups/snapshots of the old system around until you're confident the new system is working okay.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5505