when /etc/hostname is empty or missing 'localhost' not properly set as the hostname

Bug #84023 reported by Ricardo Sanchez
4
Affects Status Importance Assigned to Milestone
sysvinit (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

If the file /etc/hostaname is empty or missing, the hostname is not properly set. This causes problems with the sudo version present in 6.06 (error message: sudo: unable to lookup hola via gethostbyname()). I think the sudo present in 6.10 fixed this.

Anyway, to fix the problem to the root, the file /etc/init.d/hostname.sh has to be modified, and the following lime must be added.

root@localhost:/etc/init.d# diff hostname.default.sh hostname.sh -c

*** hostname.default.sh 2007-02-08 17:38:31.000000000 +0100
--- hostname.sh 2007-02-08 17:23:36.000000000 +0100
***************
*** 23,28 ****
--- 23,29 ----

        # And set it to 'localhost' if no setting was found
        [ -z "$HOSTNAME" ] && HOSTNAME=localhost
+ [ "$HOSTNAME" == "(none)" ] && HOSTNAME=localhost

        [ "$VERBOSE" != no ] && log_action_begin_msg "Setting hostname '$HOSTNAME'"
        hostname "$HOSTNAME"

Revision history for this message
Oleksij Rempel (olerem) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. You reported this bug a while ago and there hasn't been any activity in it recently. We were wondering is this still an issue for you? If so, please reopen the bug. Thanks in advance.

Revision history for this message
Ricardo Sanchez (agentriot) wrote :

Reopened it.

Revision history for this message
Oleksij Rempel (olerem) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This bug did not have a package associated with it, which is important for ensuring that it gets looked at by the proper developers. You can learn more about finding the right package at [WWW] https://wiki.ubuntu.com/Bugs/FindRightPackage. I have classified this bug as a bug in sysvinit.

Revision history for this message
Oleksij Rempel (olerem) wrote :

1. Please include the output of the command "uname -a" in your next response. It should be one, long line of text which includes the exact kernel version you're running, as well as the CPU architecture.

2. Please run the command "dpkg -l | grep initscripts" and post the result to this bug report.

Revision history for this message
Ricardo Sanchez (agentriot) wrote :

$ uname -a
Linux heura 2.6.15-29-amd64-server #1 SMP Wed Aug 29 14:03:12 UTC 2007 x86_64 GNU/Linux
$ dpkg -l | grep initscripts
ii initscripts 2.86.ds1-6ubuntu32 Standard scripts needed for booting and shut

Oleksij Rempel (olerem)
Changed in sysvinit:
status: Incomplete → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.