Comment 1 for bug 2056222

Revision history for this message
Jacopo Rota (r00ta) wrote :

Looking at

ubuntu@maas-deb35:/var/lib/maas$ sudo systemctl status maas-dhcpd
○ maas-dhcpd.service - MAAS instance of ISC DHCP server for IPv4
     Loaded: loaded (/lib/systemd/system/maas-dhcpd.service; enabled; vendor preset: enabled)
     Active: inactive (dead)
  Condition: start condition failed at Thu 2024-03-14 09:38:18 UTC; 92ms ago
             └─ ConditionPathExists=/run/maas/dhcp was not met
       Docs: man:dhcpd(8)

Mar 14 09:38:14 maas-deb35 systemd[1]: Condition check resulted in MAAS instance of ISC DHCP server for IPv4 being skipped.
Mar 14 09:38:14 maas-deb35 systemd[1]: Condition check resulted in MAAS instance of ISC DHCP server for IPv4 being skipped.
Mar 14 09:38:15 maas-deb35 systemd[1]: Condition check resulted in MAAS instance of ISC DHCP server for IPv4 being skipped.
Mar 14 09:38:15 maas-deb35 systemd[1]: Condition check resulted in MAAS instance of ISC DHCP server for IPv4 being skipped.
Mar 14 09:38:16 maas-deb35 systemd[1]: Condition check resulted in MAAS instance of ISC DHCP server for IPv4 being skipped.
Mar 14 09:38:16 maas-deb35 systemd[1]: Condition check resulted in MAAS instance of ISC DHCP server for IPv4 being skipped.
Mar 14 09:38:16 maas-deb35 systemd[1]: Condition check resulted in MAAS instance of ISC DHCP server for IPv4 being skipped.
Mar 14 09:38:17 maas-deb35 systemd[1]: Condition check resulted in MAAS instance of ISC DHCP server for IPv4 being skipped.
Mar 14 09:38:17 maas-deb35 systemd[1]: Condition check resulted in MAAS instance of ISC DHCP server for IPv4 being skipped.
Mar 14 09:38:18 maas-deb35 systemd[1]: Condition check resulted in MAAS instance of ISC DHCP server for IPv4 being skipped.
(reverse-i-search)`up': sudo apt ^Cdate
ubuntu@maas-deb35:/var/lib/maas$ cat /lib/systemd/system/maas-dhcpd.service
[Unit]
Description=MAAS instance of ISC DHCP server for IPv4
Documentation=man:dhcpd(8)
Wants=network-online.target
After=network-online.target
After=time-sync.target
BindsTo=maas-rackd.service
ConditionPathExists=/run/maas/dhcp
ConditionPathExists=/var/lib/maas/dhcpd.conf
ConditionPathExists=/var/lib/maas/dhcpd-interfaces

[Service]
# Allow dhcp server to write lease and pid file as 'dhcpd' user
# The leases files need to be root:dhcpd even when dropping privileges
ExecStart=/bin/sh -ec '\
    INTERFACES=$(cat /var/lib/maas/dhcpd-interfaces); \
    LEASES_FILE=/var/lib/maas/dhcp/dhcpd.leases; \
    [ -e $LEASES_FILE ] || touch $LEASES_FILE; \
    /usr/sbin/maas-dhcp-helper clean $LEASES_FILE; \
    chown root:dhcpd /var/lib/maas/dhcp $LEASES_FILE; \
    chmod 775 /var/lib/maas/dhcp ; chmod 664 $LEASES_FILE; \
    exec dhcpd -user dhcpd -group dhcpd -f -q -4 -pf /run/maas/dhcp/dhcpd.pid \
        -cf /var/lib/maas/dhcpd.conf -lf $LEASES_FILE $INTERFACES'
# Require dhcpd stop in 8 seconds, if not kill it with 'mixed' mode.
TimeoutStopSec=8
KillMode=mixed

[Install]
WantedBy=multi-user.target

we can see that ConditionPathExists=/run/maas/dhcp was not met . This is because we create /run/maas only when we install maas and after whatever reboot /run/maas goes away and we don't recreate it anymore (bug introduced here https://github.com/maas/maas/commit/b402c32d0a85d26fd6a5ce14a72056013fd93075 as ExecStartPre=/bin/mkdir -p /run/maas/dhcp /var/lib/maas/dhcp was removed)