diff -Nru dhcpcd-10.0.6/debian/changelog dhcpcd-10.0.6/debian/changelog --- dhcpcd-10.0.6/debian/changelog 2024-03-31 10:48:02.000000000 +0200 +++ dhcpcd-10.0.6/debian/changelog 2024-05-07 12:12:01.000000000 +0200 @@ -1,3 +1,10 @@ +dhcpcd (1:10.0.6-1ubuntu3.1) noble; urgency=medium + + * hooks/30-hostname: Exit with 0 if setting hostname is not needed + This prevents retrying dhcpcd for 5 minutes during boot. (LP: #2064926) + + -- Benjamin Drung Tue, 07 May 2024 12:12:01 +0200 + dhcpcd (1:10.0.6-1ubuntu3) noble; urgency=medium * No-change rebuild for CVE-2024-3094 diff -Nru dhcpcd-10.0.6/debian/patches/hooks-30-hostname-Exit-with-0-if-setting-hostname-is-not-.patch dhcpcd-10.0.6/debian/patches/hooks-30-hostname-Exit-with-0-if-setting-hostname-is-not-.patch --- dhcpcd-10.0.6/debian/patches/hooks-30-hostname-Exit-with-0-if-setting-hostname-is-not-.patch 1970-01-01 01:00:00.000000000 +0100 +++ dhcpcd-10.0.6/debian/patches/hooks-30-hostname-Exit-with-0-if-setting-hostname-is-not-.patch 2024-05-07 12:11:00.000000000 +0200 @@ -0,0 +1,48 @@ +From: Benjamin Drung +Date: Tue, 7 May 2024 11:20:04 +0200 +Subject: hooks/30-hostname: Exit with 0 if setting hostname is not needed + +If the hostname is already set before dhcpcd is started, `need_hostname` +will hit the "No old hostname" case and will call `false` to return 1. +`set_hostname` will return with the same return value. Then +`30-hostname` will exit with the same exit value: + +``` +dhcpcd-10.0.6 starting +dev: loaded udev +DUID 00:03:00:01:3c:97:0e:e9:32:3c +enp0s25: IAID 0e:e9:32:3c +enp0s25: soliciting a DHCP lease +enp0s25: offered 192.168.3.61 from 192.168.1.7 +enp0s25: ignoring offer of 192.168.3.61 from 192.168.1.8 +enp0s25: probing address 192.168.3.61/20 +enp0s25: leased 192.168.3.61 for 3600 seconds +enp0s25: adding route to 192.168.0.0/20 +enp0s25: adding default route via 192.168.1.1 +script_status: /usr/lib/dhcpcd/dhcpcd-run-hooks: WEXITSTATUS 1 +exiting due to oneshot +dhcpcd exited +``` + +Return with value 0 in case setting the hostname is not needed. + +Bug-Ubuntu: https://launchpad.net/bugs/2064926 +Forwarded: https://github.com/NetworkConfiguration/dhcpcd/pull/320 +Signed-off-by: Benjamin Drung +--- + hooks/30-hostname.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hooks/30-hostname.in b/hooks/30-hostname.in +index b0a3757..98e419f 100644 +--- a/hooks/30-hostname.in ++++ b/hooks/30-hostname.in +@@ -118,7 +118,7 @@ set_hostname() + *) hshort=true;; + esac + +- need_hostname || return ++ need_hostname || return 0 + + if [ -n "$new_fqdn" ]; then + if ${hfqdn} || ! ${hshort}; then diff -Nru dhcpcd-10.0.6/debian/patches/series dhcpcd-10.0.6/debian/patches/series --- dhcpcd-10.0.6/debian/patches/series 2024-02-02 17:27:52.000000000 +0100 +++ dhcpcd-10.0.6/debian/patches/series 2024-05-07 12:11:00.000000000 +0200 @@ -0,0 +1 @@ +hooks-30-hostname-Exit-with-0-if-setting-hostname-is-not-.patch