RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1820540 - cloud-init package broken post 7.8 upgrade
Summary: cloud-init package broken post 7.8 upgrade
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cloud-init
Version: 7.8
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Eduardo Otubo
QA Contact: xiachen
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-03 10:18 UTC by Eduard Barrera
Modified: 2024-01-06 04:28 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-21 12:20:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Eduard Barrera 2020-04-03 10:18:05 UTC
Description of problem:

We upgraded a linux instance from 7.7 -> 7.8. The machine booted properly but hasn't run any cloud-init service. Having checked the systemd services, the target changed from multi-user.target -> cloud-init.target. 

I've checked the release notes but there is no mention of this change. Below is the content of one of the impacted services ::

[Unit]
Description=Apply the settings specified in cloud-config
After=network-online.target cloud-config.target
Wants=network-online.target cloud-config.target
ConditionPathExists=!/etc/cloud/cloud-init.disabled
ConditionKernelCommandLine=!cloud-init=disabled

[Service]
Type=oneshot
ExecStart=/usr/bin/cloud-init modules --mode=config
RemainAfterExit=yes
TimeoutSec=0

# Output needs to appear in instance console output
StandardOutput=journal+console

[Install]
WantedBy=cloud-init.target

When I replaced cloud-init.target with multi-user.target, enabled the service, the machine booted properly with cloud-init service. Below are the list of services impacted ::
cloud-init-local.service
cloud-init.service
cloud-config.service
cloud-final.service


Version-Release number of selected component (if applicable):
7.8 after upgrading from 7.7

How reproducible:
always

Steps to Reproduce:
1. upgrade from 7.7 yo 7.8
2.
3.

Actual results:
cloud-init is not executed at boot when bootinhg

Expected results:
cloud-init executed at boot

Additional info:

Comment 3 Eduardo Otubo 2020-04-03 13:16:12 UTC
This change was introduced by the commit:

commit 6954486d1318a3d1aa5bbcfcb119bcfcb73618bf
Author: Eduardo Otubo <otubo>
Date:   Fri Sep 6 12:12:11 2019 +0200

    Fix for network configuration not persisting after reboot
    
    RH-Author: Eduardo Otubo <otubo>
    Message-id: <20190906121211.23172-1-otubo>
    Patchwork-id: 90300
    O-Subject: [RHEL-7.8/RHEL-8.1.0 cloud-init PATCH] Fix for network configuration not persisting after reboot
    Bugzilla: 1593010
    RH-Acked-by: Mohammed Gamal <mgamal>
    RH-Acked-by: Miroslav Rezanina <mrezanin>
    
    The reasons the configuration does not persist after reboot includes
    different aspects and they're all fixed on this patch:
    
      1) The rpm package doesn't include the systemd-generator and
    ds-identify. The systemd-generator is called early in the boot process
    that calls ds-identify to check if there's any Data Source available in
    the current boot. In the current use case, the Data Source is removed
    from the VM on the second boot, this means cloud-init should disable
    itself in order to keep the configuration it did in the first boot.
    
      2) Even after adding those scripts, cloud-init was still being
    executed and the configurations were being lost. The reason for this is
    that the cloud-init systemd units had a wrong dependency
    
         WantedBy: multi-user.target
    
         Which would start them every time no matter the return of
    ds-identify. The fix is to replace the dependency by the systemd unit to
    cloud-init.target, which is the main cloud-init target enabled - or in
    this case, disabled by ds-identify. The file cloud-init.target was also
    missing on rpm package.
    
    After adding both scripts, the main cloud-init systemd target and
    adjusting the systemd dependencies the configuration persists after
    reboots and shutdowns.
    
    Signed-off-by: Eduardo Otubo <otubo>
    Signed-off-by: Miroslav Rezanina <mrezanin>


In the use case you're reporting, if you're doind a RHEL *upgrade* I assume this is not the first boot of your instance. If this is correct, cloud-init *should not* start as designed, it should start only on the first boot or if a DataSource is available. If your DataSource is available or this is indeed the first boot, then I think we got a corner case to work on. Please provide the logs, the complete scenario and the cloud-init version it's installed.

Thanks!

Comment 4 Andras Kovacs 2020-04-04 14:08:00 UTC
Dear Team,

I'm facing the same problem. It was working just fine on RHEL7.7 with WantedBy=multi-user.target.
I think it's related to this canonical bug:
https://bugs.launchpad.net/cloud-init/+bug/1771382
And to the previously mentioned non-persistent data problem:
https://access.redhat.com/errata/product/69/ver=/rhel---7/x86_64/RHBA-2020:1155

@Eduard Barrera
As a "not so pretty" workaround which works for me:
# mv /etc/systemd/system/cloud-init.target.wants/* /etc/systemd/system/multi-user.target.wants/

@Eduardo Otubo
Even if it works on the first run, there are modules in cloud-init what executes on every restart, like:
https://cloudinit.readthedocs.io/en/18.5/topics/modules.html#update-etc-hosts

Moreover, we should be able to re-trigger the first-run scenario via running cloud-init clean, or removing the /var/lib/cloud/data/status.json.
I know it's far from perfect, but since I'm building RedHat VM templates with Packer... the installation happens with a custom kickstart file, the customization on the first boot on a local hypervisor.
So the "real first boot" will be the second, after the installation.
From the kickstart I install and disable cloud-init's services / tried to disable it with touch /etc/cloud/cloud-init.disabled.
When the first boot happens, I install/modify the other necessary things and as a last step I enable cloud-init's services or remove the /etc/cloud/cloud-init.disabled or execute cloud-init clean.
At the end I have a full-blown ovf-format VM template.
Previously it was working fine.

For me cloud-init reports now:
# cat /run/cloud-init/cloud-init-generator.log 
/usr/lib/systemd/system-generators/cloud-init-generator normal=/run/systemd/generator early=/run/systemd/generator.early late=/run/systemd/generator.late
kernel command line (/proc/cmdline): BOOT_IMAGE=/vmlinuz-3.10.0-1127.el7.x86_64 root=UUID=7b921c59-425e-45a3-ba67-6c38386d6e33 ro elevator=noop transparent_hugepage=never spectre_v2=retpoline biosdevname=0 net.ifnames=0 LANG=en_US.UTF-8
kernel_cmdline found unset
etc_file found unset
default found enabled
checking for datasource
ds-identify rc=1
ds-identify _RET=notfound
cloud-init is enabled but no datasource found, disabling
already disabled: no change needed [no /run/systemd/generator.early/multi-user.target.wants/cloud-init.target]

When I switch to multiuser.target.wants as I mentioned previously, it works.

Best regards,
András Kovács

Comment 5 Andras Kovacs 2020-04-05 11:01:39 UTC
I gave it a try like including my cloud.cfg in the kickstart file (with heredoc format).
The config file is there, but "no datasource found"... like in my previous comment.
Moving to multi-user.target.wants it works.

Does it help if I open a customer support ticket with this bug in it?

Thank you!

Best regards,
András Kovács

Comment 6 Andras Kovacs 2020-04-06 09:44:46 UTC
Dear Team, 

Do I need to provide anything else?
I really hope I provided all the necessary info previously, but please, correct me if I'm wrong.

Thank you!

Best regards,
András Kovács

Comment 7 xiachen 2020-04-07 09:44:19 UTC
Test on OpenStack platform, could not reproduce the issue.

My test steps,
1. launch a instance with image RHEL-7.7-Server-x86_64-production
2. login and register the system
# subscription-manager register
# subscription-manager attach --auto
3. check 
# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.7 (Maipo)
# rpm -qa|grep cloud-init
cloud-init-18.5-3.el7.x86_64

# cd /etc/systemd/system
# ls -l
lrwxrwxrwx. 1 root root  ...  default.target -> /lib/systemd/system/multi-user.target

4. upgrade to rhel 7.8
#yum upgrade
5. check 
# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.8 (Maipo)
# rpm -qa|grep cloud-init
cloud-init-18.5-6.el7.x86_64

#cd /etc/systemd/system/
#ls -l
drwxr-xr-x. 2 root root 4096 Apr  7 03:53 multi-user.target.wants
drwxr-xr-x. 2 root root  119 Apr  7 03:53 cloud-init.target.wants
lrwxrwxrwx. 1 root root   37 Mar 10 06:40 default.target -> /lib/systemd/system/multi-user.target

6. check cloud-init 4 services(cloud-init-local, cloud-init, cloud-config, cloud-final), all are active.
7. clean and reboot
#cloud-init clean
#reboot
8. login and check cloud-init 4 services(cloud-init-local, cloud-init, cloud-config, cloud-final), all are active.
# cat /run/cloud-init/cloud-init-generator.log 
/usr/lib/systemd/system-generators/cloud-init-generator normal=/run/systemd/generator early=/run/systemd/generator.early late=/run/systemd/generator.late
kernel command line (/proc/cmdline): BOOT_IMAGE=/boot/vmlinuz-3.10.0-1127.el7.x86_64 root=UUID=3425ddda-aed9-4a29-886c-3bd6b776b539 ro console=tty0 console=ttyS0,115200n8 no_timer_check net.ifnames=0 crashkernel=auto LANG=en_US.UTF-8
kernel_cmdline found unset
etc_file found unset
default found enabled
checking for datasource
ds-identify rc=0
ds-identify _RET=found
enabled via /run/systemd/generator.early/multi-user.target.wants/cloud-init.target -> /lib/systemd/system/cloud-init.target


Hi Andras,
Did I miss any key step to reproduce the issue?

Comment 8 Eduardo Otubo 2020-04-07 11:37:52 UTC
(In reply to Andras Kovacs from comment #6)
> Dear Team, 
> 
> Do I need to provide anything else?
> I really hope I provided all the necessary info previously, but please,
> correct me if I'm wrong.
> 
> Thank you!
> 
> Best regards,
> András Kovács

Yes I think you provided all info I needed. I'll work on this issue.
Thanks for the report!

Comment 10 xiachen 2020-04-14 01:40:04 UTC
(In reply to Eduardo Otubo from comment #8)
> (In reply to Andras Kovacs from comment #6)
> > Dear Team, 
> > 
> > Do I need to provide anything else?
> > I really hope I provided all the necessary info previously, but please,
> > correct me if I'm wrong.
> > 
> > Thank you!
> > 
> > Best regards,
> > András Kovács
> 
> Yes I think you provided all info I needed. I'll work on this issue.
> Thanks for the report!

Hi Eduardo,

Do you have any suggestion about how to reproduce this issue? Did I miss anything in my steps Comment #7 ?

Comment 11 Eduardo Otubo 2020-04-14 09:30:38 UTC
(In reply to xiachen from comment #10)
> (In reply to Eduardo Otubo from comment #8)
> > (In reply to Andras Kovacs from comment #6)
> > > Dear Team, 
> > > 
> > > Do I need to provide anything else?
> > > I really hope I provided all the necessary info previously, but please,
> > > correct me if I'm wrong.
> > > 
> > > Thank you!
> > > 
> > > Best regards,
> > > András Kovács
> > 
> > Yes I think you provided all info I needed. I'll work on this issue.
> > Thanks for the report!
> 
> Hi Eduardo,
> 
> Do you have any suggestion about how to reproduce this issue? Did I miss
> anything in my steps Comment #7 ?

I don't have more info on how to reproduce the issue.

@Eduard Barrera,  Andras Kovacs : in which environment did you found this issue?

Comment 16 Red Hat Bugzilla 2024-01-06 04:28:48 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days


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