Debian Bug report logs - #643771
initscripts: hostname is set to FQDN; /etc/hostname not read or hostname.sh not executed?

version graph

Package: isc-dhcp-client; Maintainer for isc-dhcp-client is Debian ISC DHCP maintainers <pkg-dhcp-devel@lists.alioth.debian.org>; Source for isc-dhcp-client is src:isc-dhcp.

Reported by: Wouter Van Hemel <wouter-debian@publica.duodecim.org>

Date: Thu, 29 Sep 2011 13:48:02 UTC

Severity: normal

Found in version isc-dhcp/4.2.2-1

Fixed in version 4.2.2-2

Done: Andrew Pollock <apollock@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#643771; Package initscripts. (Thu, 29 Sep 2011 13:48:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Wouter Van Hemel <wouter-debian@publica.duodecim.org>:
New Bug report received and forwarded. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Thu, 29 Sep 2011 13:48:05 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Wouter Van Hemel <wouter-debian@publica.duodecim.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: initscripts: hostname is set to FQDN; /etc/hostname not read or hostname.sh not executed?
Date: Thu, 29 Sep 2011 16:45:56 +0300
Package: initscripts
Version: 2.88dsf-13.11
Severity: normal

Hello,

Since yesterday, `hostname` returns the FQDN and also $HOSTNAME is set to the FQDN.

/etc/hostname contains just the hostname (a single word) and is readable, so I assume /etc/init.d/hostname.sh somehow doesn't read /etc/hostname anymore.

Perhaps this is related to the /run switch? Either hostname.sh isn't executed or /etc/hostname isn't read.

/etc is on the / partition, as is /boot, so this is not a mount problem.

X behaved funnily as applications couldn't connect to the X server anymore due to the hostname changing – probably during an apt update, or perhaps some daemon crashed. While the problem appears minor, the consequences might be more serious, depending on what exactly is in /etc/hostname, /etc/hosts and friends.


Thanks for your time,

  Wouter

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.39-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=nl_BE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages initscripts depends on:
ii  coreutils       8.13-2       
ii  debianutils     4.0.2        
ii  libc6           2.13-21      
ii  lsb-base        3.2-28       
ii  mount           2.19.1-5     
ii  sysv-rc         2.88dsf-13.11
ii  sysvinit-utils  2.88dsf-13.11

Versions of packages initscripts recommends:
ii  e2fsprogs  1.42~WIP-2011-09-25-1
ii  psmisc     22.14-1              

initscripts suggests no packages.

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#643771; Package initscripts. (Thu, 29 Sep 2011 14:54:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Petter Reinholdtsen <pere@hungry.com>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Thu, 29 Sep 2011 14:54:03 GMT) Full text and rfc822 format available.

Message #10 received at 643771@bugs.debian.org (full text, mbox):

From: Petter Reinholdtsen <pere@hungry.com>
To: Wouter Van Hemel <wouter-debian@publica.duodecim.org>, 643771@bugs.debian.org
Subject: Re: Bug#643771: initscripts: hostname is set to FQDN; /etc/hostname not read or hostname.sh not executed?
Date: Thu, 29 Sep 2011 16:51:57 +0200
[Wouter Van Hemel]
> Hello,

Hi.

> Since yesterday, `hostname` returns the FQDN and also $HOSTNAME is set
> to the FQDN.

Did you just upgrade the initscripts package?  I would suspect changed
behaviour in /bin/hostname, or something setting the hostname before
/etc/init.d/hostname get a chance to execute.  Which boot system are you
using?

Happy hacking,
-- 
Petter Reinholdtsen




Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#643771; Package initscripts. (Fri, 30 Sep 2011 13:06:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Wouter Van Hemel <wouter-debian@publica.duodecim.org>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Fri, 30 Sep 2011 13:06:03 GMT) Full text and rfc822 format available.

Message #15 received at 643771@bugs.debian.org (full text, mbox):

From: Wouter Van Hemel <wouter-debian@publica.duodecim.org>
To: Petter Reinholdtsen <pere@hungry.com>
Cc: <643771@bugs.debian.org>
Subject: Re: Bug#643771: initscripts: hostname is set to FQDN; /etc/hostname not read or hostname.sh not executed?
Date: Fri, 30 Sep 2011 08:57:48 -0400
On Thu, 29 Sep 2011 16:51:57 +0200, Petter Reinholdtsen <pere@hungry.com>

wrote:

> [Wouter Van Hemel]

>> Hello,

> 

> Hi.

> 

>> Since yesterday, `hostname` returns the FQDN and also $HOSTNAME is set

>> to the FQDN.

> 

> Did you just upgrade the initscripts package?  I would suspect changed

> behaviour in /bin/hostname, or something setting the hostname before

> /etc/init.d/hostname get a chance to execute.  Which boot system are you

> using?

> 



I'm using the default boot system in Debian unstable, which should be the

dependency-based boot sequence.



I haven't changed anything at all on this machine for a long time – except

for daily upgrades from Debian unstable. I don't remember if there have

been any updates to the hostname or initscripts packages these last few

days; at least the directory times for

/usr/share/doc/{hostname,initscripts} are several months old.



However, the dhcp client seems to have been updated a few days ago:



/usr/share/doc/isc-dhcp-client/changelog.Debian.gz:



  * debian/dhclient-script.{linux,kfreebsd}: applied patch from Peter

Marschall

    to factor out the hostname setting to a separate function

  * debian/dhclient-script.{linux,kfreebsd}: applied patch from Peter

Marschall

    to harmonize the logic for setting the hostname (closes: #246155)





This makes a lot of sense, because my "hostname" configuration changed

quite randomly in the middle of the day... It could have been triggered by

a new dhcp lease.



The set_hostname() function in /sbin/dhclient-script seems to be

re-setting the hostname from the dhcp value, which is a FQDN...



I should reassign this. ;)





Thanks for your time!



  Wouter






Bug reassigned from package 'initscripts' to 'isc-dhcp-client'. Request was from Wouter Van Hemel <wouter-debian@publica.duodecim.org> to control@bugs.debian.org. (Fri, 30 Sep 2011 13:09:06 GMT) Full text and rfc822 format available.

Bug No longer marked as found in versions 2.88dsf-13.11. Request was from Wouter Van Hemel <wouter-debian@publica.duodecim.org> to control@bugs.debian.org. (Fri, 30 Sep 2011 13:09:07 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian ISC DHCP maintainers <pkg-dhcp-devel@lists.alioth.debian.org>:
Bug#643771; Package isc-dhcp-client. (Mon, 10 Oct 2011 11:36:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Wouter Van Hemel <wouter-debian@publica.duodecim.org>:
Extra info received and forwarded to list. Copy sent to Debian ISC DHCP maintainers <pkg-dhcp-devel@lists.alioth.debian.org>. (Mon, 10 Oct 2011 11:36:08 GMT) Full text and rfc822 format available.

Message #24 received at 643771@bugs.debian.org (full text, mbox):

From: Wouter Van Hemel <wouter-debian@publica.duodecim.org>
To: Debian Bug Tracking System <643771@bugs.debian.org>
Subject: isc-dhcp-client: host name should be set to non-fqdn [patch]
Date: Mon, 10 Oct 2011 14:32:46 +0300
[Message part 1 (text/plain, inline)]
Package: isc-dhcp-client
Version: 4.2.2-1
Followup-For: Bug #643771

Hello,

According to the Debian reference, the host name (as set by /etc/hostname) should be non-fqdn, i.e. a simple host name without domain name.

DHCP may contain pretty random host/domain names, and changing the host name on the machine might trigger a denial of service as services (including X) can't connect or spawn new processes anymore when a new DHCP packet arrives and the host name is changed while those services are already running.

Attached you find a simple patch that strips the domain name part of $new_host_name in /etc/dhclient-script to bring it in line with the Debian reference and user expectations. I'm not going to elaborate on the benefits and drawbacks of using the DHCP host name field; there are probably valid reasons either way and I'm not qualified enough to discuss or acknowledge all possible network configurations.


Regards,

  Wouter

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.39-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=nl_BE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages isc-dhcp-client depends on:
ii  debianutils      4.0.4     
ii  iproute          20110629-1
ii  isc-dhcp-common  4.2.2-1   
ii  libc6            2.13-21   

isc-dhcp-client recommends no packages.

Versions of packages isc-dhcp-client suggests:
pn  avahi-autoipd  <none>
pn  resolvconf     <none>

-- no debconf information
[dhclient-script-no_fqdn.patch (text/x-diff, attachment)]

Reply sent to Andrew Pollock <apollock@debian.org>:
You have taken responsibility. (Sun, 10 Jun 2012 21:15:22 GMT) Full text and rfc822 format available.

Notification sent to Wouter Van Hemel <wouter-debian@publica.duodecim.org>:
Bug acknowledged by developer. (Sun, 10 Jun 2012 21:15:23 GMT) Full text and rfc822 format available.

Message #29 received at 643771-done@bugs.debian.org (full text, mbox):

From: Andrew Pollock <apollock@debian.org>
To: Wouter Van Hemel <wouter-debian@publica.duodecim.org>, 643771-done@bugs.debian.org
Subject: Re: [pkg-dhcp-devel] Bug#643771: isc-dhcp-client: host name should be set to non-fqdn [patch]
Date: Sun, 10 Jun 2012 14:12:36 -0700
[Message part 1 (text/plain, inline)]
Version: 4.2.2-2

On Mon, Oct 10, 2011 at 02:32:46PM +0300, Wouter Van Hemel wrote:
> Package: isc-dhcp-client
> Version: 4.2.2-1
> Followup-For: Bug #643771
> 
> Hello,
> 
> According to the Debian reference, the host name (as set by /etc/hostname) should be non-fqdn, i.e. a simple host name without domain name.
> 
> DHCP may contain pretty random host/domain names, and changing the host name on the machine might trigger a denial of service as services (including X) can't connect or spawn new processes anymore when a new DHCP packet arrives and the host name is changed while those services are already running.
> 
> Attached you find a simple patch that strips the domain name part of $new_host_name in /etc/dhclient-script to bring it in line with the Debian reference and user expectations. I'm not going to elaborate on the benefits and drawbacks of using the DHCP host name field; there are probably valid reasons either way and I'm not qualified enough to discuss or acknowledge all possible network configurations.

This is a duplicate of #648676, which I fixed in 4.2.2-2

> 
> 
> Regards,
> 
>   Wouter
> 
> -- System Information:
> Debian Release: wheezy/sid
>   APT prefers unstable
>   APT policy: (500, 'unstable')
> Architecture: i386 (i686)
> 
> Kernel: Linux 2.6.39-2-686-pae (SMP w/2 CPU cores)
> Locale: LANG=C, LC_CTYPE=nl_BE.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/bash
> 
> Versions of packages isc-dhcp-client depends on:
> ii  debianutils      4.0.4     
> ii  iproute          20110629-1
> ii  isc-dhcp-common  4.2.2-1   
> ii  libc6            2.13-21   
> 
> isc-dhcp-client recommends no packages.
> 
> Versions of packages isc-dhcp-client suggests:
> pn  avahi-autoipd  <none>
> pn  resolvconf     <none>
> 
> -- no debconf information

> --- /sbin/dhclient-script	2011-09-27 09:58:38.000000000 +0300
> +++ ./dhclient-script	2011-10-10 14:06:58.289195825 +0300
> @@ -86,16 +86,18 @@
>  # set host name
>  set_hostname() {
>      local current_hostname
> +    local new_host_name_no_fqdn
>  
>      if [ -n "$new_host_name" ]; then
>          current_hostname=$(hostname)
> +        new_host_name_no_fqdn="${new_host_name%%.*}"
>  
>          # current host name is empty, '(none)' or 'localhost' or differs from new one from DHCP
>          if [ -z "$current_hostname" ] ||
>             [ "$current_hostname" = '(none)' ] ||
>             [ "$current_hostname" = 'localhost' ] ||
> -           [ "$new_host_name" != "$current_hostname" ]; then
> -            hostname "$new_host_name"
> +           [ "$new_host_name_no_fqdn" != "$current_hostname" ]; then
> +            hostname "$new_host_name_no_fqdn"
>          fi
>      fi
>  }

> _______________________________________________
> pkg-dhcp-devel mailing list
> pkg-dhcp-devel@lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-dhcp-devel

[signature.asc (application/pgp-signature, inline)]

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 09 Jul 2012 07:48:27 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 19 18:45:27 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.