Package: kea-dhcp4-server
Version: 2.2.0-6
Severity: important
X-Debbugs-Cc: fuzzye...@gmail.com

Dear Maintainer,

The DHCP4 server is configured to use MySQL (actually MariaDB) on
localhost for the lease database.  When starting the kea-dhcp4-server unit, the 
following error is produced: 
    INFO  DHCPSRV_MYSQL_DB opening MySQL lease database: name=kea_dhcp 
password=***** port=3306 type=mysql universe=4 user=kea_dhcp_user
    ERROR [...] DHCP4_CONFIG_LOAD_FAIL configuration error using file: 
/etc/kea/kea-dhcp4.conf, 
    reason: Unable to open database: Can't connect to local server through 
socket '/run/mysqld/mysqld.sock'

First, when configured to use a network database, why is this trying to
use the socket?  

Second, if it is trying to use the socket, why is it not
parsing /etc/mysql/my.cnf to find 
    socket = /mnt/tera/mariadb/mysqld.sock
?  (The socket file has been moved to reside with the database files on
the RAID array.)

Third, I don't see that I can configure Kea to the location of the socket file.

Comment:  It might be a good idea to add to the comment block in the default 
kea-dhcp4.conf about adding a dependency to the kea-dhcp-server unit on the 
mysql (or mariadb) unit to avoid a boot race condition.

Comment:  While the Department of Redundancy Department appreciates that
every config file in /etc/kea starts with "kea", this is redundant; the
leading "kea-" could be removed, improving typeability and readability
in this directory.

Comment:  The Kea config files appear to be JSON.  Vim would highlight
these files correctly (especially useful, given the levels of nesting)
if they had the JSON extension.  I note, however, Vim *hates* // comments 
in JSON files...

Verifying that maridb is listening:
    netstat -tlnp

    Proto Recv-Q Send-Q Local Address           Foreign Address         State   
    PID/Program name
    tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN  
    1256/mariadbd
    [...]

Alternate representations of localhost:
We change the "Dhcp4": "lease-database": "host" line in kea-dhcp4.conf to
    "host": "",
which is a Kea configuration idiomatic alias for localhost.  No change.

Workaround:
We change the "Dhcp4": "lease-database": "host" line in kea-dhcp4.conf to
    "host": "127.0.0.1",
and this works.

What should be happening:
    * Least: When the "lease-database" "host" is set to "" or "localhost", 
      kea-dhcp4-server actually finds the database server running locally, 
      the same way it finds that server when "host" is set to "127.0.0.1".
    * Better: In /etc/kea/kea-dhcp4.conf, I could set the "socket-type" and 
      "socket" for the MySQL/MariaDB socket file, so I wouldn't have to use
      the network socket.
    * Best: Kea would parse the /etc/mysql/my.cfg for the socket location 
      when the "lease-database" is "mysql" and the "host" is "localhost" or 
      "".

-- System Information:
Debian Release: 12.8
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-28-amd64 (SMP w/6 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages kea-dhcp4-server depends on:
ii  init-system-helpers  1.65.2
ii  kea-common           2.2.0-6
ii  libc6                2.36-9+deb12u9
ii  libgcc-s1            12.2.0-14
ii  libstdc++6           12.2.0-14

kea-dhcp4-server recommends no packages.

Versions of packages kea-dhcp4-server suggests:
ii  kea-doc  2.2.0-6

-- Configuration Files:
/etc/kea/kea-dhcp4.conf changed:
{
"Dhcp4": {
    "interfaces-config": {
        "interfaces": [ "enp2s0.30/10.255.3.200", "enp2s0.40/10.255.4.200" ]
    },
    "control-socket": {
        "socket-type": "unix",
        "socket-name": "/run/kea/kea4-ctrl-socket"
    },
    "lease-database": {
        "type": "mysql",
        "name": "kea_dhcp",
        "user": "kea_dhcp_user",
        "password": "9HWdRL|cY~gVr9mc",
        "host": "localhost",
        "port": 3306
    },
    "expired-leases-processing": {
        "reclaim-timer-wait-time": 10,
        "flush-reclaimed-timer-wait-time": 25,
        "hold-reclaimed-time": 3600,
        "max-reclaim-leases": 100,
        "max-reclaim-time": 250,
        "unwarned-reclaim-cycles": 5
    },
    "renew-timer": 900,
    "rebind-timer": 1800,
    "valid-lifetime": 3600,
    "option-data": [
    ],
    "hooks-libraries": [
        //  Set up high-availability with router006.
        {
            // Library for commands HA servers send to each other.
            "library": 
"/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_lease_cmds.so",
            "parameters": { }
        },
        {
            "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_ha.so",
            "parameters": {
                "high-availability": [{
                    "this-server-name": "tera003",
                    //"trust-anchor": "/usr/lib/kea/CA.pem",
                    //"cert-file": "/usr/lib/kea/server1_cert.pem",
                    //"key-file": "/usr/lib/kea/server1_key.pem",
                    "mode": "hot-standby",
                    "heartbeat-delay": 10000,
                    "max-response-delay": 60000,
                    "max-ack-delay": 5000,
                    "max-unacked-clients": 5,
                    "peers": [{
                        "name": "tera003",
                        "url": "http://10.255.4.200:8000/";,
                        "role": "primary",
                        "auto-failover": true
                    }, {
                        "name": "router006",
                        "url": "http://10.255.4.254:8000/";,
                        "role": "standby",
                        "auto-failover": true
                    }]
                }]
            }
        }],
    "subnet4": [
        <?include "/etc/kea/semitrusted-dhcp.json"?> ,
        <?include "/etc/kea/trusted-dhcp.json"?>
    ],
    "loggers": [
    {
        "name": "kea-dhcp4",
        "output_options": [
            {
                "output": "stdout",
                "pattern": "%-5p %m\n",
            }
        ],
        "severity": "INFO",
        "debuglevel": 0
    }
  ]
}
}


-- no debconf information

Reply via email to