Bug 1565746 - Hostname not set by cloud-init on Red Hat Enterprise Linux 7.5 KVM Guest Image
Summary: Hostname not set by cloud-init on Red Hat Enterprise Linux 7.5 KVM Guest Image
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cloud-init
Version: 7.5
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Ryan McCabe
QA Contact: xiachen
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-10 16:27 UTC by Nick Curry
Modified: 2020-05-09 08:30 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-09 08:30:33 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Nick Curry 2018-04-10 16:27:54 UTC
Description of problem:
The hostname of the rhel-server-7.5-x86_64-kvm.qcow2 guest image is not set properly by cloud-init when using NoCloud cloud-init data source.

Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux Server release 7.5 (Maipo)
cloud-init-0.7.9-24.el7.x86_64

How reproducible:
Consisently

Steps to Reproduce:
1. Download Red Hat Enterprise Linux 7.5 KVM Guest Image
2. Create cloud-init files (user-data, meta-data)
3. Create cidata.iso from user-data/meta-data
4. Create KVM guest from rhel-server-7.5-x86_64-kvm.qcow2 and cidata.iso
5. Log in and check hostname

Actual results:
Virtual machine has hostname localhost

Expected results:
Virtual machine has hostname set in meta-data

Additional info:
cloud-init install logs

[   14.225839] cloud-init[557]: Cloud-init v. 0.7.9 running 'init-local' at Tue, 10 Apr 2018 16:24:03 +0000. Up 14.19 seconds.
[   14.655545] random: crng init done
[  OK  ] Started Initial cloud-init job (pre-networking).
[  OK  ] Reached target Network (Pre).
         Starting Network Manager...
         Starting Hostname Service...
[  OK  ] Started Hostname Service.
[  OK  ] Started Network Manager.
         Starting Network Manager Script Dispatcher Service...
         Starting Network Manager Wait Online...
[  OK  ] Started Network Manager Script Dispatcher Service.
[   15.094578] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[  OK  ] Started Network Manager Wait Online.
         Starting LSB: Bring up/down networking...
[  OK  ] Started LSB: Bring up/down networking.
         Starting Initial cloud-init job (metadata service crawler)...
[  OK  ] Reached target Network.
         Starting Postfix Mail Transport Agent...
         Starting Dynamic System Tuning Daemon...
[  OK  ] Started Dynamic System Tuning Daemon.
[   19.185066] cloud-init[826]: Cloud-init v. 0.7.9 running 'init' at Tue, 10 Apr 2018 16:24:08 +0000. Up 19.15 seconds.
[   19.267279] cloud-init[826]: ci-info: ++++++++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++++++
[   19.269644] cloud-init[826]: ci-info: +--------+------+-----------------+---------------+-------+-------------------+
[   19.274989] cloud-init[826]: ci-info: | Device |  Up  |     Address     |      Mask     | Scope |     Hw-Address    |
[   19.278083] cloud-init[826]: ci-info: +--------+------+-----------------+---------------+-------+-------------------+
[   19.290851] cloud-init[826]: ci-info: |  lo:   | True |    127.0.0.1    |   255.0.0.0   |   .   |         .         |
[   19.292705] cloud-init[826]: ci-info: |  lo:   | True |        .        |       .       |   d   |         .         |
[   19.294491] cloud-init[826]: ci-info: | eth0:  | True | 192.168.122.146 | 255.255.255.0 |   .   | 52:54:00:e9:14:2e |
[   19.296305] cloud-init[826]: ci-info: | eth0:  | True |        .        |       .       |   d   | 52:54:00:e9:14:2e |
[   19.297997] cloud-init[826]: ci-info: +--------+------+-----------------+---------------+-------+-------------------+
[   19.299727] cloud-init[826]: ci-info: +++++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++++
[   19.322914] cloud-init[826]: ci-info: +-------+---------------+---------------+---------------+-----------+-------+
[   19.324990] cloud-init[826]: ci-info: | Route |  Destination  |    Gateway    |    Genmask    | Interface | Flags |
[   19.327533] cloud-init[826]: ci-info: +-------+---------------+---------------+---------------+-----------+-------+
[   19.329221] cloud-init[826]: ci-info: |   0   |    0.0.0.0    | 192.168.122.1 |    0.0.0.0    |    eth0   |   UG  |
[   19.344147] cloud-init[826]: ci-info: |   1   | 192.168.122.0 |    0.0.0.0    | 255.255.255.0 |    eth0   |   U   |
[   19.346390] cloud-init[826]: ci-info: +-------+---------------+---------------+---------------+-----------+-------+
[  OK  ] Started Postfix Mail Transport Agent.
[  OK  ] Started Initial cloud-init job (metadata service crawler).
         Starting Permit User Sessions...
[  OK  ] Reached target Cloud-config availability.
         Starting OpenSSH Server Key Generation...
[  OK  ] Reached target Network is Online.
         Starting Apply the settings specified in cloud-config...
         Starting Notify NFS peers of a restart...
         Starting Crash recovery kernel arming...
         Starting System Logging Service...
         Starting LSB: Starts the Spacewalk Daemon...
[  OK  ] Started Permit User Sessions.
[  OK  ] Started Notify NFS peers of a restart.
[  OK  ] Started Serial Getty on ttyS0.
         Starting Serial Getty on ttyS0...
[  OK  ] Started Command Scheduler.
         Starting Command Scheduler...
[  OK  ] Started Getty on tty1.
         Starting Getty on tty1...
[  OK  ] Reached target Login Prompts.
[  OK  ] Started System Logging Service.
[  OK  ] Started LSB: Starts the Spacewalk Daemon.
[   21.191628] cloud-init[1030]: Cloud-init v. 0.7.9 running 'modules:config' at Tue, 10 Apr 2018 16:24:10 +0000. Up 20.99 seconds.
[  OK  ] Started OpenSSH Server Key Generation.
         Starting OpenSSH server daemon...
[  OK  ] Started OpenSSH server daemon.
         Stopping OpenSSH server daemon...
[  OK  ] Stopped OpenSSH server daemon.
[  OK  ] Stopped OpenSSH Server Key Generation.
         Stopping OpenSSH Server Key Generation...
         Starting OpenSSH server daemon...
[  OK  ] Started OpenSSH server daemon.
[  OK  ] Started Apply the settings specified in cloud-config.
         Starting Execute cloud user/final scripts...
[   21.740263] cloud-init[1149]: Cloud-init v. 0.7.9 running 'modules:final' at Tue, 10 Apr 2018 16:24:11 +0000. Up 21.67 seconds.
ci-info: ++++++++++++Authorized keys from /home/ncc/.ssh/authorized_keys for user ncc+++++++++++++
ci-info: +---------+-------------------------------------------------+---------+-----------------+
ci-info: | Keytype |                Fingerprint (md5)                | Options |     Comment     |
ci-info: +---------+-------------------------------------------------+---------+-----------------+
ci-info: | ssh-rsa | 9c:57:8d:c8:32:d7:3d:86:a8:e8:02:eb:47:7d:82:04 |    -    | ncc@nixtopt460s |
ci-info: +---------+-------------------------------------------------+---------+-----------------+
ec2: 
ec2: #############################################################
ec2: -----BEGIN SSH HOST KEY FINGERPRINTS-----
...
ec2: -----END SSH HOST KEY FINGERPRINTS-----
ec2: #############################################################
-----BEGIN SSH HOST KEY KEYS-----
...
-----END SSH HOST KEY KEYS-----
[   21.841077] cloud-init[1149]: Cloud-init v. 0.7.9 finished at Tue, 10 Apr 2018 16:24:11 +0000. Datasource DataSourceNoCloud [seed=/dev/sr0][dsmode=net].  Up 21.83 seconds
[  OK  ] Started Execute cloud user/final scripts.
[  OK  ] Reached target Multi-User System.
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Started Update UTMP about System Runlevel Changes.

Red Hat Enterprise Linux Server 7.5 (Maipo)
Kernel 3.10.0-862.el7.x86_64 on an x86_64

Comment 2 Nick Curry 2018-04-10 16:43:19 UTC
Using 

local-hostname instead of hostname in user-data fixed the issue

Comment 3 xiachen 2020-05-09 08:30:33 UTC
According cloud-init doc, https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html
for NoCloud data source, the permitted key is h or local-hostname.
so using local-hostname instead of hostname in user-data fixed the issue.

Close this bug as NOTABUG.


Note You need to log in before you can comment on or make changes to this bug.