Bug 244383 - swapon fails
Summary: swapon fails
Alias: None
Product: Fedora
Classification: Fedora
Component: util-linux   
(Show other bugs)
Version: rawhide
Hardware: All Linux
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Ben Levenson
Whiteboard: bzcl34nup
Depends On:
TreeView+ depends on / blocked
Reported: 2007-06-15 11:31 UTC by Kjartan Maraas
Modified: 2008-04-15 22:47 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-04-15 22:47:59 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Output of commands requested in previous comments (12.22 KB, text/plain)
2008-04-15 19:56 UTC, Scott Douglas-Watson
no flags Details

Description Kjartan Maraas 2007-06-15 11:31:14 UTC
Description of problem:

swapon fails during boot and also when run manually in rawhide at least. Not
sure when this started happening:

[root@localhost libbonobo]# cat /etc/fstab 
LABEL=/1                /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-sda4         swap                    swap    defaults        0 0

[root@localhost libbonobo]# LC_ALL=C swapon -a -v
swapon on /dev/sda4
swapon: /dev/sda4: Invalid argument

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
Actual results:

Expected results:

Additional info:

Comment 1 Karel Zak 2007-06-27 08:40:45 UTC
Please, provide more information. For example outputs from:

# blkid
# fdisk -l /dev/sda

# cat /proc/swaps               <-- before swapon
# LC_ALL=C swapon -a -v         
# cat /proc/swaps               <-- after swapon

Comment 2 Kjartan Maraas 2007-06-27 10:39:30 UTC
[kmaraas@localhost ~]$ blkid
/dev/sda4: TYPE="swap" LABEL="SWAP-sda4" 
/dev/sda3: LABEL="/1" UUID="c3436114-c0b6-4875-a42e-f3314ee8c145"
SEC_TYPE="ext2" TYPE="ext3" 
/dev/sda1: TYPE="ntfs" 
/dev/sda2: LABEL="/boot" UUID="cc7b83fc-9fad-42eb-8ef4-cbc641be4ee5"
SEC_TYPE="ext2" TYPE="ext3" 

[root@localhost kmaraas]# fdisk -l /dev/sda

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2705    21727881    7  HPFS/NTFS
/dev/sda2            2706        2720      120487+  83  Linux
/dev/sda3            2721        9500    54460350   83  Linux
/dev/sda4            9501        9729     1838970   82  Linux swap / Solaris
Partition 4 does not end on cylinder boundary.

[root@localhost kmaraas]# cat /proc/swaps 
Filename                                Type            Size    Used    Priority
[root@localhost kmaraas]# LC_ALL=C swapon -a -v
swapon on /dev/sda4
swapon: /dev/sda4: Invalid argument
[root@localhost kmaraas]# cat /proc/swaps 
Filename                                Type            Size    Used    Priority

Comment 3 Karel Zak 2007-07-09 10:42:22 UTC
(In reply to comment #2)

> [root@localhost kmaraas]# fdisk -l /dev/sda
> Partition 4 does not end on cylinder boundary.

Hmm.. the disk has been partitioned by any non-linux tool, right?

You can try to fix it:

fdisk /dev/sda
  option : x (expert mode)
  option : f (fix partition order)
  option : v to verify partition
if it is ok:
  option : w (to write table to disk)
  option : q to quit

but be **VERY CAREFUL** -- you can lost your data or possibility to boot your

Comment 4 Kjartan Maraas 2007-08-09 11:44:18 UTC
It was resized/partitioned using gparted from a live iso image. 

Command (m for help): x

Expert command (m for help): f
Nothing to do. Ordering is correct already.

Expert command (m for help): v
Partition 4 does not end on cylinder boundary.
6110 unallocated sectors

Expert command (m for help): p

Disk /dev/sda: 255 heads, 63 sectors, 9729 cylinders

Nr AF  Hd Sec  Cyl  Hd Sec  Cyl     Start      Size ID
 1 80   1   1    0 254  63 1023         63   43455762 07
 2 00 254  63 1023 254  63 1023   43455825     240975 83
 3 00 254  63 1023 254  63 1023   43696800  108920700 83
 4 00 239  63 1023 239  63 1023  152617500    3677940 82
Partition 4 does not end on cylinder boundary.

Expert command (m for help): q

Any other tips on how to fix this?

Comment 5 Kjartan Maraas 2007-08-14 12:23:35 UTC
Moving this to devel since it's still a problem for me in rawhide

Comment 6 Kjartan Maraas 2007-08-21 07:37:17 UTC
So, it doesn't seem that the partition itself was the problem. I tried resizing
it a few times in gparted without success. After reading the fstab(5) manual
page it struck me that the fstab entry was wrong? The second column should have
had "none" intstead of "swap" in it according to the man page. I also dropped
the label and just put the /dev/sda4 entry in there and now it works just fine.
Maybe the tools have problems with labels or at least some variants of labels?

Comment 7 Karel Zak 2007-10-22 08:26:04 UTC
It doesn't seem like a problem with labels (if blkid works as expected). The
"Invalid argument" is very probably error from swapon(2) syscall. Try strace,
you will see more.

Comment 8 Bug Zapper 2008-04-04 12:49:19 UTC
Based on the date this bug was created, it appears to have been reported
during the development of Fedora 8. In order to refocus our efforts as
a project we are changing the version of this bug to '8'.

If this bug still exists in rawhide, please change the version back to
(If you're unable to change the bug's version, add a comment to the bug
and someone will change it for you.)

Thanks for your help and we apologize for the interruption.

The process we're following is outlined here:

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

Comment 9 Scott Douglas-Watson 2008-04-15 19:56:50 UTC
Created attachment 302513 [details]
Output of commands requested in previous comments

I get a similar error on latest rawhide. I'm using an LVM partition scheme

I have attached the output of the following commands:
cat /etc/fstab
lvm lvs
swapon -av
strace swapon -av


Comment 10 Karel Zak 2008-04-15 21:05:25 UTC
The problem is that F9 swapon(8) checks for "suspend" instead for "swsuspend".
That's bug. 

  /dev/VolGroup00/LogVol01: TYPE="swsuspend" 
  # swapon -av
  swapon on /dev/mapper/VolGroup00-LogVol01
  swapon: /dev/mapper/VolGroup00-LogVol01: Invalid argument

Thanks for your report!

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