5

I've tried enabling swap both on a swapfile (on ext4):

# file /mnt/usb/swapfile
/mnt/usb/swapfile: Linux/i386 swap file (new style), version 1 (4K pages), size 1023999 pages, no label, UUID=9dfaa27a-d72f-4dad-ac97-ffead7e29845
# swapon /mnt/usb/swapfile
swapon: /mnt/usb/swapfile: swapon failed: Invalid argument

and a swap partition:

# parted /dev/sda2 print
Model: Unknown (unknown)
Disk /dev/sda2: 2934MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system     Flags
 1      0.00B  2934MB  2934MB  linux-swap(v1)

# swapon /dev/sda2
swapon: /dev/sda2: swapon failed: Invalid argument

system info:

# uname -a
Linux alarm 3.10.18-24-ARCH #1 SMP Sun Sep 17 21:03:56 CEST 2017 armv7l GNU/Linux

and swapon version:

# swapon --version
swapon from util-linux 2.31.1

I don't see anything relevant in the man page or online. Can anyone shine light on what the issue is?

Flobe
  • 51
  • 1
  • 2
  • 2
    The swap file says it is for i386 but you are running on arm. That may be the problem. – psusi Mar 07 '18 at 16:42
  • Yeah that's strange. Since it also doesn't work for the partition I thought it might be a mistake. Both the swapfile and partition were made on the ARM device using dd then mkswap for the file and gparted for the partition, niether produced any error. – Flobe Mar 08 '18 at 21:59
  • 3
    Questions: (1) Is your kernel compiled with swap support - what are the contents of `/proc/sys/vm/swappiness`? (2) What is the file-system on the usb device? (3) Is the `/mnt/usb` partition marked for swap (check using `fdisk -l`)?, (4) If the partition is marked as swap, did you prepare it using the mkswap command? – harrymc Aug 30 '18 at 12:23
  • @AMS: Can you or the poster please answer the comments ? – harrymc Sep 02 '18 at 09:58
  • @harrymc No, and those questions probably don't matter. There is a bug in util-linux that I can confirm. More info in https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1788321. – AMS Sep 03 '18 at 06:31
  • @AMS: That bug in util-linux (Ubuntu) has been marked as Invalid in the bug report. – harrymc Sep 03 '18 at 07:20
  • @AMS: I conclude that you don't need our help. – harrymc Sep 03 '18 at 14:34
  • @harrymc I'm not the OP. I had the same problem as the OP, opened a bounty and later found the bug report. I tried to answer based on the bug report but the answer was taken down by a moderator (@random) for unspecified reasons. – AMS Sep 04 '18 at 07:03
  • @AMS: It was probably taken down for being link-only. But it's also incorrect, as that bug report was judged to be invalid. – harrymc Sep 04 '18 at 07:12
  • What does the end of `dmesg` say just after the `swapon` command is issued? – Anon Sep 06 '18 at 03:48
  • "Truncating oversized swap area, only using 0k out of 2055164k" – AMS Sep 07 '18 at 08:38
  • @AMS have you seen https://unix.stackexchange.com/questions/465718/ubuntu-14-04-32-bit-swapfile-max-60k-issue (bug in recent 32 bit kernels)? – Anon Sep 22 '18 at 18:12

0 Answers0