You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 16.04升级后Bacula-dir无法启动求助

Hey Aron, let's dig into this Bacula issue you're facing after upgrading to Ubuntu 16.04. I've gone through your details and here's what I think might be going on, plus actionable steps to fix it:

Bacula Director Startup & Connection Troubleshooting (Ubuntu 14 → 16.04 Upgrade)

Key Context to Highlight

Your switch from MySQL to PostgreSQL during the upgrade is a critical detail—this transition often leaves subtle configuration or schema gaps that cause hangs like you're seeing. Also, the truncated debug log cutting off at postgresql.c:1117-0 db_init_database first time tells us the director is getting stuck initializing the PostgreSQL connection, not just failing auth.

Likely Root Causes & Fixes

1. Incomplete PostgreSQL Schema Setup

Even though you can connect via psql, Bacula might be missing required database permissions or schema objects. Let's re-run the official packaged scripts (avoid source scripts unless you compiled Bacula yourself):

# Drop and recreate the Bacula DB from scratch
sudo -u postgres dropdb bacula
sudo -u postgres createdb -O bacula bacula

# Apply Ubuntu's packaged Bacula PostgreSQL schema
sudo -u postgres psql -d bacula -f /usr/share/bacula-director-pgsql/create_postgresql_tables.sql
sudo -u postgres psql -d bacula -f /usr/share/bacula-director-pgsql/grant_postgresql_privileges.sql

2. PostgreSQL Socket Permissions

Bacula might be having trouble accessing the PostgreSQL local socket. Verify the bacula user has access:

# Check socket directory permissions
ls -ld /var/run/postgresql/

# Add bacula user to postgres group for socket access
sudo usermod -aG postgres bacula

3. Subtle Configuration Mismatches

Ubuntu's default configs can have tiny differences between test and production machines. Double-check these:

  • bacula-dir.conf Catalog settings: Ensure the DB credentials match exactly what works in psql, and confirm the connection method (local socket vs TCP):
    Catalog {
      Name = MyCatalog
      dbname = "bacula"
      dbuser = "bacula"
      dbpassword = "your-db-password" # Match what you used in psql
      dbaddress = "" # Leave empty for local socket; use "localhost" for TCP
    }
    
  • bconsole.conf vs bacula-dir.conf: The Director block in bconsole.conf must use the exact same Name and Password as the Director section in bacula-dir.conf—even a single typo triggers the auth error.

4. Capture Full Debug Logs

The truncated log you shared cuts off right when the DB init starts. Get a complete debug trace:

sudo systemctl stop bacula-director
sudo bacula-dir -c /etc/bacula/bacula-dir.conf -d 400 > /tmp/bacula-full-debug.log 2>&1

Look for lines after db_init_database—it will likely show a specific error like missing extensions, permission denied, or socket connection failures.

5. Fix Permissions for Critical Bacula Paths

Even if you checked permissions, ensure all core directories are owned by the bacula user:

sudo chown -R bacula:bacula /var/lib/bacula /var/log/bacula /var/run/bacula
sudo chmod 750 /var/lib/bacula /var/log/bacula /var/run/bacula

6. Rule Out TLS Conflicts

The auth error mentions TLS—Ubuntu's default config might have TLS enabled accidentally. Check:

  • In bacula-dir.conf, look for TLS Enable = yes in the Director or Catalog sections. If you don't use TLS, set it to no.
  • Match TLS settings in bconsole.conf to the director's config.

How to Narrow Down the Issue Further

  • Test DB connection as the bacula user: Run sudo -u bacula psql -d bacula -U bacula—if this works, the problem isn't the password itself, but how Bacula is handling the connection.
  • Compare test vs production configs: Use diff to spot differences between your working test machine and the problematic server:
    # Copy test configs to your server first
    scp user@test-server:/etc/bacula/* /tmp/test-bacula-configs/
    diff -r /etc/bacula/ /tmp/test-bacula-configs/
    
  • Check systemd logs: Use journalctl -u bacula-director.service -f to see real-time logs when starting the service—this often reveals errors missing in truncated debug output.

Final Notes on MySQL → PostgreSQL Switch

Ensure no residual MySQL configs or packages are left:

# Check for leftover MySQL Bacula packages
dpkg -l | grep bacula | grep mysql

# Purge them if present
sudo apt purge bacula-common-mysql bacula-director-mysql

内容的提问来源于stack exchange,提问作者Aron

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 06:41:44