Question

Hello I am trying to get a chef server up and running and have run into an interesting problem.

These are the contents of my /etc/hosts file:

127.0.0.1       localhost
127.0.1.1       SuperBeast
54.221.204.206  test
54.221.204.206  chef-server

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

If I just have the chef-server in there and ping it than I get a ping: unknown host chef-server. When I put the test in there than ping chef-server works but ping test will give me the unknown host error. I am using Ubuntu 12.04 and have no idea why this is. Is there any way I can get chef-server to work without having to put the test line in there?

ran hexdump hosts and got this

0000000 3231 2e37 2e30 2e30 0931 6f6c 6163 686c

0000010 736f 0a74 3231 2e37 2e30 2e31 0931 7553

0000020 6570 4272 6165 7473 0a0a 3435 322e 3132

0000030 322e 3430 322e 3630 2020 6863 6665 732d

0000040 7265 6576 0a72 230a 5420 6568 6620 6c6f

0000050 6f6c 6977 676e 6c20 6e69 7365 6120 6572

0000060 6420 7365 7269 6261 656c 6620 726f 4920

0000070 7650 2036 6163 6170 6c62 2065 6f68 7473

0000080 0a73 3a3a 2031 2020 2020 7069 2d36 6f6c

0000090 6163 686c 736f 2074 7069 2d36 6f6c 706f

00000a0 6162 6b63 660a 3065 3a30 303a 6920 3670

00000b0 6c2d 636f 6c61 656e 0a74 6666 3030 3a3a

00000c0 2030 7069 2d36 636d 7361 7074 6572 6966

00000d0 0a78 6666 3230 3a3a 2031 7069 2d36 6c61

00000e0 6e6c 646f 7365 660a 3066 3a32 323a 6920

00000f0 3670 612d 6c6c 6f72 7475 7265 0a73 000a

00000ff
Was it helpful?

Solution

hexdump the file /etc/hosts and makes sure there are no "weird" (i.e. not alpha-numeric, space, or newline 0x0A) characters just after SuperBeast and 54.221.204.206 as this can cause issues

A quicker fix it just insert a new line between the SuperBeast and the next line in the /etc/hosts

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top