linuxserver / docker-bookstack

A Docker container for the BookStack documentation wiki
GNU General Public License v3.0
725 stars 105 forks source link

[BUG] Error at container setup while chown-ing laravel.log #194

Closed trevordavidlawrence closed 7 months ago

trevordavidlawrence commented 8 months ago

Is there an existing issue for this?

Current Behavior

At startup, an error is shown in the container logs:

chown: cannot dereference '/app/www/storage/logs/laravel.log': No such file or directory

And no logs from Laravel seem to be recorded.

Expected Behavior

No errors at container startup and Laravel log data is persisted.

Steps To Reproduce

  1. Run attached Docker Compose setup
  2. docker compose logs bookstack

If I use a bind mount instead and put an empty file at www/laravel.log within the mounted directory, then the error goes away.

I suspect the code that is chown-ing files symlinked into the /config directory is choking on the fact that laravel.log does not yet exist there.

Environment

- OS: Ubuntu 20.04 within WSL2 on Windows 10
- How docker service was installed: distro's package manager (_NOT_ Docker Desktop for Windows)

CPU architecture

x86-64

Docker creation

Using this docker-compose.yaml:

---
version: "3.9"
services:
  bookstack:
    image: lscr.io/linuxserver/bookstack
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - APP_URL=http://localhost:6875
      - DB_HOST=bookstack_db
      - DB_PORT=3306
      - DB_USER=bookstack
      - DB_PASS=password
      - DB_DATABASE=bookstackapp
    volumes:
      - bookstack_app_data:/config
    ports:
      - 6875:80
    restart: unless-stopped
    depends_on:
      - bookstack_db
  bookstack_db:
    image: lscr.io/linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=password
      - TZ=America/Chicago
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=password
    volumes:
      - bookstack_db_data:/config
    restart: unless-stopped
volumes:
  bookstack_app_data:
  bookstack_db_data:

Container logs

[migrations] started
[migrations] 01-nginx-site-confs-default: executing...
[migrations] 01-nginx-site-confs-default: succeeded
[migrations] 02-default-location: executing...
grep: /config/nginx/site-confs/default.conf: No such file or directory
[migrations] 02-default-location: succeeded
[migrations] done
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1000
User GID:    1000
───────────────────────────────────────

Setting resolver to  127.0.0.11
Setting worker_processes to 8
generating self-signed keys in /config/keys, you can replace these with your own keys if required
........+++++++++++++++++++++++++++++++++++++++*..+.+.....+...+++++++++++++++++++++++++++++++++++++++*..........+...+....+........+......+....+...+.........+..............+.........+.++++++
..+++++++++++++++++++++++++++++++++++++++*.....+...........+...+....+..+.+...+.........+...........+....+...+++++++++++++++++++++++++++++++++++++++*.....+..........+.....+.+...+.....+..........+......+.....+....+..+...................+...+..+...+............+.+........+....+...............+..+....+.........+..+......+....+...+...........+.........+...............+.+...........+....+..+....+......+.........+...+........+...+.......+...+..+............+.......+...+...+..+......+......+...+.............+............+...+..+......+...............+.......+.........+........+...+.............+..+....+........+.+......+.....+...+.+..+..........+.....+....+......+...+..+............+...+....+.....+....+.........+.....+...+...+....+.................+..........+........+..........++++++
-----
Generating BookStack app key for first run
App Key set to base64:V47ZKiXc5XA33834gq7PbdDnKSEkn1f71VsabtMNqcI= you can modify the file to update /config/BOOKSTACK_APP_KEY.txt
Running config - DB_HOST set
**** Insert DB_PORT='3306' into /config/www/.env ****
**** APP_URL in /config/www/.env is being updated from https://example.com to http://localhost:6875 ****
**** If this is an existing install, you should run the following line from your host terminal to update the database URL entries: ****
************************************************************************
docker exec -it bookstack php /app/www/artisan bookstack:update-url https://example.com http://localhost:6875
************************************************************************
Waiting for DB to be available

   INFO  Preparing database.

  Creating migration table ......................................... 15ms DONE

   INFO  Running migrations.

  2014_10_12_000000_create_users_table ............................. 78ms DONE
  2014_10_12_100000_create_password_resets_table ................... 32ms DONE
  2015_07_12_114933_create_books_table .............................. 8ms DONE
  2015_07_12_190027_create_pages_table .............................. 8ms DONE
  2015_07_13_172121_create_images_table ............................. 7ms DONE
  2015_07_27_172342_create_chapters_table ........................... 7ms DONE
  2015_08_08_200447_add_users_to_entities .......................... 34ms DONE
  2015_08_09_093534_create_page_revisions_table ..................... 7ms DONE
  2015_08_16_142133_create_activities_table ......................... 7ms DONE
  2015_08_29_105422_add_roles_and_permissions ..................... 309ms DONE
  2015_08_30_125859_create_settings_table .......................... 19ms DONE
  2015_08_31_175240_add_search_indexes .............................. 0ms DONE
  2015_09_04_165821_create_social_accounts_table ................... 30ms DONE
  2015_09_05_164707_add_email_confirmation_table ................... 36ms DONE
  2015_11_21_145609_create_views_table .............................. 6ms DONE
  2015_11_26_221857_add_entity_indexes ............................ 230ms DONE
  2015_12_05_145049_fulltext_weighting .............................. 0ms DONE
  2015_12_07_195238_add_image_upload_types ......................... 26ms DONE
  2015_12_09_195748_add_user_avatars ................................ 8ms DONE
  2016_01_11_210908_add_external_auth_to_users ..................... 21ms DONE
  2016_02_25_184030_add_slug_to_revisions .......................... 33ms DONE
  2016_02_27_120329_update_permissions_and_roles ................... 85ms DONE
  2016_02_28_084200_add_entity_access_controls .................... 117ms DONE
  2016_03_09_203143_add_page_revision_types ........................ 21ms DONE
  2016_03_13_082138_add_page_drafts ................................ 20ms DONE
  2016_03_25_123157_add_markdown_support ........................... 18ms DONE
  2016_04_09_100730_add_view_permissions_to_roles .................. 22ms DONE
  2016_04_20_192649_create_joint_permissions_table ................ 137ms DONE
  2016_05_06_185215_create_tags_table .............................. 54ms DONE
  2016_07_07_181521_add_summary_to_page_revisions ................... 9ms DONE
  2016_09_29_101449_remove_hidden_roles ............................ 32ms DONE
  2016_10_09_142037_create_attachments_table ....................... 34ms DONE
  2017_01_21_163556_create_cache_table ............................. 19ms DONE
  2017_01_21_163602_create_sessions_table .......................... 20ms DONE
  2017_03_19_091553_create_search_index_table ...................... 79ms DONE
  2017_04_20_185112_add_revision_counts ............................ 29ms DONE
  2017_07_02_152834_update_db_encoding_to_ut8mb4 .................... 0ms DONE
  2017_08_01_130541_create_comments_table .......................... 42ms DONE
  2017_08_29_102650_add_cover_image_display ......................... 9ms DONE
  2018_07_15_173514_add_role_external_auth_id ...................... 25ms DONE
  2018_08_04_115700_create_bookshelves_table ...................... 196ms DONE
  2019_07_07_112515_add_template_support ........................... 23ms DONE
  2019_08_17_140214_add_user_invites_table ......................... 28ms DONE
  2019_12_29_120917_add_api_auth ................................... 42ms DONE
  2020_08_04_111754_drop_joint_permissions_id ...................... 50ms DONE
  2020_08_04_131052_remove_role_name_field .......................... 8ms DONE
  2020_09_19_094251_add_activity_indexes ........................... 23ms DONE
  2020_09_27_210059_add_entity_soft_deletes ........................ 38ms DONE
  2020_09_27_210528_create_deletions_table ......................... 42ms DONE
  2020_11_07_232321_simplify_activities_table ...................... 76ms DONE
  2020_12_30_173528_add_owned_by_field_to_entities ................ 100ms DONE
  2021_01_30_225441_add_settings_type_column ....................... 12ms DONE
  2021_03_08_215138_add_user_slug .................................. 24ms DONE
  2021_05_15_173110_create_favourites_table ........................ 27ms DONE
  2021_06_30_173111_create_mfa_values_table ........................ 30ms DONE
  2021_07_03_085038_add_mfa_enforced_to_roles_table ................. 8ms DONE
  2021_08_28_161743_add_export_role_permission ...................... 4ms DONE
  2021_09_26_044614_add_activities_ip_column ....................... 10ms DONE
  2021_11_26_070438_add_index_for_user_ip ........................... 9ms DONE
  2021_12_07_111343_create_webhooks_table .......................... 55ms DONE
  2021_12_13_152024_create_jobs_table .............................. 18ms DONE
  2021_12_13_152120_create_failed_jobs_table ....................... 18ms DONE
  2022_01_03_154041_add_webhooks_timeout_error_columns .............. 8ms DONE
  2022_04_17_101741_add_editor_change_field_and_permission ......... 11ms DONE
  2022_04_25_140741_update_polymorphic_types ....................... 10ms DONE
  2022_07_16_170051_drop_joint_permission_type ..................... 61ms DONE
  2022_08_17_092941_create_references_table ........................ 58ms DONE
  2022_09_02_082910_fix_shelf_cover_image_types ..................... 0ms DONE
  2022_10_07_091406_flatten_entity_permissions_table ............... 46ms DONE
  2022_10_08_104202_drop_entity_restricted_field ................... 46ms DONE
  2023_01_24_104625_refactor_joint_permissions_storage ............. 77ms DONE
  2023_01_28_141230_copy_color_settings_for_dark_mode ............... 1ms DONE
  2023_02_20_093655_increase_attachments_path_length ............... 21ms DONE
  2023_02_23_200227_add_updated_at_index_to_pages .................. 12ms DONE
  2023_06_10_071823_remove_guest_user_secondary_roles ............... 1ms DONE
  2023_06_25_181952_remove_bookshelf_create_entity_permissions ...... 0ms DONE
  2023_07_25_124945_add_receive_notifications_role_permissions ...... 3ms DONE
  2023_07_31_104430_create_watches_table ........................... 38ms DONE
  2023_08_21_174248_increase_cache_size ............................ 22ms DONE

chown: cannot dereference '/app/www/storage/logs/laravel.log': No such file or directory
**** Permissions could not be set. This is probably because your volume mounts are remote or read-only. ****
**** The app may not work properly and we will not provide support for it. ****
[custom-init] No custom files found, skipping...
[ls.io-init] done.
github-actions[bot] commented 8 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

j0nnymoe commented 8 months ago

I suspect this is due to using WSL2, there known problems with this as you can see here: https://github.com/linuxserver/docker-bookstack/issues/125

trevordavidlawrence commented 8 months ago

I suspect this is due to using WSL2, there known problems with this as you can see here: #125

That's what I had thought for a while, but I've also been able to reproduce this on a non-WSL Ubuntu VM. There, as before, if I pre-create that file (www/laravel.log) in a bind mount the error does not occur.

dimo414 commented 8 months ago

I'm encountering this error as well on a GCS Debian instance with a fresh Bookstack install:

bookstack    | chown: cannot dereference '/app/www/storage/logs/laravel.log': No such file or directory
bookstack    | **** Permissions could not be set. This is probably because your volume mounts are remote or read-only. ****
bookstack    | **** The app may not work properly and we will not provide support for it. ****

So I don't think it's limited to WSL.

thibmart1 commented 7 months ago

Same here on Debian 11.11 (OMV):

chown: cannot dereference '/app/www/storage/logs/laravel.log': No such file or directory
**** Permissions could not be set. This is probably because your volume mounts are remote or read-only. ****
**** The app may not work properly and we will not provide support for it. ****

EDIT: Got around the issue by manually creating the laravel.log file:

cd /your/bind/bookstack/volume/www
touch laravel.log   # this must be run with the user running the container as per the "PUID/GUID" options of LSIO

Then restart the container and your OK to go.

thespad commented 7 months ago

This is usually caused by issues with the filesystem backing the docker container layers; are you running anything like ZFS/btrfs/mergerfs/etc?

thibmart1 commented 7 months ago

This is usually caused by issues with the filesystem backing the docker container layers; are you running anything like ZFS/btrfs/mergerfs/etc?

mergerfs yes (only the data volumes, Docker engine is on a basic ext4). Do you know how to solve this permanently?

thespad commented 7 months ago

If it's just your mounted volumes it shouldn't be causing a problem with init, it's only if the docker filesystem (typically /var/lib/docker) is on a different filesystem.

I can replicate this on a clean install, so I expect it's an upstream change (probably a Laravel bump) that's caused it. I'll have a look this afternoon.

thespad commented 7 months ago

Can people test lspipepr/bookstack:v23.10.4-pkg-14e04100-dev-78d685a31f47de8708c037d76c89e4cf7856c734-pr-196 and see if it resolves their issues please.

GoldenTeacher25 commented 7 months ago

Can people test lspipepr/bookstack:v23.10.4-pkg-14e04100-dev-78d685a31f47de8708c037d76c89e4cf7856c734-pr-196 and see if it resolves their issues please.

I had the same issue yesterday. I can confirm that this image works as intended.