Comment 6 for bug 1892728

Revision history for this message
Balint Reczey (rbalint) wrote :

How can I observe the problem?
I've installed linux-image-5.6.0-1028-oem and the created swapfile works, and when I create a file with fallocate that also works:

ubuntu@ip-172-31-4-85:~$ fallocate -l 4194304000 swap2
ubuntu@ip-172-31-4-85:~$ du -sh swap2
4.0G swap2
ubuntu@ip-172-31-4-85:~$ sudo mkswap swap2
mkswap: swap2: insecure permissions 0664, 0600 suggested.
mkswap: swap2: insecure file owner 1000, 0 (root) suggested.
Setting up swapspace version 1, size = 3.9 GiB (4194299904 bytes)
no label, UUID=8d0c81ae-ae7e-4d92-a40f-31812468cd84
ubuntu@ip-172-31-4-85:~$ sudo swapon swap2
swapon: /home/ubuntu/swap2: insecure permissions 0664, 0600 suggested.
swapon: /home/ubuntu/swap2: insecure file owner 1000, 0 (root) suggested.
ubuntu@ip-172-31-4-85:~$ echo $?
0

OTOH when I use truncate, the sparse file is created and it indeed fails to set the file up as swap:

ubuntu@ip-172-31-4-85:~$ sudo swapoff swap2
ubuntu@ip-172-31-4-85:~$ truncate -s 0 swap2
ubuntu@ip-172-31-4-85:~$ truncate -s 4G swap2
ubuntu@ip-172-31-4-85:~$ du -sh swap2
0 swap2
ubuntu@ip-172-31-4-85:~$ sudo mkswap swap2
mkswap: swap2: insecure permissions 0664, 0600 suggested.
mkswap: swap2: insecure file owner 1000, 0 (root) suggested.
Setting up swapspace version 1, size = 4 GiB (4294963200 bytes)
no label, UUID=02e6ad30-2a03-4cb6-8f02-e64fd98d8bf9
ubuntu@ip-172-31-4-85:~$ du -sh swap2
4.0K swap2
ubuntu@ip-172-31-4-85:~$ sudo swapon swap2
swapon: /home/ubuntu/swap2: insecure permissions 0664, 0600 suggested.
swapon: /home/ubuntu/swap2: insecure file owner 1000, 0 (root) suggested.
swapon: /home/ubuntu/swap2: skipping - it appears to have holes.
ubuntu@ip-172-31-4-85:~$