LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices


Reply
  Search this Thread
Old 02-01-2010, 10:11 AM   #1
SaintDanBert
Senior Member
 
Registered: Jan 2009
Distribution: Mint-19.3 with Cinnamon
Posts: 1,694
Blog Entries: 3

Rep: Reputation: 107Reputation: 107
Is "swap space" required to enable SLEEP and HIBERNATE?


Do I need "swap space" for SLEEP or HIBERNATE to work?
I have a ton of RAM -- 4GB laptop -- so I don't have a swap partition or swap file.

Under Ubuntu Karmic & Gnome, where do I find the configuration settings for SLEEP and HIBERNATE behavior?
I find several places that say "enable SLEEP for these happenings" or "enable HIBERNATE for those happenings". I don't find any configuration for what SLEEP or HIBERNATE actually does.

~~~ 0;-Dan
 
Old 02-01-2010, 10:18 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 553Reputation: 553Reputation: 553Reputation: 553Reputation: 553Reputation: 553
I cannot answer the Ubuntu-specific questions well enough to try, but as for the swap space:

For suspend-to-Ram you do not need a swap space (or swap file).

For suspend-to-disk, you DO need a swap space (or swap file??). This swap space (assuming it is a partition, since I am not familiar with the swap-file method) should be configured in your fstab file with a "noauto" option, so it will not be mounted as a regular swap partition during boot.

In your bootloader configuration (LILO or GRUB) you will want to have a line (in LILO) like:

resume=/dev/hdXN

where X = the drive letter (like hda, or sdb) and where N = the partition number. This tells the machine where to resume from, when it turns back on after a suspend-to-disk.

I don't use GRUB, so if there's a different syntax for this resume= statement in GRUB, you'll need to Google a bit or await a GRUB user for correction or verification of this line.
 
Old 02-01-2010, 03:47 PM   #3
SaintDanBert
Senior Member
 
Registered: Jan 2009
Distribution: Mint-19.3 with Cinnamon
Posts: 1,694

Original Poster
Blog Entries: 3

Rep: Reputation: 107Reputation: 107
Worse than issues with GRUB syntax, Ubuntu Karmic uses GRUB-2 -- new and very different and improved (we hope).

I'm really astounded that there is not a clearly visible configure suspend and configure hibernate somewhere in every laptop install. Where "suspend" is the RAM approach and "hibernate" is the disk approach.

As for swap files vs. swap partitions, see if this is useful:
http://www.linux.com/news/software/a...nux-swap-space

~~~ 8d;-Dan
 
Old 02-01-2010, 06:53 PM   #4
fbsduser
Member
 
Registered: Oct 2009
Distribution: Hackintosh, SlackWare
Posts: 267

Rep: Reputation: 30
For hibernate you need a swap space since that's where the copy of the RAM's contents is going to be put into (hibernate means that the contents of the RAM gets copied to the HD and copied back to RAM when you turn the PC on).
 
Old 02-02-2010, 08:34 PM   #5
SaintDanBert
Senior Member
 
Registered: Jan 2009
Distribution: Mint-19.3 with Cinnamon
Posts: 1,694

Original Poster
Blog Entries: 3

Rep: Reputation: 107Reputation: 107
... seeking config details for "hibernate"

Quote:
Originally Posted by fbsduser View Post
For hibernate you need a swap space since that's where the copy of the RAM's contents is going to be put into (hibernate means that the contents of the RAM gets copied to the HD and copied back to RAM when you turn the PC on).
I know there are configuration details out there somewhere. Can anyone tell me where they are?
  • various menus have the choice to "hibernate"-- where is the specific program command line named? Where are the config options for that program?
  • low battery will activate "hibernate" -- where is the configuration that says which program command line runs with low power? Where are the config options for that program?
  • on restart, what decides that there is an active configuration saved during "hibernate"?
  • Is it possible to configure where this software (a)writes the hibernate data, and (b)looks for hibernate data on power-up?

There is a similar set of questions about "sleep" processing.

I working with Ubuntu Karmic and I'm dashed if I can sort out the ACPI and HAL and other parts along the way.

~~~ 0;-Dan
 
Old 02-02-2010, 08:46 PM   #6
SaintDanBert
Senior Member
 
Registered: Jan 2009
Distribution: Mint-19.3 with Cinnamon
Posts: 1,694

Original Poster
Blog Entries: 3

Rep: Reputation: 107Reputation: 107
... since I need swap space, "Now what?"

Since I don't have a swap partition, I need to make a swap file and connect it to the running system. For hibernate to work well, how much swap file space is needed relative to the size of physical ram?

Making a swap file involves
  • use dd to make the file
  • mkswap might be involved
  • use swapon and swapoff to activate the space
  • fstab might be involved to make activation permanent
(I'd love to get a web link to a good swap file HOWTO.)

My laptop has 4GB of physical ram. I think that means
Code:
4 * (1024 * 1024 * 1024) = 4,294,967,296 bytes
What do I tell dd when making the swap file?

Is there a standard place on disk for swap files? I'm inclined to put it onto /var since it is the place for system-transient data.


~~~ 0;-Dan
 
Old 02-04-2010, 02:36 PM   #7
SaintDanBert
Senior Member
 
Registered: Jan 2009
Distribution: Mint-19.3 with Cinnamon
Posts: 1,694

Original Poster
Blog Entries: 3

Rep: Reputation: 107Reputation: 107
... adding [b]swap file[/b] didn't help

Okay, folks, things still don't work even with swapping space.
I believe that somewhere one must configure some program to know where to write suspend-to-ram or suspend-to-disk data.

I made a swap file:
Code:
user@host$ sudo -i
user@host# cd /var
user@host# mkdir swap; cd swap
user@host# dd if=/dev/zero  of=/var/swapswapfile  bs=1024  count=2097152
user@host# chmod u=rw,g-rwx,o-rwx /var/swap/swapfile
user@host# mkswap -c  /var/swap/swapfile
user@host# logout
user@host$
I told my system to use this swap file at boot-time:
Code:
gksu  emacs /etc/fstab
...
... insert the following line where convenient ...
/var/swap/swapfile     swap     swap     defaults      0      0
...
{ctrl-x} {ctrl-s}
{ctrl-x} {ctrl-c}
After reboot, I see the following reports:
Code:
user@host$ sudo vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 0  0      0 3496052  24008 275576    0    0   134    10  328  311  2  2 92  3

user@host$ sudo swapon -s
Filename                                Type            Size    Used    Priority
/var/swap/swapfile                      file            2097144 0       -1
Now what?
~~~ 0;-/ Dan
 
Old 03-04-2010, 06:17 PM   #8
fbsduser
Member
 
Registered: Oct 2009
Distribution: Hackintosh, SlackWare
Posts: 267

Rep: Reputation: 30
Quote:
Originally Posted by SaintDanBert View Post
I know there are configuration details out there somewhere. Can anyone tell me where they are?
  • various menus have the choice to "hibernate"-- where is the specific program command line named? Where are the config options for that program?
  • low battery will activate "hibernate" -- where is the configuration that says which program command line runs with low power? Where are the config options for that program?
  • on restart, what decides that there is an active configuration saved during "hibernate"?
  • Is it possible to configure where this software (a)writes the hibernate data, and (b)looks for hibernate data on power-up?

There is a similar set of questions about "sleep" processing.

I working with Ubuntu Karmic and I'm dashed if I can sort out the ACPI and HAL and other parts along the way.

~~~ 0;-Dan
- The program used for hibernation varies from distro to distro, it can be s2disk if you have uswsusp, pm-hibernate for those using pm-utils (ubuntu does) or hibernate (which is a script) if you're using tux-on-ice.

- It uses a script to invoque the hibernate command (the ones mentioned above).

- your bootloader (grub or grub2) defines where the image is (this is done by appending "resume=/dev/swap partition" to the kernel line in the config file).

- If you use tux-on-ice you can configure grub to use a swap file instead of a partition, you can also configure it to use multiple swap files/partitions simultaneously, if you don't use it (to use tux-on-ice you need to compile a custom kernel) you can only use your swap partition for hibernation.

Quote:
Originally Posted by GrapefruiTgirl View Post
I cannot answer the Ubuntu-specific questions well enough to try, but as for the swap space:

For suspend-to-Ram you do not need a swap space (or swap file).

For suspend-to-disk, you DO need a swap space (or swap file??). This swap space (assuming it is a partition, since I am not familiar with the swap-file method) should be configured in your fstab file with a "noauto" option, so it will not be mounted as a regular swap partition during boot.

In your bootloader configuration (LILO or GRUB) you will want to have a line (in LILO) like:

resume=/dev/hdXN

where X = the drive letter (like hda, or sdb) and where N = the partition number. This tells the machine where to resume from, when it turns back on after a suspend-to-disk.

I don't use GRUB, so if there's a different syntax for this resume= statement in GRUB, you'll need to Google a bit or await a GRUB user for correction or verification of this line.
Sasha, You cannot hibernate to a swap file with the stock kernel, to do that you need the tux-on-ice kernel patch.

Last edited by fbsduser; 03-04-2010 at 06:21 PM.
 
  


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
[SOLVED] Cannot "sleep" or "hibernate" my Thinkpad X61 Tablet SaintDanBert Linux - Laptop and Netbook 1 02-01-2010 10:05 AM
Cedega "Disk space required for the installation exceeds available disk space" Solved Spewdemon LinuxQuestions.org Member Success Stories 1 10-18-2007 06:19 PM
Fedora 3 boot hangs after "Enabling swap space: [OK]" Voroojack Fedora 2 11-29-2005 09:21 AM
FC2 1.521 hangs after "enabling swap space" Oxxide Fedora - Installation 2 10-30-2004 05:19 PM
boot stops at "enable swap space" heather_k Linux - General 5 06-07-2002 03:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 06:03 PM.

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