Comment 7 for bug 596993

Revision history for this message
Gerry Reno (greno-verizon) wrote :

Running the following commands appears to correctly set all the forms of hostname on my Lucid ec2 instance:

echo "$(curl -s http://169.254.169.254/latest/meta-data/local-hostname)" | sed 's:\..*$::' > /etc/hostname

/sbin/sysctl -w kernel.hostname="$(curl -s http://169.254.169.254/latest/meta-data/local-hostname | sed 's:\..*$::')"

logout/login shell

root@ip-10-XXX-181-59:~# uname -n
ip-10-XXX-181-59
root@ip-10-XXX-181-59:~# hostname -s
ip-10-XXX-181-59
root@ip-10-XXX-181-59:~# hostname -d
ec2.internal
root@ip-10-XXX-181-59:~# hostname -f
ip-10-XXX-181-59.ec2.internal
root@ip-10-XXX-181-59:~# hostname
ip-10-XXX-181-59
root@ip-10-XXX-181-59:~# echo $HOSTNAME
ip-10-XXX-181-59
root@ip-10-XXX-181-59:~# cat /etc/hostname
ip-10-XXX-181-59
root@ip-10-XXX-181-59:~# /sbin/sysctl -n kernel.hostname
ip-10-XXX-181-59