Skip to content

fix: check if dhcpcd is running before querying DHCP#2800

Open
raman1236 wants to merge 1 commit into
puppetlabs:mainfrom
raman1236:fix/dhcpcd-running-check
Open

fix: check if dhcpcd is running before querying DHCP#2800
raman1236 wants to merge 1 commit into
puppetlabs:mainfrom
raman1236:fix/dhcpcd-running-check

Conversation

@raman1236

Copy link
Copy Markdown

Description

Fixes facter spamming "dhcpcd is not running" to syslog on Ubuntu 24.04 for every network interface.

Problem

On Ubuntu 24.04, dhcpcd-base is installed as a dependency of cloud-init and ubuntu-minimal, but the dhcpcd daemon is not running. The DHCP resolver calls dhcpcd -U <interface> for every network interface, which logs "dhcpcd is not running" to syslog each time.

Fix

Before calling dhcpcd -U, check if dhcpcd is actually running by looking for its PID file in common locations:

  • /run/dhcpcd.pid
  • /var/run/dhcpcd.pid
  • /run/dhcpcd/pid
  • /var/run/dhcpcd/pid

The check is cached for the lifetime of the resolver so it only happens once per facter run.

Fixes #2780

On Ubuntu 24.04, dhcpcd-base is installed as a dependency of
cloud-init and ubuntu-minimal, but the dhcpcd daemon is not
running. The dhcpcd -U command logs 'dhcpcd is not running' to
syslog for every network interface, which produces excessive
noise in system logs.

Check for common dhcpcd PID file locations before attempting to
run dhcpcd -U. The check is cached for the lifetime of the
resolver so it only happens once per facter run.

Fixes puppetlabs#2780
@raman1236 raman1236 requested a review from a team as a code owner April 5, 2026 23:40
@bastelfreak

Copy link
Copy Markdown
Contributor

Hi @raman1236,
I no iced the various PRs you raised in the past days. Perforce doesn't maintain open source facter/puppet anymore. The community continues the open source development at https://github.com/OpenVoxProject/openfact. If you want, you can raise the PRs there and we can review it.

@raman1236

Copy link
Copy Markdown
Author

Friendly ping — this PR adds a check for whether dhcpcd is actually running before querying it, preventing errors on systems where it's installed but not active. Would appreciate a review. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Facter spamming "dhcpcd is not running" on ubuntu 24.04

3 participants