Failed to start MariaDB 10.5.21 database server

I’m following the manual Migrate from non-docker Seafile deployment to docker. But when I get to the end and try to activate the changes, I have the following problem:

/opt/seafile-data# service networking reload
Reloading network interfaces configuration...done.
/opt/seafile-data# ip a
...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether dc:a6:32:6a:02:80 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.15/24 brd 192.168.0.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 2a02:8070:2485:9060:e7c5:35c0:4f43:9c88/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 6828sec preferred_lft 3228sec
    inet6 fe80::192b:3cb9:aa15:6cb/64 scope link 
       valid_lft forever preferred_lft forever
...
/opt/seafile-data# service mysql restart
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
/opt/seafile-data# systemctl status mariadb.service
● mariadb.service - MariaDB 10.5.21 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2024-02-03 23:14:13 CET; 15s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 21045 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 21046 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 21048 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/gal>
    Process: 21095 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, statu>
   Main PID: 21095 (code=exited, status=1/FAILURE)
     Status: "MariaDB server is down"
        CPU: 489ms

Feb 03 23:14:13 raspberrypi mariadbd[21095]: 2024-02-03 23:14:13 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Ph>
Feb 03 23:14:13 raspberrypi mariadbd[21095]: 2024-02-03 23:14:13 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
Feb 03 23:14:13 raspberrypi mariadbd[21095]: 2024-02-03 23:14:13 0 [Note] InnoDB: 10.5.21 started; log sequence number 5390>
Feb 03 23:14:13 raspberrypi mariadbd[21095]: 2024-02-03 23:14:13 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysq>
Feb 03 23:14:13 raspberrypi mariadbd[21095]: 2024-02-03 23:14:13 0 [Note] Plugin 'FEEDBACK' is disabled.
Feb 03 23:14:13 raspberrypi mariadbd[21095]: 2024-02-03 23:14:13 0 [ERROR] Can't create IP socket: Name or service not known
Feb 03 23:14:13 raspberrypi mariadbd[21095]: 2024-02-03 23:14:13 0 [ERROR] Aborting
Feb 03 23:14:13 raspberrypi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Feb 03 23:14:13 raspberrypi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Feb 03 23:14:13 raspberrypi systemd[1]: Failed to start MariaDB 10.5.21 database server.

Can anyone help me?

I’ve modified the binding address of the MariaDB server in /etc/mysql/mariadb.conf.d/50-server.cnf as follows:
bind-address = 0.0.0.0

Now service mysql restart runs without problems.

I have also created the user seafile again:

groupadd --gid 8000 seafile
useradd --home-dir /home/seafile --create-home --uid 8000 --gid 8000 --shell /bin/sh --skel /dev/null seafile

Now I get the following errors in docker:

*** Running /etc/my_init.d/01_create_data_links.sh...
*** Booting runit daemon...
*** Runit started as PID 22
*** Running /scripts/enterpoint.sh...
2024-02-04 21:45:47 Nginx ready 
2024-02-04 21:45:47 Create linux user seafile, please wait. 
2024-02-04 21:48:03 This is an idle script (infinite loop) to keep container running. 
[2024-02-04 21:48:04] Skip running setup-seafile-mysql.py because there is existing seafile-data folder.
[02/04/2024 21:48:04][upgrade]: The container was recreated, start fix the media symlinks
[02/04/2024 21:48:04][upgrade]: Done
Starting seafile server, please wait ...
** (process:103): WARNING **: 21:48:15.837: seafile-controller.c(558): invalid config_dir: /opt/seafile/ccnet
** (process:103): WARNING **: 21:48:15.838: seafile-controller.c(64): seaf-controller exited with code 1
Failed to start seafile server
Traceback (most recent call last):
  File "/scripts/start.py", line 95, in <module>
    main()
  File "/scripts/start.py", line 77, in main
    call('su seafile -c "{} start"'.format(get_script('seafile.sh')))
  File "/scripts/utils.py", line 70, in call
    return subprocess.check_call(*a, **kw)
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'su seafile -c "/opt/seafile/seafile-server-11.0.5/seafile.sh start"' returned non-zero exit status 1.

I wonder why seafile-controller.c is searching for /opt/seafile/ccnet.
Can anyone help me?

After manually adding the folder /opt/seafile-data/seafile/ccnet and restarting the seafile container, the seafile server could be startet:

*** Booting runit daemon...
*** Runit started as PID 22
*** Running /scripts/enterpoint.sh...
2024-02-05 19:52:47 Nginx ready 
2024-02-05 19:52:47 Create linux user seafile, please wait. 
groupadd: group 'seafile' already exists
useradd: user 'seafile' already exists
2024-02-05 19:53:00 This is an idle script (infinite loop) to keep container running. 
[2024-02-05 19:53:00] Skip running setup-seafile-mysql.py because there is existing seafile-data folder.
Starting seafile server, please wait ...
Seafile server started
Done.
Starting seahub at port 8000 ...
Seahub is started
Done.

But unfortunately I still can’t connect to the server. My docker-compose.yml looks as follows:

# cat docker-compose.yml 
version: '2.0'
services:
  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    ports:
      - "8888:80"
      - "8443:443"  # If https is enabled, cancel the comment.
    volumes:
      - /opt/seafile-data:/shared   # Requested, specifies the path to Seafile data persistent store.
      - /media/nas/seafile:/shared/seafile/seafile-data
    environment:
      - DB_HOST=192.168.0.15
      - DB_ROOT_PASSWD=secret  # Requested, the value shuold be root's password of MySQL service.
      - TIME_ZONE=Etc/UTC  # Optional, default is UTC. Should be uncomment and set to your local time zone.
      - SEAFILE_ADMIN_EMAIL=seafile@raspberry.pi # Specifies Seafile admin user, default is 'me@example.com'.
      - SEAFILE_ADMIN_PASSWORD=secret     # Specifies Seafile admin password, default is 'asecret'.
      - SEAFILE_SERVER_LETSENCRYPT=false   # Whether to use https or not.
      - SEAFILE_SERVER_HOSTNAME=192.168.0.15 # Specifies your host name if https is enabled.
      - NON_ROOT=true
    networks:
      - seafile-net

networks:
  seafile-net:

Can anyone help me?

After disabling https I can connect the seafile server.

/etc/nginx/sites-available/seafile.conf looks as follows (see Configuring Nginx)

log_format seafileformat '$http_x_forwarded_for $remote_addr [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $upstream_response_time';

server {
    listen 80;
    server_name www.myseafile.com;

    proxy_set_header X-Forwarded-For $remote_addr;

    location / {
         proxy_pass         http://127.0.0.1:8000;
         proxy_set_header   Host $http_host;
         proxy_set_header   X-Real-IP $remote_addr;
         proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header   X-Forwarded-Host $server_name;
         proxy_read_timeout  1200s;

         # used for view/edit office file via Office Online Server
         client_max_body_size 0;

         access_log      /var/log/nginx/seahub.access.log seafileformat;
         error_log       /var/log/nginx/seahub.error.log;
    }

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;

        send_timeout  36000s;

        access_log      /var/log/nginx/seafhttp.access.log seafileformat;
        error_log       /var/log/nginx/seafhttp.error.log;
    }
    location /media {
        root /opt/seafile/seafile-server-latest/seahub;
    }
}

docker-compose.yml looks as follows (see Migrate from non-docker deployment)

version: '2.0'
services:
  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    ports:
      - "8888:80"
    volumes:
      - /opt/seafile-data:/shared   # Requested, specifies the path to Seafile data persistent store.
      - /media/nas/seafile:/shared/seafile/seafile-data
    environment:
      - DB_HOST=192.168.0.15
      - DB_ROOT_PASSWD=secret  # Requested, the value shuold be root's password of MySQL service.
      - TIME_ZONE=Etc/UTC  # Optional, default is UTC. Should be uncomment and set to your local time zone.
      - SEAFILE_ADMIN_EMAIL=seafile@raspberry.pi # Specifies Seafile admin user, default is 'me@example.com'.
      - SEAFILE_ADMIN_PASSWORD=secret     # Specifies Seafile admin password, default is 'asecret'.
      - SEAFILE_SERVER_LETSENCRYPT=false   # Whether to use https or not.
      - SEAFILE_SERVER_HOSTNAME=192.168.0.15 # Specifies your host name if https is enabled.
      - NON_ROOT=true
    networks:
      - seafile-net
networks:
  seafile-net: