How to add swap space to hibernate?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

How to add swap space to hibernate?

Postby simplex on Wed Jan 09, 2013 11:53 am

I have just installed LMDE and updated to the newest packages. In the logout menu, I have "Bereitschaft" (suspend) and "Ruhezustand" (hibernate). But when I hibernate, my machine halts. When I switch it on again, it boots from scratch.

I previously used Mint 10 Julia, and hibernating worked perfectly.

I have a swap partition large enough; it is registered in /etc/fstab, but it is not mounted!?

My fstab looks like this

Code: Select all
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc   /proc   proc   defaults   0   0
# /dev/sda1
UUID=c6c89f9b-ebd0-4426-8c4b-529094d98114   /   ext4   rw,errors=remount-ro   0   1
# /dev/sda5
UUID=cbfe9ae2-e86e-4d3e-89f8-db639633723a   swap    swap   sw   0   0


The swap partition is inside an extended partition. mount says

Code: Select all
# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=126500,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=102448k,mode=755)
/dev/disk/by-uuid/c6c89f9b-ebd0-4426-8c4b-529094d98114 on / type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=642120k)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
cgroup on /dev/cgroup/cpu type cgroup (rw,relatime,cpu,release_agent=/usr/local/sbin/cgroup_clean)


Strangely enough, the swap partition seems to be there and used:

Code: Select all
root@nc10:~# LANG=C blkid /dev/sda5
/dev/sda5: UUID="cbfe9ae2-e86e-4d3e-89f8-db639633723a" TYPE="swap"
root@nc10:~# LANG=C swapon -U cbfe9ae2-e86e-4d3e-89f8-db639633723a
swapon: /dev/sda5: swapon failed: Device or resource busy


What am I doing wrong?

S.
simplex
Level 2
Level 2
 
Posts: 83
Joined: Sat Oct 06, 2012 2:32 pm

Linux Mint is funded by ads and donations.
 

Re: How to add swap space to hibernate?

Postby viking777 on Thu Jan 10, 2013 10:51 am

The command

Code: Select all
free


Will tell you how much swap you have and how much is used.

Another way is

Code: Select all
cat /proc/swaps


It isn't really mounted like other file systems and doesn't appear in 'mount' for me either. My fstab has the swap partition listed with mount point 'none' although I have seen it written as 'swap' in the past I don't know if this is significant, but you could try changing it and see.

Although it is a bit old now, there is an enormous amount of information on swap partitions and usage here:

https://help.ubuntu.com/community/SwapFaq

Maybe that will help you.

Another thing you might try (although I am not sure this is strictly necessary these days) is to boot with the kernel parameter:
Code: Select all
resume=/dev/disk/by-uuid/cbfe9ae2-e86e-4d3e-89f8-db639633723a



With the UUID being that of your swap partition. You can test this from grub by typing this entry at the end of the grub line starting with the word 'linux' then pressing f10 to boot then trying the hibernate. If it works you can add it to /etc/default/grub
Code: Select all
GRUB_CMDLINE_LINUX_DEFAULT= resume=/dev/disk/by-uuid/cbfe9ae2-e86e-4d3e-89f8-db639633723a


Which will make it permanent.
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am

Re: How to add swap space to hibernate?

Postby simplex on Sat Jan 12, 2013 12:12 pm

Hey viking777,

thank you very, very, very much! All I had to do was to insert your GRUB-line

Code: Select all
GRUB_CMDLINE_LINUX_DEFAULT= resume=/dev/disk/by-uuid/cbfe9ae2-e86e-4d3e-89f8-db639633723a


Swap was already there (and shown with 'free'), but it was not used for hibernating.

Do you think I should file this as a bug report? The "normal" Linux Mint edition (whose partition layout I imitated when installing LMDE) uses available swap for hibernation by default. So somehow the LMDE installer forgets to do this.

S.
simplex
Level 2
Level 2
 
Posts: 83
Joined: Sat Oct 06, 2012 2:32 pm

Re: How to add swap space to hibernate?

Postby viking777 on Sat Jan 12, 2013 12:48 pm

Do you think I should file this as a bug report


Well I don't think so because I don't have this line in my mint grub and yet it hibernates quite normally, so it looks like a quirk with your system rather than Mint as a whole.

I'm happy the solution worked though :D
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am

Re: How to add swap space to hibernate?

Postby simplex on Sun Jan 13, 2013 6:59 am

Hmm, as I wrote earlier, I previously used "Normal" Mint 10 Julia on the same system, and hibernating worked perfectly.

When I installed LMDE 1204, gparted popped up at some point, and I played a little bit with it, that is, I created and deleted partitions until I decided to give it the same structure as Mint 10 Julia: If you give the "normal" Mint installer a whole, empty hard drive to eat, It creates one huge partition for everything and one tiny extended partition of about 2.5 times the size of your main memory filled with the according swap partition in it. And hibernating works out-of-the-box.

So I conclude that the quirk is not in my system, but in the LMDE installer. (?)

Can it be due to the fact that my huge partition is called /dev/sda1, and the tiny ones /dev/sda4 and /dev/sda5 (which comes, I suppose, from playing around with gparted)?

S.
simplex
Level 2
Level 2
 
Posts: 83
Joined: Sat Oct 06, 2012 2:32 pm

Re: How to add swap space to hibernate?

Postby viking777 on Sun Jan 13, 2013 7:13 am

Can it be due to the fact that my huge partition is called /dev/sda1, and the tiny ones /dev/sda4 and /dev/sda5


I think that is unlikely, my old machine was vaguely similar in the partition numbers, Linux is very tolerant of stuff like that.
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am


Return to Newbie Questions

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests