Linux-swap drive not recognized.

Asked by STempler on 2007-11-16

Was having trouble with hibernation, noticed a very brief message about "unable to locate swap", then Ubuntu would start right back up. This prompted me to look at the system monitor and there I found a big fat 0 for the swap drive. Can this be fixed without reinstalling? if so how should I go about that?
This was the result of me trying new things (how else will I learn). I was in GParted and I formatted the linux-swap drive, but I formatted to the same file system (linux-swap). Any help would be greatly appreciated.

System info: Dell Inspiron 8500
                      P4 2.2 ghz
                      512 RAM
                      Ubuntu Feisty

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Bhavani Shankar
Solved:
2007-11-16
Last query:
2007-11-16
Last reply:
2007-11-16
Bhavani Shankar (bhavi) said : #1

hi sTempler..
This is a very common experience when you keep your laptop under hibernation mode..(I have also experienced the same thing....:) )

I got the fix by looking here:

https://edge.launchpad.net/ubuntu/+bug/66637

also JFYI Try these from a terminal.

sudo mkswap /dev/hda1
sudo swapon /dev/hda1
free
(where hda1 is your swap partition)

If it works (from the output of the last command), reboot and see if your swap mounted automatically.

br,

Bhavani Shankar.

STempler (stempler225) said : #2

I read through that post but I am unable to save the fstab and resume files. It says I do not have the permission. How do I replace them?
I am the only user on this PC. Also How do I login with the root account?

Bhavani Shankar (bhavi) said : #3

use sudo... try this command in a terminal: sudo nano /etc/fstab.. or gksudo gedit /etc/fstab..
And to save the file in nano use cntrl+x after you have made the changes... (Root access is disabled by default in ubuntu)
for more info on sudo ref:
https://help.ubuntu.com/community/RootSudo

secondly If you want to login as root without sudo try this:
$ su
$ password: rootpassword
in case you cant login as root (assuming you havent set your root password) follow these simple steps..
$sudo passwd root
$New Password: typeyourpassword
$Retype password: Again
This will set your root password..

Then you can log in as root by doing as mentioned above,

hope it helps,

br,

Bhavani Shankar.

STempler (stempler225) said : #4

I was able to save the files and then I tried two things and the results were as follows;

Hibernating
           The computer went through the normal hibernation process and powered off which it wasn't doing before. But when I power
     it on again it boots rather than returning from hibernation and the swap does show up in the system monitor.
      "used swap 0 bytes of 1.1 gb 0%"

Shutdown
           When I reboot the system the swap does not show up in the system monitor
      "used swap 0 bytes of 0 bytes 0%"

Should I run the diskmount script?

STempler (stempler225) said : #5

If it helps, this is my fstab

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda2
UUID=4291c1b4-d018-41f2-90d8-6eea23d12794 / ext3 defaults,errors=remount-ro 0 1
# /dev/sda1
UUID=7C9C98369C97E8C2 /media/sda1 ntfs defaults,nls=utf8,umask=007,gid=46 0 1
# /dev/sda3
UUID=e45affd1-f16f-4887-8232-a90c13c452f0 none swap sw 0 0
# /dev/sdb5
UUID=5a64aa05-2e05-4b73-acb9-eb25e457f125 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0
#Added by diskmounter utility
/dev/sda4 /media/sda4 vfat rw,user,fmask=0133,dmask=0022,uid=1000,gid=1000 0 0

Bhavani Shankar (bhavi) said : #6

please paste the output of sudo fdisk -l and sudo mkswap /dev/hda1
sudo swapon /dev/hda1
free
(where hda1 is your swap partition)

If it works (from the output of the last command), reboot and see if your swap mounted automatically.
Please report any errors here....

br,

Bhavani Shankar.

Bhavani Shankar (bhavi) said : #7

please paste the output of sudo fdisk -l and
sudo mkswap /dev/hda1
sudo swapon /dev/hda1
free
(where hda1 is your swap partition)

If it works (from the output of the last command), reboot and see if your swap mounted automatically.
Please report any errors here....

br,

Bhavani Shankar.

STempler (stempler225) said : #8

Disk /dev/sda: 30.0 GB, 30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 2800 22490968+ 7 HPFS/NTFS
/dev/sda2 2992 3509 4160835 83 Linux
/dev/sda3 3510 3648 1116517+ 82 Linux swap / Solaris
/dev/sda4 2801 2991 1534207+ b W95 FAT32

Partition table entries are not in disk order

-------------------------------------------------------------------------------------------------------------
Setting up swapspace version 1, size = 1143308 kB
no label, UUID=fb2e27fc-565e-4a61-a2df-44961eed8d4f

-------------------------------------------------------------------------------------------------------------
swapon: /dev/sda3: Device or resource busy

--------------------------------------------------------------------------------------------------------------
             total used free shared buffers cached
Mem: 515712 431788 83924 0 6648 231492
-/+ buffers/cache: 193648 322064
Swap: 1116508 0 1116508

Bhavani Shankar (bhavi) said : #9

paste o/p of cat cat /etc/fstab please...

STempler (stempler225) said : #10

I went through all of the steps again and did "update-initramfs -u", retsarted and still not mounting the swap.

Best Bhavani Shankar (bhavi) said : #11

Ok one thing i have observed is # mark in your /dev /sda3 line in your fstab..
You need You need to remove the # sign in front of /dev/sda3 so it would look like this in your /etc/fstab.

/dev/sda3
and comment out the line after that
#UUID=e45affd1-f16f-4887-8232-a90c13c452f0 none swap sw 0 0

and save the file and restart.. and swap should start working...:)

Hope it helps.:)

br,

Bhavani Shankar.

STempler (stempler225) said : #12

Thanks Bhavani Shankar, that solved my question.

STempler (stempler225) said : #13

You are a golden god. Thank you VERY much for that.

Bhavani Shankar (bhavi) said : #14

no mention.......Glad that I can help and it worked.......:)