Uploaded image for project: 'OpenVZ'
  1. OpenVZ
  2. OVZ-4224

hostname - FQDN or not

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Fix Version/s: OpenVZ-legacy
    • Component/s: Containers::Userspace
    • Security Level: Public
    • Environment:
      Operating System: All
      Platform: All

      Description

      According to hosts(5), the first word after the IP address in an /etc/hosts entry should be an FQDN.

      On the other hand. according to hostname(1), the contents of /etc/hostname on Debian systems should NOT be an FQDN (but just the part before the dot).

      However they are both taken from the --hostname parameter of vzctl.

      A fix for that would be simple, something like this:

      --- a/etc/dists/scripts/debian-set_hostname.sh
      +++ b/etc/dists/scripts/debian-set_hostname.sh
      @@ -24,7 +24,7 @@ function set_hostname()
              local hostname=$2
       
              [ -z "${hostname}" ] && return 0
      - echo "${hostname}" > ${cfgfile}
      + echo "${hostname%%.*}" > ${cfgfile}
              hostname ${hostname}
       }

      That strips the domain when creating /etc/hostname.
      However this would probably need to be tweaked a little unless the fix for #1035 is reverted. Therefore I'm setting this bug to depend on 1035.

      If I'm reading the source correctly, then the only other place that --hostname value is used is vzlist, which should not care much whether it lists a simple hostname or the whole FQDN.

      Also, while I'm only speaking for Debian systems, it's possible that other distro's scripts have a similar problem.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              igor Igor Sukhih
              Reporter:
              marcin@owsiany.pl Marcin Owsiany
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: