Page 1 of 21 12311 ... LastLast
Results 1 to 10 of 206

Thread: HOWTO: Suspend2 in Breezy

  1. #1
    Join Date
    Jun 2005
    Beans
    41
    Distro
    Ubuntu Breezy 5.10

    HOWTO: Suspend2 in Breezy

    Suspend2 brings to the Linux world the ability to suspend the current working state of the computer to hard disk, and power off the machine, then restart it to the exact same state where you left off. This is similar to the ability of Windows machines to hibernate, and is invaluable to laptop users; when your battery is about to run out, you can save your work in progress. After a while, I have found it helps my productivity enormously, because I can save my "mental state" in the layout of windows and browser tabs I have open, and restore a better summary of what I was working on at the time I had to leave the computer, without taking notes and bookmarking all the bits that I was in the process of researching.

    Suspend2 differs from the suspend functionality built into the kernel in that it supports up to 4 GB of memory, compresses the save image while writing to the disk, and supports suspend to file and splashscreen integration (but this tutorial does not cover these last two.) It also is rumored to support SMP, but we have not yet gotten that functionality working. In addition, it just flat works on a whole bunch of machines and configurations that seem to cause the original suspend to fail.

    This patch as modified might not function on clustered computers, but you could argue that it doesn't make much sense there. Also, there was a bit about Toshiba laptops I just had to guess at. I don't have either of these systems to test it on, so feel free to give feedback.

    Problems with the modified patch should be directed to me, and not Nigel at suspend2.com. He knows I have been hacking on his patches, but I'm still responsible for any mess I've made of his code.

    HOW TO:
    1. Get the networking working properly, so that you can perform apt-get update.
    2. Start a terminal window from the menu, Applications->Accessories->Terminal
    3. Login as root
      Code:
      sudo -s
      # enter password
    4. Install the kernel source and the tools to build it
      Code:
      apt-get -y install build-essential bin86 libncurses-dev alien
      apt-get -y install linux-tree-2.6.12
      cd /usr/src
    5. Download patched Suspend2
      Code:
      wget http://ubuntu.griffin3.com/software-suspend-2.1.9.9-for-2.6.12-ubuntu5.10.tar.bz2
      wget http://www.suspend2.net/downloads/all/hibernate-1.12-1.i386.rpm
      wget http://www.suspend2.net/downloads/all/suspend2-userui-0.5.1.tar.gz
    6. Unpack the lot
      Code:
      tar -xjf software-suspend-2.1.9.9-for-2.6.12-ubuntu5.10.tar.bz2
      tar -zxf suspend2-userui-0.5.1.tar.gz
      tar -xjf linux-source-2.6.12.tar.bz2
      ln -s linux-source-2.6.12 linux
      cd /usr/src/linux
    7. Install gcc-3.4 required by kernel
      Code:
      apt-get -y install gcc-3.4.5
      CC=gcc-3.4
      export CC
    8. Patch the kernel
      Code:
      cp /boot/config-2.6.12-9-386 .config
      make oldconfig
      ../software-suspend-2.1.9.9-for-2.6.12-ubuntu5.10/apply
    9. Find your IDE chipset and swap partition--remember these
      Code:
      lspci | grep 'IDE'
      fdisk -l | grep 'swap'
    10. Configure the kernel
      Code:
      make menuconfig
      #    General setup --->
      #        (-hibernate) Local version - append to kernel release
      #    Power management options (ACPI, APM) --->
      #        [ ]   Software Suspend (EXPERIMENTAL)
      #        <*> Software Suspend 2 --->
      #            <*> Swap Writer
      #            (swap:/dev/hda3) Default resume device name
      #    Device Drivers --->
      #        ATA/ATAPI/MFM/RLL support --->
      #            <*> ATA/ATAPI/MFM/RLL support
      #            <*> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
      #            <*> Include IDE/ATA-2 DISK support
      #            <*> generic/default IDE chipset support
      #===This will work, but speed is 5-7x faster with specific chipset support
      #            <*> ALI M15x3 chipset support #===your IDE chipset
      #    File systems --->
      #        <*> Ext3 journalling file system support
      #    Cryptographic options  --->
      #        <*>   LZF compression algorithm
      #===This is a good time to set the processor type, if desired [optional]
      #    Processor type and features  --->
      #        Processor family (Athlon/Duron/K7) #===your processor
    11. Install text-mode userui
      Code:
      cd /usr/src/suspend2-userui-0.5.1
      make suspend2ui_text
      cp -p suspend2ui_text /usr/local/sbin
    12. Install hibernate script and configure
      Code:
      cd /usr/src
      alien -i hibernate-1.12-1.i386.rpm 
      gedit /etc/hibernate/hibernate.conf
      #    -> ImageSizeLimit nocache
      #    -> ProcSetting expected_compression 50
      # add-> ProcSetting userui_program /usr/local/sbin/suspend2ui_text
      #    -> SwitchToTextMode no
    13. Set power button to hibernate
      Code:
      gedit /etc/acpi/events/powerbtn
      #    -> action=/usr/sbin/hibernate
      #    -> #action=/etc/acpi/powerbtn.sh
      /etc/init.d/acpid restart
    14. Compile the kernel (get lunch now, takes about an hour on my AMD1700)
      Code:
      cd /usr/src/linux
      make bzImage install modules modules_install
      #cd /boot
      #rm config vmlinuz System.map #optional: remove extra links, less clutter for grub
      update-grub
    15. Read note below about restricted kernel modules, if you are using them: these include madwifi for wireless cards, fglrx for ATI video, and nVidia video cards
    16. Reboot to load the new kernel
    Pressing the power button should now cause hibernation! If the power button does not work on your laptop, in a terminal type:
    Code:
    sudo hibernate
    After hibernating successfully, you can see some statistics by typing
    Code:
    sudo cat /proc/software_suspend/debug_info |grep 'compression\|speed'
    In particular, if the disk read/write speed is about 5 MB/s or less, you probably do not have the correct IDE chipset driver installed, and are using the generic drivers. My speeds on this elderly eMachines laptop are ~35MB/s write, ~45MB/s read with the ALi drivers compiled into the kernel.

    Most common failing is not getting all of the IDE drivers (and ext3 filesystem) compiled into the kernel during make menuconfig. If these are left out, the system will give a "Big Fat Error" on boot, or a "Kernel Panic". If you have to adjust any of these, the re-compile goes much faster, because it only has to compile the changes (step 14).

    Any errors in the "patching the kernel" (step 8) are mine, and Nigel won't want to hear about them. I've tested this on the base Ubuntu kernel, without much added into it, and with the 386 and k7 switches applied. Errors on boot might be the result of missed steps (say, putting swap=/dev/hda3 instead of swap:/dev/hda3 in the Default resume device name, my personal nemesis). Looking through the mailing lists on suspend2 might be able to help, but we should be able to troubleshoot the Most Frequent Misteaks in this thread, check there first.

    Finally, you might be tempted to install the fbsplash userui for suspend2. You are completely on your own there. It has been reported to completely gum up suspend-to-ram, and slow down the hibernation process greatly. The textmode is more trustworthy, and this eMachines 5309 with 512MB RAM hibernates in 6 seconds, and wakes in 8. It's not worth the instability for something that will just flash on the screen for 2/3 of that time; and anyway, that's why you prefer Ubuntu to Windows anyway, it doesn't hide the delicate inner workings of the system from you. Right? Right?

    NOTE re: linux restricted modules
    When you recompile the kernel, you can no longer use any of the Ubuntu linux-restricted-modules packages, so you will have to compile these on your own. These are best done before you reboot the computer, or something will be missing when it comes back up again. And if you do it this way, the modules will have the same internal version (-hibernate) as the kernel. I should be posting a HOWTO: for the madwifi here soon, because I had to do it myself.
    Last edited by Griffin3; November 2nd, 2005 at 11:14 PM. Reason: ajhobbs was right :-)

  2. #2
    Join Date
    Jul 2005
    Beans
    184
    Distro
    The Feisty Fawn Testing

    Re: HOWTO: Suspend2 in Breezy

    What benefit does this provide out of curiosity?

    L

  3. #3
    Join Date
    Jun 2005
    Beans
    41
    Distro
    Ubuntu Breezy 5.10

    Re: HOWTO: Suspend2 in Breezy

    Mostly benefit to laptop users, can suspend-to-disk when you turn off your laptop, and resume right where you left off (as opposed to desktop users who can simply leave their computer on.) I was addicted to this ability under Windows, one can save a snapshot of one's mental state to resume later, without having to think "where was I in what projects?" and "what web pages was I currently reading through?"

    The built-in kernel suspend capability is not usable by as many machines, and is generally less configurable, as it expects hardware support for suspending computer state.

  4. #4
    Join Date
    Jan 2005
    Beans
    6

    Re: HOWTO: Suspend2 in Breezy

    I am thinking of trying this later since hibernate mode is not functioning on my laptop. I do have suspend to RAM (sleep mode) working, will doing this affect that? Any drawbacks to not doing via hardware? Either way it looks to be a well written guide and it'll fix my biggest problem with ubuntu on my laptop, so thanks ahead of time.

  5. #5
    Join Date
    Oct 2005
    Beans
    3

    Re: HOWTO: Suspend2 in Breezy

    Generally better to NOT set or enable a password for root. Insteady you can use

    Code:
    sudo -s
    Which gives you a root shell via sudo without a need of enabling root.

  6. #6
    Join Date
    Jun 2005
    Beans
    41
    Distro
    Ubuntu Breezy 5.10

    Re: HOWTO: Suspend2 in Breezy

    crobe: one of the instructions in the HOWTO: specifically turns off the existing support for suspend-to-ram, that is:
    Code:
    make menuconfig
    #        [ ]   Software Suspend (EXPERIMENTAL)
    If you did not do this, the suspend-to-RAM should still be functional. I have never tested it that way; I just thought it would be better to not have any possible interference.

    Let us know how it turns out.

  7. #7
    Join Date
    Sep 2005
    Location
    Trinidad, Caribbean
    Beans
    591
    Distro
    Ubuntu 6.06

    Re: HOWTO: Suspend2 in Breezy

    If I am correct, doesn't Breezy now use gcc 4.0.1 or greater as the default compiler? Would setting CC to an earlier version of gcc cause any problems? Secondly, would this work if my filesystem is reiser?

    I'll definitely want to give it a go!

    Thanks
    Last edited by chanders; October 18th, 2005 at 07:09 PM.

  8. #8
    Join Date
    Jun 2005
    Beans
    41
    Distro
    Ubuntu Breezy 5.10

    Re: HOWTO: Suspend2 in Breezy

    Ubuntu does indeed use gcc4.0.2, but the kernel requires gcc 3.4 in order to compile. I believe that the 2.6.12 kernels were sort of a transition, they are possible to compile with gcc4 if you tweak them, but the standard way to do it is with gcc3.4. I think the 2.6.13 kernel comes ready to compile with gcc4. http://ubuntuforums.org/showthread.php?t=75651 has some more information (but nothing very useful).

    No problem if your filesystem is ReiserFS, except in the make menuconfig (step 10) make sure you mark ReiserFS as compiled into the kernel (instead of ext3). Since the suspend2 starts to restore the image right after the kernel loads, but before any modules or drivers, the filesystem support must be compiled into the kernel. If not, you get a "BIG FAT ERROR" on boot; I don't know if this is Nigel's humor, or someone on the kernel team ...

  9. #9
    Join Date
    Sep 2005
    Location
    Trinidad, Caribbean
    Beans
    591
    Distro
    Ubuntu 6.06

    Re: HOWTO: Suspend2 in Breezy

    Great news, good news, not-so-good news....

    Great news....
    Firstly everything worked perfectly.... I absolutely love how fast this method works.... Clean and nice.....

    Good news....
    This was with the bundled nv driver which comes with Ubuntu. I would advise everyone with a laptop to install this.....

    Not-so-good news....
    I need to get hardware acceleration working. I recompiled the NVidia driver 7676 driver to work with the -hibernate driver. The driver works perfectly, except that suspend2 stops working.

    I monitored what happens when the power button is pressed and I think when it comes to unloading the nvidia module it stops. Just for the heck of it I tried unloading the nvidia module from console 1 and I get

    FATAL: Module nvidia is in use.

    I did read on the suspend2.net wiki site that some people got it to work. it required them to do one aditional patch to the nv.c file...

    "Version 1.0.7676 needs this patch at line 3667"

    however I cant find the nv.c file! Maybe you can give me some insight on this?

    In the mean time however the only way I can get it to work is by logging out of X, killing GDM and unloading module nvidia. Then I can hibernate....

    I am sure there are hundreds of us who gave up on getting hibernate to work with the Nvidia driver on our laptops. I feel like we are so close, any input from anyone would be appreciated.....

  10. #10
    Join Date
    Oct 2005
    Beans
    41

    Re: HOWTO: Suspend2 in Breezy

    Suspend2 has been a desire of mine since I found it at Suspend2.net. I'm currently running the 2.6.12-9-686-smp kernel. Your software-suspend-2.1.9.9-for-2.6.12-ubuntu5.10.tar.bz2 unfortunately is not for the kernel that I'm using. Do you have any suggestions for getting Suspend2 to work with the 2.6.12-9686-smp kernel? Maybe a list of the tweaks you made to the Suspend2 package?

    TIA

    hedge

Page 1 of 21 12311 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •