[Pkg-sysvinit-devel] Bug#513852: Bug#513852: /etc/init.d/hostname.sh: Does not set hostname during bootup
sam at robots.org.uk
Sun Feb 1 22:56:33 UTC 2009
On Sun, 2009-02-01 at 21:06 +0100, Petter Reinholdtsen wrote:
> [Sam Morris]
> > The symlink at '/etc/rcS.d/S02hostname.sh' is present and points to
> > the script in /etc/init.d.
> I am not aware of any way this script can fail. Are you sure there
> isn't some other program setting the incorrect hostname during boot,
> after hostname.sh?
Indeed, I changed the init script to print the value of the hostname
after it had finished and it was correct. So something is changing it
back--but I have no idea what.
> Can you provide the output from these commands:
> ls -l /etc/hostname
-rw-r--r-- 1 root root 9 2008-04-09 20:15 /etc/hostname
> cat /etc/hostname
> cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
> grep hostname /etc/init.d/*
/etc/init.d/bootmisc.sh:# Required-Start: hostname $remote_fs
/etc/init.d/checkroot.sh:# Required-Start: mountdevsubfs hostname
/etc/init.d/hostname.sh:# Provides: hostname
/etc/init.d/hostname.sh:# Short-Description: Set hostname based on /etc/hostname
/etc/init.d/hostname.sh:# Description: Read the machines hostname from /etc/hostname, and
/etc/init.d/hostname.sh:# /etc/hostname is empty, the current kernel value
/etc/init.d/hostname.sh:# for hostname is used. If the kernel value is
/etc/init.d/hostname.sh: [ -f /etc/hostname ] && HOSTNAME="$(cat /etc/hostname)"
/etc/init.d/hostname.sh: # Keep current name if /etc/hostname is missing.
/etc/init.d/hostname.sh: [ -z "$HOSTNAME" ] && HOSTNAME="$(hostname)"
/etc/init.d/hostname.sh: [ "$VERBOSE" != no ] && log_action_begin_msg "Setting hostname to '$HOSTNAME'"
/etc/init.d/hostname.sh: hostname "$HOSTNAME"
/etc/init.d/hostname.sh: echo "Usage: hostname.sh [start|stop]" >&2
> Happy hacking,
Sam Morris <sam at robots.org.uk>
More information about the Pkg-sysvinit-devel