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 1772505 - [RHEL7] swapon fails with "swapfile has holes" when created on a xfs filesystem by cloud-init
Summary: [RHEL7] swapon fails with "swapfile has holes" when created on a xfs filesyst...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cloud-init
Version: 7.7
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Eduardo Otubo
QA Contact: Huijuan Zhao
Jiri Herrmann
URL:
Whiteboard:
Depends On:
Blocks: 1794664 1797441 1801093 1801094
TreeView+ depends on / blocked
 
Reported: 2019-11-14 14:15 UTC by Teoman ONAY
Modified: 2023-12-15 16:56 UTC (History)
13 users (show)

Fixed In Version: cloud-init-19.4-5.el7
Doc Type: Bug Fix
Doc Text:
.Using `cloud-init` to create virtual machines with XFS and swap now works correctly Previously, using the `cloud-init` utility failed when creating a virtual machine (VM) with an XFS root file system and an enabled swap partition. In addition, the following error message was logged: `kernel: swapon: swapfile has holes` This update fixes the underlying code, which prevents the problem from occurring.
Clone Of:
: 1794664 1801093 1801094 (view as bug list)
Environment:
Last Closed: 2020-09-29 19:48:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2020:3898 0 None None None 2020-09-29 19:50:43 UTC

Comment 4 Eduardo Otubo 2019-11-18 13:21:58 UTC
This is the rhel7 package with the branch[0] applied:
http://people.redhat.com/~eterrell/cloud-init/1772505/

If this package fixes the issue, we'll still need to wait for it to be merged upstream and only then I'll be doing the backport.

Comment 6 Eduardo Otubo 2019-11-29 11:09:03 UTC
The mentioned pull-request[0] is almost one year old now, without any activities or updates.
I rebased the code, and updated the patche for the new code base on this new pull-request[1]. Still working on the tests as well.
As soon as it's merged I'll backport the patch and update this BZ.

[0] https://code.launchpad.net/~adobrawy/cloud-init/+git/cloud-init/+merge/354680
[1] https://github.com/canonical/cloud-init/pull/70

Comment 7 Francisco Peralta 2019-12-04 12:32:01 UTC
(In reply to Eduardo Otubo from comment #6)

Thank you very much Eduardo. Is it now something I can tell my customer that it's realistic to get in a fixpatch of RHEL 7.7 or how do you see it?

Kind Regards,
 Cisco.

Comment 8 Eduardo Otubo 2019-12-05 15:44:31 UTC
(In reply to Francisco Peralta from comment #7)
> (In reply to Eduardo Otubo from comment #6)
> 
> Thank you very much Eduardo. Is it now something I can tell my customer that
> it's realistic to get in a fixpatch of RHEL 7.7 or how do you see it?
> 
> Kind Regards,
>  Cisco.

In the current scenario it's most likely to have it landed on rhel-7.9, but we can have it backported as z-stream to 7.8 or 7.7 depending on customer needs.

Comment 9 Francisco Peralta 2019-12-05 16:56:32 UTC
(In reply to Eduardo Otubo from comment #8)
> (In reply to Francisco Peralta from comment #7)
> > (In reply to Eduardo Otubo from comment #6)
> > 
> > Thank you very much Eduardo. Is it now something I can tell my customer that
> > it's realistic to get in a fixpatch of RHEL 7.7 or how do you see it?
> > 
> > Kind Regards,
> >  Cisco.
> 
> In the current scenario it's most likely to have it landed on rhel-7.9, but
> we can have it backported as z-stream to 7.8 or 7.7 depending on customer
> needs.

Yes, that would definitely be needed then, customer confirmed already that the test package was working fine so I'd like them to get an official one soon and stay safe.

Thanks in advance!
 Cisco.

Comment 10 Huijuan Zhao 2019-12-06 08:15:19 UTC
QE can reproduce this issue with rhel-7.8(3.10.0-1111.el7.x86_64) + cloud-init-18.5-5.el7.x86_64 on Azure, qa_ack+

Test steps:
1. Create VM with rhel-7.8 on Azure
2. Add additional data disk, format file system as xfs, and mount to /datatest in /etc/fstab
3. Install cloud-init in VM
4. Configure cloud-config:
# cat /etc/cloud/cloud.cfg.d/06_swap.cfg 
swap:
  filename: /datatest/swap.img
  size: "auto" # or size in bytes
  maxsize: 2G 
5. Reboot VM
6. Login VM and check the /var/log/messages and /var/log/cloud-init.log

Actual results:
After step 6, swap file is created but swapon failed with this error : kernel: swapon: swapfile has holes.

# free -m
              total        used        free      shared  buff/cache   available
Mem:           3171         224        2736           9         211        2720
Swap:          2047           0        2047

# ls /datatest/
swap.img

/var/log/cloud-init.log
-----------------------
2019-12-06 07:12:26,228 - util.py[DEBUG]: Running command ['swapon', '-a'] with allowed return codes [0] (shell=False, capture=True)
2019-12-06 07:12:26,265 - cc_mounts.py[WARNING]: Activate mounts: FAIL:swapon -a
2019-12-06 07:12:26,266 - util.py[WARNING]: Activate mounts: FAIL:swapon -a
2019-12-06 07:12:26,266 - util.py[DEBUG]: Activate mounts: FAIL:swapon -a
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cloudinit/config/cc_mounts.py", line 495, in handle
    util.subp(cmd)
  File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 2068, in subp
    cmd=args)
ProcessExecutionError: Unexpected error while running command.
Command: ['swapon', '-a']
Exit code: 255
Reason: -
Stdout:
Stderr: swapon: /mnt/cloudinitswap/swap.img: swapon failed: Invalid argument


/var/log/messages
-----------------
Dec  6 15:12:26  kernel: swapon: swapfile has holes
Dec  6 15:12:26  cloud-init: 2019-12-06 07:12:26,265 - cc_mounts.py[WARNING]: Activate mounts: FAIL:swapon -a
Dec  6 15:12:26  cloud-init: 2019-12-06 07:12:26,266 - util.py[WARNING]: Activate mounts: FAIL:swapon -a

Expected results:
swap should be enabled without error

Comment 43 Huijuan Zhao 2020-04-27 14:37:15 UTC
Tested with cloud-init-19.4-5.el7 in rhel-7.9, the issue is gone.
Change the status to VERIFIED.

Comment 46 errata-xmlrpc 2020-09-29 19:48:41 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: cloud-init security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:3898


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