Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
Kea
Kea
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 445
    • Issues 445
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 71
    • Merge Requests 71
  • Operations
    • Operations
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • ISC Open Source Projects
  • KeaKea
  • Issues
  • #1667

Closed
Open
Opened Jan 23, 2021 by JRC@jarrodCoombes

Kea 1.6.2 on Ubuntu Server 20.04 unable to start Kea with systemctl

Not sure which template to use.

Kea will not start with systemctl (and therefore at boot). It errors out with:

Unable to open database: unable to open '/var/lib/kea-leases4.csv'

It will start just fine with keactrl

Oddly, when started with keactrl if you run: systemctl status kea-dhcp4-server You get the error that it is not started due to the issue above, but keactrl status shows it as active.

# keactrl status

DHCPv4 server: active
DHCPv6 server: inactive
DHCP DDNS: inactive
Control Agent: active
Kea DHCPv4 configuration file: /etc/kea/kea-dhcp4.conf
Kea DHCPv6 configuration file: /etc/kea/kea-dhcp6.conf
Kea DHCP DDNS configuration file: /etc/kea/kea-dhcp-ddns.conf
Kea Control Agent configuration file: /etc/kea/kea-ctrl-agent.conf
keactrl configuration file: /etc/kea/keactrl.conf
ERROR/keactrl: Configuration file for Kea does not exist: /etc/kea/kea-dhcp6.conf.

I am not using DHCP for IPv6 so that error is expected.

#  ps -aux | grep "kea"

_kea        2337  0.0  1.0  41620 18956 ?        Ss   01:23   0:00 /usr/sbin/kea-ctrl-agent -c /etc/kea/kea-ctrl-agent.conf
root        2398  0.0  1.0  41232 19732 pts/0    S    01:24   0:00 /usr/sbin/kea-dhcp4 -c /etc/kea/kea-dhcp4.conf -d
# systemctl status kea-dhcp4-server

● kea-dhcp4-server.service - Kea IPv4 DHCP daemon
     Loaded: loaded (/lib/systemd/system/kea-dhcp4-server.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2021-01-23 01:23:44 PST; 6min ago
       Docs: man:kea-dhcp4(8)
    Process: 2361 ExecStart=/usr/sbin/kea-dhcp4 -c /etc/kea/kea-dhcp4.conf (code=exited, status=1/FAILURE)
   Main PID: 2361 (code=exited, status=1/FAILURE)

Jan 23 01:23:44 en-dhcp systemd[1]: Started Kea IPv4 DHCP daemon.
Jan 23 01:23:44 en-dhcp kea-dhcp4[2361]: 2021-01-23 01:23:44.130 INFO  [kea-dhcp4.dhcp4/2361] DHCP4_STARTING Kea DHCPv4 server version 1.6.2 starting
Jan 23 01:23:44 en-dhcp kea-dhcp4[2361]: 2021-01-23 01:23:44.132 ERROR [kea-dhcp4.dhcp4/2361] DHCP4_CONFIG_LOAD_FAIL configuration error using file: /etc/kea/kea-dhcp4.conf, reason: Unable to open database: unable to open '/var/lib/kea-leases4.csv'
Jan 23 01:23:44 en-dhcp kea-dhcp4[2361]: 2021-01-23 01:23:44.132 ERROR [kea-dhcp4.dhcp4/2361] DHCP4_INIT_FAIL failed to initialize Kea server: configuration error using file '/etc/kea/kea-dhcp4.conf': Unable to open database:unable to open '/var/lib/kea-leases4.csv'
Jan 23 01:23:44 en-dhcp systemd[1]: kea-dhcp4-server.service: Main process exited, code=exited, status=1/FAILURE
Jan 23 01:23:44 en-dhcp systemd[1]: kea-dhcp4-server.service: Failed with result 'exit-code'.

So it's running, but not running? /var/lib/kea-lease4.csv does exist, and I verified that it is not a permissions issue by setting it to 777 (rwxrwxrwx), but I get the same error as above.

I have also tried running keactrl stop followed by systemctl start kea-dhcp4-server and get the same error as above. If I remove the lease file from the conf file (ie set persist to false), then it works and starts up fine. But I need those leases to persist in case of a reboot or power failure etc.

Lastly, my config

{ "Dhcp4":

{
  "interfaces-config": { "interfaces": [ "enp1s0f0","sub_int1","sub_int2" ]    },

  "lease-database": {
    "type": "memfile",
    "persist": true,
    "name": "/var/lib/kea-leases4.csv",
    "lfc-interval": 3600
  },

  "valid-lifetime": 43200,
  "renew-timer": 28800,
  "rebind-timer": 2000,
  "echo-client-id": false,
  "match-client-id": true,
  "authoritative": true,

  "subnet4": 
[

  {
      "subnet": "10.10.0.0/16",
      "pools": [ { "pool":  "10.10.60.1 - 10.10.69.255" } ],
      "option-data": [
                      { "name": "domain-name-servers", "data": "IP1, IP2>".      },
                      { "name": "routers",             "data": "GW_IP"           }
                     ]
  },
  {
      "subnet": "10.12.0.0/16",
      "pools": [ { "pool": "10.12.60.0 - 10.12.69.255" } ],
      "option-data": [
                      {"name": "domain-name-servers",  "data": "IP"                },
                      {"name": "routers",              "data": "GW_IP"             }
                     ]
  }

],

    "loggers": [
        {
            "name": "kea-dhcp4",
            "output_options": [
                {
                    "output": "/path/to/log/file.log",
                    "maxver": 8,
                    "maxsize": 204800,
                    "flush": true,
                    "pattern": "%d{%j %H:%M:%S.%q} %c %m\n"
                }
            ],
            "severity": "INFO"
        }
    ]
}

}
Edited Jan 23, 2021 by JRC
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Kea1.9-backlog
Milestone
Kea1.9-backlog
Assign milestone
Time tracking
None
Due date
None
Reference: isc-projects/kea#1667