LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 07-28-2007, 03:12 PM   #1
Neo-Leper
Member
 
Registered: Nov 2006
Posts: 141

Rep: Reputation: 15
SWAP doesn't work in Ubuntu


I am not sure what the problem is. I noticed it for the first time when I did an HD install fo Knoppix and it shared the swap partition with Ubuntu. A little while ago I tried to do an HD install of Dreamlinux.

Now my swap does not work in Ubuntu unless I manually mount it. It worked fine before. I treformated it as swap to in the hopes that would work but it does the same thing still. I manually mount it with gparted which shows it as swapoff until I change it.

If this helps at all, here is the gdesklet error I get, and it shows swap as 0/0 until I manually mount it.

float division
/usr/share/gdesklets/Displays/sidecandy-ram/SideCandyRAM.display
24
25 def get_mem():
26 Dsp.swap_used.value = "%s / %s"
%(mem_format(sys.swap.used),mem_format(sys.swap.total))
27 Dsp.memory_used.value = "%s / %s / %s" %(mem_format(sys.memory.used-
sys.memory.cached-
sys.memory.buffer),mem_format(sys.memory.used),mem_format(sys.memory.total))
28 Dsp.gauge_mem.fill = int((sys.memory.used/float(sys.memory.total))*100)
> 29 Dsp.gauge_swap.fill = int((sys.swap.used/float(sys.swap.total))*100)
30 Dsp.gauge_mem_true.fill = int(((sys.memory.used-sys.memory.cached-
sys.memory.buffer)/float(sys.memory.total))*100)
31 Dsp.show_ram.value = mem_load(var_a,var_b)
32 add_timer(refresh, get_mem)
33
34 add_timer(0, get_mem)
35

Last edited by Neo-Leper; 07-28-2007 at 03:13 PM.
 
Old 07-28-2007, 03:15 PM   #2
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Go trough your initscripts and see why swapon is not run.
 
Old 07-28-2007, 03:25 PM   #3
rupertwh
Member
 
Registered: Sep 2006
Location: Munich, Germany
Distribution: Debian / Ubuntu
Posts: 297

Rep: Reputation: 49
Does your /etc/fstab still match your actual partitions?
You might want to show us the output of
Code:
grep swap < /etc/fstab
sudo fdisk -l | grep swap
 
Old 07-28-2007, 03:30 PM   #4
Neo-Leper
Member
 
Registered: Nov 2006
Posts: 141

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by rupertwh
Does your /etc/fstab still match your actual partitions?
You might want to show us the output of
Code:
grep swap < /etc/fstab
sudo fdisk -l | grep swap
$ sudo grep swap < /etc/fstab
UUID=f2ec5e35-9837-4677-8a77-5c3546f7c6d4 none swap sw 0 0

$ sudo fdisk -l | grep swap
/dev/hda1 1 122 979933+ 82 Linux swap / Solaris


I currently have the swapon. As I said it works fine when I manually mount it,


cat /proc/meminfo

SwapTotal: 979924 kB
SwapFree: 979924 kB

Until I manually mount it I get

SwapTotal: 0 kB
SwapFree: 0 kB


Edit: Shouldn't "none" in the fstab line be "swapon" ?

Edit Edit: Nope didn't help.

Last edited by Neo-Leper; 07-28-2007 at 03:39 PM.
 
Old 07-28-2007, 03:41 PM   #5
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Code:
grep swap < /etc/fstab
in the above, < is useless (unless of course you love typing):
Code:
grep swap /etc/fstab
Quote:
I currently have the swapon. As I said it works fine when I manually mount it,
Sorry, that was misleading. Actually what I meant was why swapon is not effective, i.e. if it's run, why it doesn't work. Of course fstab needs to be in order, but I understood it that you didn't change your partition configuration - or did you?
 
Old 07-28-2007, 03:49 PM   #6
Neo-Leper
Member
 
Registered: Nov 2006
Posts: 141

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by b0uncer
Code:
grep swap < /etc/fstab
in the above, < is useless (unless of course you love typing):
Code:
grep swap /etc/fstab

Sorry, that was misleading. Actually what I meant was why swapon is not effective, i.e. if it's run, why it doesn't work. Of course fstab needs to be in order, but I understood it that you didn't change your partition configuration - or did you?

No. Everything is where it is suppose to be. I am just lost why this is happening.

Its always been like this for hda, hdb1, hdb2 and sda1. hdb3, sda2 and sda3 are the ones I use to play around with other os's. Sda2 will always be for DesktopBSD.

/dev/hda1 swap
/dev/hda2 boot
/dev/hda3 /
dev/hda4 var

/dev/hdb1 home
/dev/hdb2 xp
/dev/hdb3 (Empty partition currently, may just expand xp and get rid of hdb3)

/dev/sda1 disk (storage)
/dev/sda2 (Empty partition currently. Going to reinstall DesktopBSD with the latest version.)
/dev/sda3 (Empty for now, will have some Linux os there soon..)


Edit:
here is fstab

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/hda3
UUID=3d9d448d-e454-4fa6-90b3-da717e691648 / ext3 defaults,errors=remount-ro 0 1
# /dev/hda2
UUID=dab28c96-19d1-4112-a55d-fd7d4209f236 /boot ext3 defaults 0 2
# /dev/hdb1
UUID=5e530f29-bff3-496e-997b-836d8490f4ed /home ext3 defaults 0 2
# /dev/hda4
UUID=8783fe31-bfc9-437e-a66a-64fbf23ce849 /var ext3 defaults 0 2
# /dev/hda1
UUID=f2ec5e35-9837-4677-8a77-5c3546f7c6d4 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/sda1 /media/disk ext3 rw,noexec,nosuid,nodev 0 0
# /dev/sda3 /media/DesktopBSD ufs auto,ro,ufstype=ufs2,nodev,nosuid 0 0
# /dev/sda2 /media/Knoppix ext3 rw,noexec,nosuid,nodev 0 2
/dev/hdb2 /media/WinXP ntfs-3g default 0 0
# /dev/hdb3 /media/DSL ext3 defaults 0 2
# Generated by Automatix
## End of Automatix mounted partitions


Here is mtab,


/dev/hda3 / ext3 rw,errors=remount-ro 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
/sys /sys sysfs rw,noexec,nosuid,nodev 0 0
varrun /var/run tmpfs rw,noexec,nosuid,nodev,mode=0755 0 0
varlock /var/lock tmpfs rw,noexec,nosuid,nodev,mode=1777 0 0
procbususb /proc/bus/usb usbfs rw 0 0
udev /dev tmpfs rw,mode=0755 0 0
devshm /dev/shm tmpfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
lrm /lib/modules/2.6.20-16-generic/volatile tmpfs rw 0 0
/dev/hda2 /boot ext3 rw 0 0
/dev/hdb1 /home ext3 rw 0 0
/dev/hda4 /var ext3 rw 0 0
/dev/sda1 /media/disk ext3 rw,noexec,nosuid,nodev 0 0
/dev/hdb2 /media/WinXP fuseblk rw,nosuid,nodev,noatime,allow_other,blksize=4096 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0

Last edited by Neo-Leper; 07-28-2007 at 03:59 PM.
 
Old 07-28-2007, 04:07 PM   #7
Neo-Leper
Member
 
Registered: Nov 2006
Posts: 141

Original Poster
Rep: Reputation: 15
Also after I installed Both Knoppix and DreamLinux when I booted Ubuntu it would stop booting and I would get an error saying that I needed to use apt-get to install xinit or something to do with that. I had to use ctrl and D to continue booting normally. I don't get that error anymore, but that is when the swap stopped work automatically. (don't know if any of this is actually related at all.)
 
Old 07-28-2007, 04:36 PM   #8
Neo-Leper
Member
 
Registered: Nov 2006
Posts: 141

Original Poster
Rep: Reputation: 15
I am getting frustrated. I have looked all over, including Google and LQ. I can't find any info on this. This makes no sense.
 
Old 07-28-2007, 04:53 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,103

Rep: Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117
Sounds like the UUID might have changed - check /dev/disk/by-uuid.
Personally I would check dmesg to see why the init-script mount is failing, and probably change fstab (back) to using the dev address.
Some of the decisions made by the Ubuntu devs are hard to fathom - especially in a test/multi-boot environmnet.
 
Old 07-28-2007, 04:57 PM   #10
Neo-Leper
Member
 
Registered: Nov 2006
Posts: 141

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by syg00
Sounds like the UUID might have changed - check /dev/disk/by-uuid.
Personally I would check dmesg to see why the init-script mount is failing, and probably change fstab (back) to using the dev address.
Some of the decisions made by the Ubuntu devs are hard to fathom - especially in a test/multi-boot environmnet.

Your timing is perfect.


I found this at the Ubuntu Wiki, I followed it to step 4 when an error message came up.

Steps I took,

1) cfdisk : erase the old Swap partition and recreate a new one
2) reboot (mandatory)
3) mkswap /dev/hda1
4) swapon -a

After reboot step 3 appears to work,

$ sudo mkswap /dev/sda1
Setting up swapspace version 1, size = 133372878 kB
no label, UUID=8a11872c-2021-49aa-9c00-d2baf34f576c


This is the error message I get when I try step 4 "swapon -a"

~$ swapon -a
swapon: cannot stat /dev/disk/by-uuid/f2ec5e35-9837-4677-8a77-5c3546f7c6d4: No such file or directory
 
Old 07-28-2007, 05:08 PM   #11
Neo-Leper
Member
 
Registered: Nov 2006
Posts: 141

Original Poster
Rep: Reputation: 15
The only thing I changed in fstab, after I made a backup of it, is the swap line,

/dev/hda1 swap swap 0 0

The swap works fine now but now my sda1 won't Auto Mount, XP (hdb1) does however.
 
Old 07-28-2007, 05:27 PM   #12
Neo-Leper
Member
 
Registered: Nov 2006
Posts: 141

Original Poster
Rep: Reputation: 15
found my error! I will list it after.
 
Old 07-28-2007, 05:48 PM   #13
Neo-Leper
Member
 
Registered: Nov 2006
Posts: 141

Original Poster
Rep: Reputation: 15
Well because of the screw up with Ubuntu and the swap, I made a type when I did mkswap and lost all my most IMPORTANT information when I put in, by accident, mkswap /dev/sda1 instead of mkswap /dev/hda1


I am making a new thread on this. I need that data back......


New thread is

http://www.linuxquestions.org/questi...82#post2840082

(By the way I got the swap to work by cutting and pasting the new uuid into fstab.)

Last edited by Neo-Leper; 07-28-2007 at 05:53 PM.
 
Old 07-28-2007, 06:47 PM   #14
Neo-Leper
Member
 
Registered: Nov 2006
Posts: 141

Original Poster
Rep: Reputation: 15
While I am working on MY MAJOR SCREW UP, I thought I would post what I did in order.

Like I said above I did the steps at the Ubuntu Wiki.

1) cfdisk : erase the old Swap partition and recreate a new one
2) reboot (mandatory)
3) mkswap /dev/hda1

Step 4 does not work.

Now after mkswap I got this,

Setting up swapspace version 1, size = 133372878 kB
no label, UUID=8a11872c-2021-49aa-9c00-d2baf34f576c


So I took the UUID=8a11872c-2021-49aa-9c00-d2baf34f576c and replaced the one that was in fstab. Then all worked fine, well except for my mistake with /dev/sda1.

I still don't know what happened to cause this problem in Ubuntu except that when I installed Knoppix and then DreamLinux it was sharing the same swap space as Ubuntu, which is when the problems started, nothing else was done before that.

Last edited by Neo-Leper; 07-28-2007 at 07:37 PM.
 
Old 07-28-2007, 11:27 PM   #15
binary_y2k2
Member
 
Registered: Jul 2005
Location: England, UK
Distribution: Ubuntu 8.04 Server, Kubuntu 12.04
Posts: 698
Blog Entries: 1

Rep: Reputation: 31
What probably happened is one of those Distros (either Knoppix or DreamLinux) reformatted your swap partition. When it was reformatted it would have then got a new UUID. Then when Ubuntu tried to activate the swap partition by giving the UUID it would have given the old one, and so it wasn't found.
I hope that goes some way to explaining it to you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sharing swap between FC6 and Ubuntu Regulus Ubuntu 4 11-04-2006 07:08 AM
How can I unmount Swap and Extended on the Ubuntu 5.10 Live Cd cheetahman Ubuntu 10 03-28-2006 07:59 PM
Complete Ubuntu Swap THE RADICAL Ubuntu 4 08-01-2005 07:29 AM
Linux swap / solaris not appearing as swap in Ubuntu? Erik_the_Red Linux - Newbie 1 07-30-2005 12:57 PM
ubuntu - increase swap size dna9 Linux - Distributions 11 01-24-2005 11:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 07:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration