Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1364851 - [WALA][RHEL-7]waagent fails to create swapfile if fstype is ext3
Summary: [WALA][RHEL-7]waagent fails to create swapfile if fstype is ext3
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: WALinuxAgent
Version: 7.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: yuxisun@redhat.com
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-08 03:25 UTC by yuxisun@redhat.com
Modified: 2019-02-26 20:57 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-04 07:51:02 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github Azure WALinuxAgent issues 347 None None None 2016-08-10 03:06:39 UTC

Description yuxisun@redhat.com 2016-08-08 03:25:53 UTC
This bug is used to track the issue on github:
https://github.com/Azure/WALinuxAgent/issues/347

Description of problem:
If set ResourceDisk.Filesystem=ext3, waagent fails to create swapfile.

Version-Release number of selected component (if applicable):
WALinuxAgent-2.1.5 (upstream, packaged by QE)

RHEL Version:
RHEL-7.3-20160729.1
kernel-3.10.0-481.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a RHEL7.3 VM on Azure. Set the following lines in the /etc/waagent.conf:
ResourceDisk.Format=y
ResourceDisk.Filesystem=ext3
ResourceDisk.EnableSwap=y
ResourceDisk.SwapSizeMB=1024
2. Reboot the VM.
3. Check the swapfile:
# ls -l /mnt/resource|grep swapfile
-rw-r--r--. 1 root root     0 Aug  4 14:17 swapfile
4. #free -m
              total        used        free      shared  buff/cache   available
Mem:           6968         180        6623           8         164        6605
Swap:             0           0           0

Actual results:
The swapfile size is 0

Expected results:
The swapfile size is correct.(1024M in this case)

Logs:
/var/log/waagent:
2016/08/04 14:17:26.365987 ERROR run cmd 'fallocate -l 1073741824 '/mnt/resource/swapfile'' failed
2016/08/04 14:17:26.379904 ERROR Error Code:1
2016/08/04 14:17:26.389545 ERROR Result:fallocate: /mnt/resource/swapfile: fallocate failed: Operation not supported

2016/08/04 14:17:26.420215 ERROR run cmd 'mkswap /mnt/resource/swapfile' failed
2016/08/04 14:17:26.434877 ERROR Error Code:1
2016/08/04 14:17:26.444640 ERROR Result:mkswap: error: swap area needs to be at least 40 KiB

Usage:
 mkswap [options] device [size]

Options:
 -c, --check               check bad blocks before creating the swap area
 -f, --force               allow swap size area be larger than device
 -p, --pagesize SIZE       specify page size in bytes
 -L, --label LABEL         specify label
 -v, --swapversion NUM     specify swap-space version number
 -U, --uuid UUID           specify the uuid to use
 -V, --version             output version information and exit
 -h, --help                display this help and exit


2016/08/04 14:17:26.524109 ERROR run cmd 'swapon /mnt/resource/swapfile' failed
2016/08/04 14:17:26.536041 ERROR Error Code:255
2016/08/04 14:17:26.561057 ERROR Result:swapon: /mnt/resource/swapfile: insecure permissions 0644, 0600 suggested.
swapon: /mnt/resource/swapfile: read swap header failed: Invalid argument

2016/08/04 14:17:26.588520 ERROR Failed to enable swap (000005)/mnt/resource/swapfile


Additional info:
1. In WALA-2.1.5, it uses "fallocate" instead of "dd" to create swapfile. Check the manual, it seems that fallocate is not supported by ext3 filesystem after kernel-2.6.31.
# man fallocate
"As of the Linux Kernel v2.6.31, the fallocate system call is supported by the btrfs, ext4, ocfs2, and xfs filesystems."

Comment 2 Bin Han 2016-09-02 03:11:51 UTC
Verify:

Version
WALinuxAgent-2.1.6

RHEL Version: RHEL-7.3-20160825.1
Python Version: 2.7.5

Steps to verify:
1. Prepare a RHEL7.3 VM on Azure. Set the following lines in the /etc/waagent.conf:
ResourceDisk.Format=y
ResourceDisk.Filesystem=ext3
ResourceDisk.EnableSwap=y
ResourceDisk.SwapSizeMB=1024
2. Reboot the VM.
3. Check the swapfile:
[azureuser@hbvm0902d ~]$ ls -lh /mnt/resource/swapfile 
-rw-------. 1 root root 1.0G Sep  1 23:00 /mnt/resource/swapfile
[azureuser@hbvm0902d ~]$ free -m
              total        used        free      shared  buff/cache   available
Mem:            668         163          55           4         449         367
Swap:          1843           0        1843

[azureuser@hbvm0902d ~]$ sudo parted /dev/sdb print
[sudo] password for azureuser: 
Model: Msft Virtual Disk (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  21.5GB  21.5GB  primary  ext3         boot


Result:
The fstype is ext3 and the swapfile is 1024M.So it is verified.

Comment 3 yuxisun@redhat.com 2016-11-04 07:51:02 UTC

*** This bug has been marked as a duplicate of bug 1387783 ***


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