Ubuntu 14.04 32 bit swapfile max 60k issue

linux-kernelswapUbuntu

Have a strange issue where suddenly all my swapfile (1gb each) get truncated to only use 60k . I can remove/recreate etc but whatever i do , the max seems limited to 60k with following message in syslog:

Truncating oversized swap area, only using 60k out of 1048572k
kernel: [  406.348815] Adding 60k swap on /mnt/swapfile.  Priority:-1 extents:1 across:60k FS

No difference if i use partition or file.

procedure used to create new swaps :

> dd if=/dev/zero of=/swapfile bs=1M count=1000
> mkswap /swapfile
Setting up swapspace version 1, size = 1023996 KiB
no label, UUID=ba344dc1-61aa-4847-bbc4-0a78cbf05546
> swapon /swapfile

Which creates a 1GB file but then then check with swapon -s shows:

Filename                Type        Size    Used    Priority

/mnt/swapfile           file        60  60  -1

Now have a total of 4 x 1GB swapfiles that only result in 240k swapspace (confirmed with free,glances, etc)

Kernel version is:

$ uname -rvmpi
3.13.0-157-generic #207-Ubuntu SMP Mon Aug 20 23:17:45 UTC 2018 i686 i686 i686

edit: installed/reverted to last working kernel version 3.13.0-153. It seems related to the L1TF mitigation stuff as suggested by Byte Commander below.

Best Answer

Looks to me like you might have run into a regression in the kernel caused by recent L1TF mitigations, which now makes your maximum swap size value overflow and reset to zero or some small number.

My guess is based on this Linux Kernel Mailing List entry from last week: https://lkml.org/lkml/2018/8/20/172

From    Vlastimil Babka <>
Subject [PATCH] x86/speculation/l1tf: fix overflow on l1tf_pfn_limit() on 32bit
Date    Mon, 20 Aug 2018 11:58:35 +0200

On 32bit PAE kernels on 64bit hardware with enough physical bits,
l1tf_pfn_limit() will overflow unsigned long. This in turn affects
max_swapfile_size() and can lead to swapon returning -EINVAL. This has been
observed in a 32bit guest with 42 bits physical address size, where
max_swapfile_size() overflows exactly to 1 << 32, thus zero, and produces the
following warning to dmesg:

[    6.396845] Truncating oversized swap area, only using 0k out of 2047996k

Fix this by using unsigned long long instead.

Reported-by: Dominique Leuenberger <dimstar@suse.de>
Reported-by: Adrian Schroeter <adrian@suse.de>
Fixes: 17dbca119312 ("x86/speculation/l1tf: Add sysfs reporting for l1tf")
Fixes: 377eeaa8e11f ("x86/speculation/l1tf: Limit swap file size to MAX_PA/2")
[...]

I'm afraid there's probably not much you can do except waiting until this kernel bug is fixed and the patched version gets released to Ubuntu.

Edit: alternatively, you can of course roll back to one of the previous kernel versions without any L1TF mitigation matches to be able to use swap again. Keep in mind that of course this makes you vulnerable to a critical security issue again though, so be careful and update again as soon as a fix is out.

Related Question