DHCP Service: mknod Error

when attempting to save my DHCP configuration, the system seems to not recognize the path for the dhcpd.leases file ‘/config/’

vyos@vyos# commit
[ service dhcp-server ]
Traceback (most recent call last):
File “/usr/libexec/vyos/conf_mode/dhcp_server.py”, line 813, in
apply©
File “/usr/libexec/vyos/conf_mode/dhcp_server.py”, line 802, in apply
os.mknod(lease_file)
FileNotFoundError: [Errno 2] No such file or directory

[[service dhcp-server]] failed
Commit failed
[edit]

If I go in and edit the file /usr/libexec/vyos/conf_mode/dhcp_server.py and set the path to /opt/vyatta/config/dhcpd.leases and then run the same commands in config mode and commit it all works fine.

This is based on the rolling release vyos-1.2.0-rolling+201902201040-amd64

Is this an issue with the rolling release, or have I done something wrong?

Can you provide the configuration commands for DHCP that you are using?

Well, it looks like its a case with the Live CD. Once I install the image to the HD I no longer have the issue. In Live mode, the commands issued that result in the error mentioned are:

set interfaces ethernet eth0 address '192.168.0.1/24'
set service dhcp-server shared-network-name LOCAL subnet 192.168.0.0/24 default-router '192.168.0.1'
set service dhcp-server shared-network-name LOCAL subnet 192.168.0.0/24 dns-server '8.8.8.8'
set service dhcp-server shared-network-name LOCAL subnet 192.168.0.0/24 range LOCAL start 192.168.0.10
set service dhcp-server shared-network-name LOCAL subnet 192.168.0.0/24 range LOCAL stop 192.168.0.50
commit

Yeah, when you run from the iso /config and a few other directories you usually have for persistent stroage, won’t exist. I had a similar issue reported with wireguard (fixes: T1254 - generate wireguard keypair fails when executed on the iso · vyos/vyos-1x@af63311 · GitHub), might be worth to open a task in phabricator.

1 Like

And hence my hack for the iso to change the location of the lease file in the dhcp_server.py to a persistent storage location worked … but obviously not a solution :slight_smile:

The script could test if the location exists and if not creates it. That way it would work from the iso too.