Docker compose (non-script install) error - Could not open database after 30 tries

I made the mistake of upgrading Debian 11 > 12 in place on a dedicated server before realizing there are no repos for 12. Which broke my packages and install.

So i Git cloned the main repo to give docker a shot and am running into an issue.

issue:
docker compose log:
bc-server | Aug 25 09:07:04 88e87883172e bc-server[31]: E(): Could not open database after 30 tries, aborting

what i see in the webui:
{“status”:“unavailable”,“msg”:[“Fatal error: could not connect to the database: “],“data”:””}

I saw in another post to use the Master - which i get the same results (even after nuking the volumes, images, containers, and rebooting the system)
post i am referring to: Docker Install issue: bc-server respawning over & over

OS details:
OS: Debian 11
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 8.0 7cd8c3640577 4 weeks ago 573MB
louislam/uptime-kuma latest e1ca7233c2fa 4 months ago 436MB
bluecherrydvr/bluecherry master 13b9bb9e6a27 4 months ago 927MB
juanluisbaptiste/postfix latest 7c3a06884ebd 2 years ago 50.9MB

Other than changing passwords the docker compose, .env, and .mail are same

compose logs

+] Running 4/0
 ✔ Container bc-mail      Created                                                                                                                                                        0.0s 
 ✔ Container uptime-kuma  Created                                                                                                                                                        0.0s 
 ✔ Container bc-mysql     Created                                                                                                                                                        0.0s 
 ✔ Container bc-server    Created                                                                                                                                                        0.0s 
Attaching to bc-mail, bc-mysql, bc-server, uptime-kuma
bc-mail      | Setting configuration option maillog_file with value: /dev/stdout
bc-mail      | Setting configuration option myhostname with value: hostnameofsmtpserver
bc-mail      | Setting configuration option mydomain with value: hostnameofsmtpserver.hostnameofsmtpserver
bc-mail      | Setting configuration option mydestination with value: localhost
bc-mail      | Setting configuration option myorigin with value: $mydomain
bc-mail      | Setting configuration option relayhost with value: [127.0.0.1]:25
bc-mail      | Setting configuration option smtp_use_tls with value: yes
uptime-kuma  | ==> Performing startup jobs and maintenance tasks
uptime-kuma  | ==> Starting application with user 0 group 0
bc-mail      | Setting configuration option smtp_sasl_auth_enable with value: yes
bc-mail      | Setting configuration option smtp_sasl_password_maps with value: lmdb:/etc/postfix/sasl_passwd
bc-mysql     | 2024-08-25 09:05:50-05:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.39-1.el9 started.
bc-mail      | Setting configuration option smtp_sasl_security_options with value: noanonymous
uptime-kuma  | Welcome to Uptime Kuma
bc-mail      | Setting configuration option always_add_missing_headers with value: yes
uptime-kuma  | Your Node.js version: 18.20.2
bc-mail      | Setting configuration option smtp_host_lookup with value: native,dns
bc-mail      | Setting configuration option inet_protocols with value: all
bc-mail      | Setting configuration option mynetworks with value: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
uptime-kuma  | 2024-08-25T14:05:50Z [SERVER] INFO: Welcome to Uptime Kuma
uptime-kuma  | 2024-08-25T14:05:50Z [SERVER] INFO: Node Env: production
uptime-kuma  | 2024-08-25T14:05:50Z [SERVER] INFO: Inside Container: true
uptime-kuma  | 2024-08-25T14:05:50Z [SERVER] INFO: Importing Node libraries
uptime-kuma  | 2024-08-25T14:05:50Z [SERVER] INFO: Importing 3rd-party libraries
bc-mysql     | 2024-08-25 09:05:50-05:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
bc-mysql     | 2024-08-25 09:05:50-05:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.39-1.el9 started.
bc-mysql     | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
bc-server    | > Update MySQL's my.cnf from environment variables passed in from docker
bc-server    | > Writing /root/.my.cnf
bc-server    | > Update bluecherry server's bluecherry.conf from environment variables passed in from docker
bc-server    | > Writing /etc/bluecherry.conf
bc-server    | > chown bluecherry:bluecherry /var/lib/bluecherry/recordings
bc-mysql     | 2024-08-25T14:05:51.660899Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
bc-mysql     | 2024-08-25T14:05:51.663247Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
bc-mysql     | 2024-08-25T14:05:51.663293Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.39) starting as process 1
bc-mysql     | 2024-08-25T14:05:51.700791Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
uptime-kuma  | 2024-08-25T14:05:52Z [SERVER] INFO: Creating express and socket.io instance
uptime-kuma  | 2024-08-25T14:05:52Z [SERVER] INFO: Server Type: HTTP
uptime-kuma  | 2024-08-25T14:05:52Z [SERVER] INFO: Importing this project modules
uptime-kuma  | 2024-08-25T14:05:52Z [NOTIFICATION] INFO: Prepare Notification Providers
uptime-kuma  | 2024-08-25T14:05:52Z [SERVER] INFO: Version: 1.23.13
uptime-kuma  | 2024-08-25T14:05:53Z [DB] INFO: Data Dir: ./data/
uptime-kuma  | 2024-08-25T14:05:53Z [SERVER] INFO: Connecting to the Database
uptime-kuma  | 2024-08-25T14:05:53Z [DB] INFO: SQLite config:
uptime-kuma  | [ { journal_mode: 'wal' } ]
uptime-kuma  | [ { cache_size: -12000 } ]
uptime-kuma  | 2024-08-25T14:05:53Z [DB] INFO: SQLite Version: 3.41.1
uptime-kuma  | 2024-08-25T14:05:53Z [SERVER] INFO: Connected
uptime-kuma  | 2024-08-25T14:05:53Z [DB] INFO: Your database version: 10
uptime-kuma  | 2024-08-25T14:05:53Z [DB] INFO: Latest database version: 10
uptime-kuma  | 2024-08-25T14:05:53Z [DB] INFO: Database patch not needed
uptime-kuma  | 2024-08-25T14:05:53Z [DB] INFO: Database Patch 2.0 Process
bc-mail      | Aug 25 09:05:53 hostnameofsmtpserver postfix/postfix-script[90]: starting the Postfix mail system
bc-mail      | Aug 25 09:05:53 hostnameofsmtpserver postfix/master[1]: daemon started -- version 3.6.6, configuration /etc/postfix
uptime-kuma  | 2024-08-25T14:05:53Z [SERVER] INFO: Load JWT secret from database.
uptime-kuma  | 2024-08-25T14:05:53Z [SERVER] INFO: No user, need setup
uptime-kuma  | 2024-08-25T14:05:53Z [SERVER] INFO: Adding route
uptime-kuma  | 2024-08-25T14:05:53Z [SERVER] INFO: Adding socket handler
uptime-kuma  | 2024-08-25T14:05:53Z [SERVER] INFO: Init the server
uptime-kuma  | 2024-08-25T14:05:53Z [SERVER] INFO: Listening on 3001
uptime-kuma  | 2024-08-25T14:05:53Z [SERVICES] INFO: Starting nscd
bc-mysql     | 2024-08-25T14:05:53.489968Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
bc-mysql     | 2024-08-25T14:05:55.302829Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
bc-mysql     | 2024-08-25T14:05:55.302941Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
bc-mysql     | 2024-08-25T14:05:55.328660Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
bc-mysql     | 2024-08-25T14:05:55.383962Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
bc-mysql     | 2024-08-25T14:05:55.384209Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.39'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
bc-server    | > /usr/sbin/rsyslogd
bc-server    | > /usr/sbin/nginx
bc-server    | > /usr/sbin/bc-server -u bluecherry -g bluecherry
bc-server    | Aug 25 09:05:57 88e87883172e bc-server[36]: I(): Status reports are served at /tmp/bluecherry_status
bc-server    | Aug 25 09:05:57 88e87883172e bc-server[36]: I(): Status reports are served at /tmp/bluecherry_trigger
bc-server    | Aug 25 09:05:57 88e87883172e bc-server[36]: I(): Started bc-server 3.1.1 (toolchain 9.4.0) v2.7.6-880-g0cc20a5a-dirty heads/master
bc-server    | Aug 25 09:05:57 88e87883172e bc-server[36]: I(): API server started listen to port: 7005
bc-server    | Aug 25 09:05:57 88e87883172e bc-server[36]: I(): HLS server started listen to port: 7003 (SSL=0)
bc-server    | Aug 25 09:06:26 88e87883172e bc-server[36]: E(): Could not open database after 30 tries, aborting
bc-server exited with code 0
bc-server    | > /usr/sbin/rsyslogd
bc-server    | > /usr/sbin/nginx
bc-server    | > /usr/sbin/bc-server -u bluecherry -g bluecherry
bc-server    | Aug 25 09:06:35 88e87883172e bc-server[31]: I(): Status reports are served at /tmp/bluecherry_status
bc-server    | Aug 25 09:06:35 88e87883172e bc-server[31]: I(): Status reports are served at /tmp/bluecherry_trigger
bc-server    | Aug 25 09:06:35 88e87883172e bc-server[31]: I(): Started bc-server 3.1.1 (toolchain 9.4.0) v2.7.6-880-g0cc20a5a-dirty heads/master
bc-server    | Aug 25 09:06:35 88e87883172e bc-server[31]: I(): API server started listen to port: 7005
bc-server    | Aug 25 09:06:35 88e87883172e bc-server[31]: I(): HLS server started listen to port: 7003 (SSL=0)
bc-server    | Aug 25 09:07:04 88e87883172e bc-server[31]: E(): Could not open database after 30 tries, aborting
bc-server exited with code 0
bc-server    | > /usr/sbin/rsyslogd
^CGracefully stopping... (press Ctrl+C again to force)

As always thanks for the amazing product, i think my 1yr support may have expired, or expiring soon.
I’ll see what i can do to continue to support you guys!
But im sure I’ll need my license key re-armed for the 4th time… SORRY!

Are you using the install script to configure docker and setup the services? ( https://install.bluecherrydvr.com/docker)?

i did not use the script.
i was hoping to just clone git and make any changes manually.

But after reading the install.sh on github and if i understand it correctly…
if i run the installer inside a dir i made: /var/lib/docker/compose/bluecherry-nvr/
it will make a bluecherry-docker folder inside the bluecherry-nvr working directory?
so after the install i would have /var/lib/docker/compose/bluecherry-nvr/bluecherry-docker/docker-compose.yml/etc

my concern was…
If i run the installer in /var/lib/docker/compose/ , would it override any existing docker directories that already exist (i doubt it)?
or will it simply create /var/lib/docker/compose/bluecherry-docker

I know it says not to use docker with prod, but im wondering how will it will play with an existing docker environment.

i do see the install.sh has a docker check built in. so im sure its fine.

install_docker() {

    if command -v docker > /dev/null 2>&1; then
        echo -e "\n\nDocker is installed....skipping!\n\n"
        return 0

If you can help validate the assumptions above are correct, I will run the script later today and report back
Obviously i’ll take a full backup and snapshot before any changes (which i wish i did when going from Debian 11 >12… lol!)

while not in scope of this t-shoot request, i am curious on the difference of running the installer vs cloning git and updating the .env and docker compose file would be.

Thanks again Curtis.

We released Debian 12 packages today. I always recommend packages over docker…docker is good for quick testing but there will also be licensing problems with docker during docker container upgrades (“fingerprints” change, etc).

docker fails when running the script as well.
i ultimately get the same error, but with a little more verbosity from the script.

script logs

root@apl-dmz-dock:/var/lib/docker/compose/bluecherry# bash -c "$(curl -s https://raw.githubusercontent.com/bluecherrydvr/bluecherry-docker/master/scripts/install.sh)"
Do you want to install docker and setup Bluecherry server? [y/n]: y


Docker is installed....skipping!




Installing Bluecherry.......


Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://security.debian.org/debian-security bullseye-security InRelease
Get:3 https://nvidia.github.io/libnvidia-container/stable/debian10/amd64  InRelease [1,484 B]
Hit:4 https://nvidia.github.io/nvidia-docker/debian10/amd64  InRelease     
Hit:5 http://deb.debian.org/debian bullseye-updates InRelease              
Hit:6 https://download.docker.com/linux/debian bullseye InRelease          
Fetched 1,484 B in 2s (962 B/s)                      
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
git is already the newest version (1:2.30.2-1+deb11u2).
The following packages were automatically installed and are no longer required:
  linux-headers-5.10.0-23-amd64 linux-headers-5.10.0-23-common linux-headers-5.10.0-25-amd64 linux-headers-5.10.0-25-common linux-headers-5.10.0-28-amd64 linux-headers-5.10.0-28-common
  linux-image-5.10.0-22-amd64 linux-image-5.10.0-23-amd64 linux-image-5.10.0-25-amd64 linux-image-5.10.0-28-amd64
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
Do you want to download and configure the Bluecherry docker images?  If this is the first run of the script then select 'y' [y/n]: y
Directory /var/lib/docker/compose/bluecherry/bluecherry-docker...proceeding with cloning
Cloning into 'bluecherry-docker'...
remote: Enumerating objects: 1733, done.
remote: Counting objects: 100% (1139/1139), done.
remote: Compressing objects: 100% (542/542), done.
remote: Total 1733 (delta 789), reused 825 (delta 517), pack-reused 594 (from 1)
Receiving objects: 100% (1733/1733), 2.11 MiB | 6.87 MiB/s, done.
Resolving deltas: 100% (930/930), done.


******************************************************************


You will be asked the following to configure the docker container:

Time Zone (formatted like this - See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
Create a password for the mysql admin
Create a password for the mysql bluecherry user

Time Zone (i.e. - America/Chicago): 
America/Chicago
Please provide a mysql admin password:pass
Please provide a mysql bluecherry password:pass
Downloading latest Bluecherry and related images...this may take a while...
WARN[0000] /var/lib/docker/compose/bluecherry/bluecherry-docker/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Pulling 4/4
 ✔ bluecherry Pulled                                                                                                                                                                     0.7s 
 ✔ mta_mailer Pulled                                                                                                                                                                     0.8s 
 ✔ uptime-kuma Pulled                                                                                                                                                                    0.9s 
 ✔ bc-mysql Pulled                                                                                                                                                                       0.8s 
WARN[0000] /var/lib/docker/compose/bluecherry/bluecherry-docker/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
WARN[0000] a network with name bluecherry_net exists but was not created for project "bluecherry-docker".
Set `external: true` to use an existing network 
WARN[0000] Found orphan containers ([bluecherry-docker-bluecherry-run-1900a70ceeb4]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. 
[+] Running 1/1
 ✔ Container bc-mysql  Started                                                                                                                                                           2.2s 
Sleeping 45 seconds to make sure the database is initialized correctly...
WARN[0000] /var/lib/docker/compose/bluecherry/bluecherry-docker/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Stopping 1/1
 ✔ Container bc-mysql  Stopped                                                                                                                                                          10.8s 
WARN[0000] /var/lib/docker/compose/bluecherry/bluecherry-docker/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
WARN[0000] a network with name bluecherry_net exists but was not created for project "bluecherry-docker".
Set `external: true` to use an existing network 
WARN[0000] Found orphan containers ([bluecherry-docker-bluecherry-run-1900a70ceeb4]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. 
[+] Running 1/1
 ✔ Container bc-mysql  Started                                                                                                                                                           0.7s 
Sleeping another 15 seconds to run the database creation scripts...



WARN[0000] /var/lib/docker/compose/bluecherry/bluecherry-docker/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
WARN[0000] a network with name bluecherry_net exists but was not created for project "bluecherry-docker".
Set `external: true` to use an existing network 
WARN[0000] Found orphan containers ([bluecherry-docker-bluecherry-run-1900a70ceeb4]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. 
[+] Creating 1/0
 ✔ Container bc-mysql  Running                                                                                                                                                           0.0s 
++ cat /etc/os-release
++ grep '^ID='
++ grep centos
+ [[ -n '' ]]
+ IN_DEB=1
+ MODE=new_db
+ case "$MODE" in
+ [[ 8 -lt 6 ]]
+ new_db root pass bluecherry bluecherry pass bc-mysql %
+ echo new_db root pass bluecherry bluecherry pass bc-mysql %
new_db root pass bluecherry bluecherry pass bc-mysql %
+ MYSQL_ADMIN_LOGIN=root
+ MYSQL_ADMIN_PASSWORD=pass
+ dbname=bluecherry
+ user=bluecherry
+ password=pass
+ host=bc-mysql
+ userhost=%
+ check_mysql_admin root pass
+ MYSQL_ADMIN_LOGIN=root
+ MYSQL_ADMIN_PASSWORD=pass
+ echo 'Testing MySQL admin credentials correctness...'
Testing MySQL admin credentials correctness...
+ echo 'show databases'
+ mysql_wrapper -hbc-mysql -uroot
+ echo -e '\n\n\tProvided MySQL admin credentials are incorrect\n'


	Provided MySQL admin credentials are incorrect

++ whoami
+ echo -e 'Please create ~root/.my.cnf with right password like this\n'
Please create ~root/.my.cnf with right password like this

+ echo '[client]'
[client]
+ echo user=root
user=root
+ echo -e 'password="pass"\n'
password="pass"

+ echo '[mysql]'
[mysql]
+ echo user=root
user=root
+ echo -e 'password="pass"\n'
password="pass"

+ echo '[mysqldump]'
[mysqldump]
+ echo user=root
user=root
+ echo -e 'password="pass"\n'
password="pass"

+ echo '[mysqldiff]'
[mysqldiff]
+ echo user=root
user=root
+ echo 'password="pass"'
password="pass"
+ exit 1
root@apl-dmz-dock:/var/lib/docker/compose/bluecherry# 

when i try to docker compose up after the failure, i get the same error as without the script:

bc-server    | Aug 28 20:26:06 448b95d35703 bc-server[31]: E(): Could not open database after 30 tries, aborting
bc-server exited with code 0

i did remove all containers, volumes, images, and network before running the installer after this and got the same results.

Can you try the Debian 12 packages?

sudo bash -c "$(curl -fsSL  https://install.bluecherrydvr.com/packages)"

I can hopefully try tonight (cst) and report back as I need to build a new VM since I nuked the original nvr server on Saturday

sudo bash -c "$(curl -fsSL  https://install.bluecherrydvr.com/packages)"

worked without any issues on a dedicated debian 12 vm inside proxmox.

only remaining tasks that i can remember:

  • while my localtime and timezones are correct. sql is not. i forget how i resolved that last time
  • my license needs another re-arm (i can send you another PM if needed)

I did try to change the default admin password but am greeted with an empty page (https://LOCAL-IP:7001/ajax/update.php) - same when making a new user

not sure if thats simply because its not licensed. but i thought it weird to not be able to change the default admin password.

You can reset your license key here:

https://help.bluecherrydvr.com/en/articles/8568656-reset-bluecherry-licenses

managing the licensing worked beautifully!

root@apl-dmz-nvr:/home/apl-dmz-nvr# cat /etc/timezone 
US/Central

MariaDB [bluecherry]> SHOW GLOBAL VARIABLES LIKE 'time_zone';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| time_zone     | -06:00 |
+---------------+--------+
1 row in set (0.001 sec)

tried creating users on another computer/different browser but am still unable to create users.

is this still relevant for Debian 12 but use php8.2 ?

really struggling over here after the new install/script.

You are posting in a docker thread…are you using docker or not?

I am not using docker. I suppose I could/should have created a new post and can do so if you wish.

My apologies