Bug 1974262 - [Azure] cloud-init failed on Fedora34
Summary: [Azure] cloud-init failed on Fedora34
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: cloud-init
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Neal Gompa
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-21 08:35 UTC by Yuxin Sun
Modified: 2022-06-08 06:29 UTC (History)
14 users (show)

Fixed In Version:
Clone Of:
: 2032524 (view as bug list)
Environment:
Last Closed: 2022-06-08 06:29:57 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
cloud-init.log (530.99 KB, text/plain)
2021-06-21 08:35 UTC, Yuxin Sun
no flags Details

Description Yuxin Sun 2021-06-21 08:35:04 UTC
Created attachment 1792621 [details]
cloud-init.log

Description of problem:
Start a Fedora34 from Azure Marketplace. cloud-init service is failed:
2021-04-20 03:33:11,917 - util.py[WARNING]: Getting data from <class 'cloudinit.sources.DataSourceAzure.DataSourceAzure'> failed

Version-Release number of selected components (if applicable):
cloud-init-20.4-2.fc34.noarch

How reproducible:
100%

Steps to Reproduce:
1. Create a Fedora 34 VM ("urn": "tunnelbiz:fedora:fedoraupdate:34.0.1") on Azure
2. Login and check cloud-init service status

Actual results:
[root@walafedora ~]# systemctl status cloud-init
× cloud-init.service - Initial cloud-init job (metadata service crawler)
     Loaded: loaded (/usr/lib/systemd/system/cloud-init.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Mon 2021-06-21 14:53:56 +08; 1h 27min ago
    Process: 709 ExecStart=/usr/bin/cloud-init init (code=exited, status=1/FAILURE)
   Main PID: 709 (code=exited, status=1/FAILURE)
        CPU: 535ms

Jun 21 14:53:56 walafedora cloud-init[806]: ci-info: +-------+-------------+---------+-----------+-------+
Jun 21 14:53:56 walafedora cloud-init[806]: ci-info: | Route | Destination | Gateway | Interface | Flags |
Jun 21 14:53:56 walafedora cloud-init[806]: ci-info: +-------+-------------+---------+-----------+-------+
Jun 21 14:53:56 walafedora cloud-init[806]: ci-info: |   2   |  multicast  |    ::   |    eth0   |   U   |
Jun 21 14:53:56 walafedora cloud-init[806]: ci-info: +-------+-------------+---------+-----------+-------+
Jun 21 14:53:56 walafedora cloud-init[806]: 2021-06-21 06:53:56,163 - util.py[WARNING]: Getting data from <class 'cloudinit.sources.DataSourceNone.DataSourceNone'> failed
Jun 21 14:53:56 walafedora cloud-init[806]: 2021-06-21 06:53:56,174 - util.py[WARNING]: No instance datasource found! Likely bad things to come!
Jun 21 14:53:56 walafedora systemd[1]: cloud-init.service: Main process exited, code=exited, status=1/FAILURE
Jun 21 14:53:56 walafedora systemd[1]: cloud-init.service: Failed with result 'exit-code'.
Jun 21 14:53:56 walafedora systemd[1]: Failed to start Initial cloud-init job (metadata service crawler).

/var/log/cloud-init.log:
2021-04-20 03:33:11,916 - handlers.py[DEBUG]: start: init-local/search-Azure: searching for local data from DataSourceAzure
2021-04-20 03:33:11,916 - __init__.py[DEBUG]: Seeing if we can get any data from <class 'cloudinit.sources.DataSourceAzure.DataSourceAzure'>
2021-04-20 03:33:11,917 - handlers.py[DEBUG]: finish: init-local/search-Azure: FAIL: no local data found from DataSourceAzure
2021-04-20 03:33:11,917 - util.py[WARNING]: Getting data from <class 'cloudinit.sources.DataSourceAzure.DataSourceAzure'> failed
2021-04-20 03:33:11,917 - util.py[DEBUG]: Getting data from <class 'cloudinit.sources.DataSourceAzure.DataSourceAzure'> failed
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/cloudinit/sources/__init__.py", line 759, in find_source
    s = cls(sys_cfg, distro, paths)
  File "/usr/lib/python3.9/site-packages/cloudinit/sources/DataSourceAzure.py", line 292, in __init__
    sources.DataSource.__init__(self, sys_cfg, distro, paths)
  File "/usr/lib/python3.9/site-packages/cloudinit/sources/__init__.py", line 211, in __init__
    self.ds_cfg = util.get_cfg_by_path(
  File "/usr/lib/python3.9/site-packages/cloudinit/util.py", line 735, in get_cfg_by_path
    if tok not in cur:
TypeError: argument of type 'NoneType' is not iterable
2021-04-20 03:33:11,922 - main.py[DEBUG]: No local datasource found

Expected results: 
No error in cloud-init

Additional info:

Comment 2 Dusty Mabe 2021-06-21 13:41:37 UTC
(In reply to Yuxin Sun from comment #0)
> Created attachment 1792621 [details]
> cloud-init.log
> 
> Description of problem:
> Start a Fedora34 from Azure Marketplace. cloud-init service is failed:

I don't know of any official Fedora images that we upload to Azure. 
Not sure if it's the same content we produce in our official images
at https://alt.fedoraproject.org/cloud/ 

You might try uploading that image to see if you get any different
results.

Comment 15 François Rigault 2021-11-04 15:52:06 UTC
also fails against AzureStack,  Fedora-Cloud-Base-35-1.2.x86_64.qcow2 (same with 34, so not a regression)

[   38.793452] cloud-init[651]: 2021-11-04 15:13:43,593 - azure.py[WARNING]: Error communicating with Azure fabric; You may experience connectivity issues: Unexpected error while running command.
[   38.842623] cloud-init[651]: Command: ['opesl', 'req', '-x509', '-nodes', '-subj', '/CN=LinuxTransport', '-days', '32768', '-newkey', 'rsa:2048', '-keyout', 'TransportPrivate.pem', '-out', 'TransportCert.pem']
[   38.896366] cloud-init[651]: Exit code: -
[   38.906487] cloud-init[651]: Reason: [Errno 2] No such file or directory: b'openssl'
[   38.928738] cloud-init[651]: Stdout: -
[   38.938581] cloud-init[651]: Stderr: -
[   39.178793] cloud-init[651]: 2021-11-04 15:13:44,646 - util.py[WARNING]: Failed partitioning operation
[   39.209486] cloud-init[651]: Error running partition command on /dev/sdb
[   39.231286] cloud-init[651]: 'NoneType' object has no attribute 'encode'
[   43.187537] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none.

no ssh key is installed and the system is unusable.


cloud-init azure.py depends on openssl but the dependency is not there.
Workaround: virt-customize --install openssl -a Fedora-Cloud-Base-35-1.2.x86_64.qcow2
make it work.
(there is still a broken service:
Nov 04 15:48:15 fedora systemd[1]: Starting Rebuild Dynamic Linker Cache...                                                                                                                                                                           
Nov 04 15:48:17 fedora ldconfig[618]: /sbin/ldconfig: Renaming of /etc/ld.so.cache~ to /etc/ld.so.cache failed: Permission denied 
but at least ssh is working)

Looks like the cloud image does not work on Azure :/

Comment 16 François Rigault 2021-11-04 16:17:46 UTC
also need the gdisk package for the partitioning issue. With both packages cloud-init seems to work as expected.


virt-customize --install gdisk --install openssl -a Fedora-Cloud-Base-35-1.2.x86_64.qcow2

Comment 17 Neal Gompa 2021-12-14 15:52:09 UTC
The fix here would be to add "gdisk" and "openssl" as required runtime dependencies for cloud-init.

Comment 18 Neal Gompa 2021-12-14 15:59:24 UTC
PR proposed: https://src.fedoraproject.org/rpms/cloud-init/pull-request/23

Comment 19 François Rigault 2021-12-15 09:00:22 UTC
https://pagure.io/fedora-kickstarts/pull-request/849

should be reverted if you add these packages as cloud-init dependencies

Comment 20 Neal Gompa 2021-12-15 09:05:45 UTC
(In reply to François Rigault from comment #19)
> https://pagure.io/fedora-kickstarts/pull-request/849
> 
> should be reverted if you add these packages as cloud-init dependencies

Yes, I will revert that PR.

Comment 21 Neal Gompa 2021-12-15 14:19:32 UTC
PR of revert proposed: https://pagure.io/fedora-kickstarts/pull-request/855

Comment 22 Neal Gompa 2021-12-15 16:02:59 UTC
cloud-init-21.3-4.fc36 built in Rawhide: https://koji.fedoraproject.org/koji/buildinfo?buildID=1867210

Kickstarts have been updated for upcoming Rawhide builds.

François, Yuxin: can you please test tomorrow's Rawhide cloud image compose to see if it solves the issue?

Comment 23 François Rigault 2021-12-15 23:04:14 UTC
I gave a try today with Fedora-Cloud-Base-Rawhide-20211215.n.0.x86_64.qcow2 (release after you made that comment)
cloud-init is working... however ssh authentication is not (authorized_keys, setting user, installing packages, running custom commands seem fine)

I think it could be linked with https://src.fedoraproject.org/rpms/pam/c/ff21ecd19213fce0570d448831d21f66db6abc2c?branch=rawhide
(is there a authselect package to add?) I can give a second try tomorrow.

Dec 15 21:33:04 fedora2 sshd[1125]: PAM _pam_load_conf_file: unable to open config for password-auth
Dec 15 21:33:04 fedora2 sshd[1125]: PAM _pam_load_conf_file: unable to open config for postlogin
Dec 15 21:33:04 fedora2 sshd[1125]: PAM _pam_load_conf_file: unable to open config for password-auth
Dec 15 21:33:04 fedora2 sshd[1125]: PAM _pam_load_conf_file: unable to open config for password-auth
Dec 15 21:33:04 fedora2 sshd[1125]: PAM _pam_load_conf_file: unable to open config for password-auth
Dec 15 21:33:04 fedora2 sshd[1125]: PAM _pam_load_conf_file: unable to open config for postlogin
Dec 15 21:33:04 fedora2 audit[1125]: USER_AUTH pid=1125 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=pubkey acct="azureuser" exe="/usr/sbin/sshd" hostname=? addr=10.1.0.4 terminal=ssh res=failed'
Dec 15 21:33:04 fedora2 audit[1125]: USER_AUTH pid=1125 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=pubkey_auth grantors=auth-key acct="azureuser" exe="/usr/sbin/sshd" hostname=? addr=10.1.0.4 terminal=? res=success'
Dec 15 21:33:04 fedora2 audit[1125]: CRYPTO_KEY_USER pid=1125 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=negotiate kind=auth-key fp=SHA256:23:c2:50:ff:a3:2b:e5:68:db:3d:f6:5d:d0:f2:67:c4:10:b3:8e:64:3c:85:37:c9:0a:de:b7:66:f6:8f:bb:de exe="/usr/sbin/sshd" hostname=? addr=10.1.0.4 terminal=? res=success'
Dec 15 21:33:04 fedora2 audit[1125]: USER_ACCT pid=1125 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=? acct="azureuser" exe="/usr/sbin/sshd" hostname=10.1.0.4 addr=10.1.0.4 terminal=ssh res=failed'
Dec 15 21:33:04 fedora2 audit[1125]: USER_AUTH pid=1125 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=pubkey acct="azureuser" exe="/usr/sbin/sshd" hostname=? addr=10.1.0.4 terminal=ssh res=failed'
Dec 15 21:33:04 fedora2 audit[1125]: CRYPTO_KEY_USER pid=1125 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=destroy kind=server fp=SHA256:f2:fe:b6:15:46:07:cd:42:d2:29:27:b8:8e:67:10:70:c9:0d:0d:b3:b3:e1:cd:35:5d:83:e6:5c:74:77:82:18 direction=? spid=1126 suid=74  exe="/usr/sbin/sshd" hostname=? addr=? terminal=? res=success'
Dec 15 21:33:04 fedora2 audit[1125]: CRYPTO_KEY_USER pid=1125 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=destroy kind=session fp=? direction=both spid=1126 suid=74 rport=46220 laddr=10.1.0.6 lport=22  exe="/usr/sbin/sshd" hostname=? addr=10.1.0.4 terminal=? res=success'
Dec 15 21:33:04 fedora2 sshd[1125]: fatal: Access denied for user azureuser by PAM account configuration [preauth]

Comment 24 François Rigault 2021-12-16 00:15:19 UTC
so it works with

    runcmd:
    - authselect select minimal --force

I note that cloud-init runs twice.

Comment 25 François Rigault 2021-12-17 19:42:34 UTC
.. and it also works (tested on AzureStack) with 20211216.n.0 which contains your patch.

rpm -q cloud-init --changelog | head
* Wed Dec 15 2021 Neal Gompa <ngompa> - 21.3-4
- Add gdisk and openssl deps to fix UEFI / Azure initialization [bz#1974262]

Comment 26 Yuxin Sun 2021-12-28 02:55:30 UTC
Thanks for François's help! As I understand that currently no AI for me so remove my needinfo request.

Comment 27 Ben Cotton 2022-05-12 16:57:01 UTC
This message is a reminder that Fedora Linux 34 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '34'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 34 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 28 Ben Cotton 2022-06-08 06:29:57 UTC
Fedora Linux 34 entered end-of-life (EOL) status on 2022-06-07.

Fedora Linux 34 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release.

Thank you for reporting this bug and we are sorry it could not be fixed.


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