Unable to set DHCP entry on host creation

Problem:

Adding a host that is assigned to a subnet managed by smart proxy throws an error.

On the foreman master the following logs appear:

2024-07-16T10:09:03 [W|app|502e0303] Rolling back due to a problem: [#<Orchestration::Task:0x000055bee8309e20 @name=“Create DHCP Settings for kathy-sprang.subnet1.example.org”, @id=“dhcp_create_00:50:56:85:de:1e”, @status=“failed”, @priority=10, @action=[#<Nic::Managed id: nil, mac: “00:50:56:85:de:1e”, ip: “10.231.25.116”, type: “Nic::Managed”, name: “kathy-sprang.subnet1.example.org”, host_id: nil, subnet_id: 2, domain_id: 2, attrs: {}, created_at: nil, updated_at: nil, provider: nil, username: nil, password: nil, virtual: false, link: true, identifier: “”, tag: “”, attached_to: “”, managed: true, mode: “balance-rr”, attached_devices: “”, bond_options: “”, primary: true, provision: true, compute_attributes: {}, ip6: “”, subnet6_id: nil>, :set_dhcp], @created=1721117343.4691157, @timestamp=2024-07-16 08:09:03.588748944 UTC>]
2024-07-16T10:09:03 [E|app|502e0303] Failed to save: Create DHCP Settings for kathy-sprang.subnet1.example.org task failed with the following error: ERF12-6899 [ProxyAPI::ProxyException]: Unable to set DHCP entry ([RestClient::BadRequest]: 400 Bad Request) for proxy https://smart-proxy1.subnet1.example.org:8443/dhcp

Expected outcome:

Host can be added without a problem

Foreman and Proxy versions:

3.11.0

Foreman and Proxy plugin versions:

foreman_discovery MaaS Discovery Plugin engine for Foreman 24.0.1
foreman_puppet Allow assigning Puppet environments and classes to the Foreman Hosts. 6.3.0

Distribution and version:

Debian 11

Other relevant data:
Smart-Proxy has the following features:

Active features

  • DHCP
  • DNS
  • Logs
  • TFTP

The foreman-proxy has been installed using

foreman-installer   \
--no-enable-foreman   \
--no-enable-foreman-puppet   \
--no-enable-foreman-cli   \
--no-enable-foreman-cli-puppet   \
--no-enable-puppet   \
--enable-foreman-proxy   \
--foreman-proxy-puppet=false   \
--foreman-proxy-puppetca=false   \
--foreman-proxy-dhcp=true   \
--foreman-proxy-dhcp-interface=ens192   \
--foreman-proxy-dhcp-gateway=10.231.25.1   \
--foreman-proxy-dhcp-range="10.231.25.128 10.231.25.254"   \
--foreman-proxy-dhcp-nameservers="10.231.25.1"

On the smart proxy, I saw this in the smart proxy log:

2024-07-17T10:16:56 aeab7962 [E] Omshell failed: omshell= > > > dhcpctl_connect: no more
omshell= > not connected.
omshell= > no open object.
omshell= > no open object.
omshell= > no open object.
omshell= > no open object.
omshell= > no open object.
omshell= > not connected.
omshell= >
2024-07-17T10:16:56 aeab7962 [E] Failed to add DHCP reservation for kathy-sprang.subnet1.example.org (10.231.25.70 / 00:50:56:85:de:1e): No response from DHCP server
2024-07-17T10:16:56 aeab7962 [W] Error details for Failed to add DHCP reservation for kathy-sprang.subnet1.example.org (10.231.25.70 / 00:50:56:85:de:1e): No response from DHCP
server: <Proxy::DHCP::Error>: Failed to add DHCP reservation for kathy-sprang.subnet1.example.org (10.231.25.70 / 00:50:56:85:de:1e): No response from DHCP server
/usr/share/foreman-proxy/modules/dhcp_common/isc/omapi_provider.rb:109:in `report'
/usr/share/foreman-proxy/modules/dhcp_common/isc/omapi_provider.rb:87:in `om_disconnect'
/usr/share/foreman-proxy/modules/dhcp_common/isc/omapi_provider.rb:60:in `om_add_record'
/usr/share/foreman-proxy/modules/dhcp_common/isc/omapi_provider.rb:36:in `add_record'
/usr/share/foreman-proxy/modules/dhcp/dhcp_api.rb:81:in `block in <class:DhcpApi>'

Does this mean that the smart proxy tries to communicate with the foreman-master on another port as 8443 regarding the dhcp configuration?

These look more like Foreman’s log, but I might be wrong… Could you use foreman-tail to check all the logs in parallel?

Also beware of this issue that might lead to DHCP errors when registering the host (to use Foreman 3.11.0 I manually edited the lines on my machine while waiting for 3.11.1)

Hi and thanks for your reply.

Well… I’d love to. But things are not working out:

# foreman-tail
cat: /usr/share/foreman/script/foreman-tail.d/common: Is a directory
cat: /usr/share/foreman/script/foreman-tail.d/debian: Is a directory
cat: /usr/share/foreman/script/foreman-tail.d/redhat: Is a directory

# foreman-tail --help
cat: '/usr/share/foreman/script/foreman-tail.d/*---help': No such file or directory

# man foreman-tail
No manual entry for foreman-tail

Okay, sorry :smiley:

But it was indeed the smart proxy log of the first smart proxy.

I also tried to rebuild configurations on that host. The error:

2024-07-17T15:39:12 13b2df3d [I] Started GET /tftp/serverName
2024-07-17T15:39:12 13b2df3d [I] Finished GET /tftp/serverName with 200 (0.53 ms)
2024-07-17T15:39:12 13b2df3d [I] Started GET /tftp/serverName
2024-07-17T15:39:12 13b2df3d [I] Finished GET /tftp/serverName with 200 (0.51 ms)
2024-07-17T15:39:13 13b2df3d [I] Started DELETE /dhcp/10.231.25.0/mac/00:50:56:85:de:1e
2024-07-17T15:39:13 13b2df3d [I] Finished DELETE /dhcp/10.231.25.0/mac/00:50:56:85:de:1e with 200 (0.61 ms)
2024-07-17T15:39:13 13b2df3d [I] Started POST /dhcp/10.231.25.0
2024-07-17T15:39:13 13b2df3d [E] Omshell failed: omshell= > > > obj: <null>
omshell= > obj: host
omshell= > obj: host
omshell= name = "kathy-sprang.subnet1.example.org"
omshell= > obj: host
omshell= name = "kathy-sprang.subnet1.example.org"
omshell= ip-address = 0a:e7:19:46
omshell= > obj: host
omshell= name = "kathy-sprang.subnet1.example.org"
omshell= ip-address = 0a:e7:19:46
omshell= hardware-address = 00:50:56:85:de:1e
omshell= > obj: host
omshell= name = "kathy-sprang.subnet1.example.org"
omshell= ip-address = 0a:e7:19:46
omshell= hardware-address = 00:50:56:85:de:1e
omshell= hardware-type = 1
omshell= > obj: host
omshell= name = "kathy-sprang.subnet1.example.org"
omshell= ip-address = 0a:e7:19:46
omshell= hardware-address = 00:50:56:85:de:1e
omshell= hardware-type = 1
omshell= statements = "filename = "pxelinux.0"; next-server = 0a:e7:19:0a; option host-name = "kathy-sprang.subnet1.example.org";"
omshell= > can't open object: connection reset by peer
omshell= obj: host
omshell= name = "kathy-sprang.subnet1.example.org"
omshell= ip-address = 0a:e7:19:46
omshell= hardware-address = 00:50:56:85:de:1e
omshell= hardware-type = 1
omshell= statements = "filename = "pxelinux.0"; next-server = 0a:e7:19:0a; option host-name = "kathy-sprang.subnet1.example.org";"
omshell= >

Something here is wrong also with foreman-tail, could you try launching the installer also with these options, to enable verbose logging?

foreman-installer --foreman-logging-level=debug --foreman-logging-type=file --foreman-proxy-log=SYSLOG --foreman-proxy-log-level=DEBUG

I am also having the same issue.

After verifying permissions for dhcpd.conf, /etc/dhcp/, /var/lib/dhcp/dhcpd.lease, omapi_key, omshell manual connectivity, everything basically, i came to the conclusion that either i am missing something or this is a bug.

However, i have managed to create a host entry in dhcpd.lease for a host after clicking submit in the UI multiple times - which leads me to believe this is a bug.

Are you using Foreman 3.11.1 or 3.11.0?

I am using 3.10.0, and currently in the process of upgrading to 3.11.

Use 3.11.1, in 3.11.0 there is a bug about DHCP

I managed to make it work in 3.10. I am having issues with upgrading from 3.10 to 3.11.1, it cannot see the smart proxy version and status in the UI.

I use 5.10.0-30-amd64 #1 SMP Debian 5.10.218-1 (2024-06-01) x86_64 GNU/Linux, and to upgrade i add the new version(3.11) to /etc/apt/sources.list.d/foreman.list, then run apt upgrade & foreman-installer - everything checks runs fine.

Can you share the procedure you are using, and the OS ?

Sorry for the delay (holidays), I’m using it on EL9 and following the upgrade procedure from the documentation