LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Hibernate/suspend with two swap partitions (https://www.linuxquestions.org/questions/linux-hardware-18/hibernate-suspend-with-two-swap-partitions-570832/)

ordealbyfire83 07-19-2007 09:28 PM

Hibernate/suspend with two swap partitions
 
Hello,
I finished setting up a laptop with two linux distributions (Ubuntu Fiesty and Fedora 7 x86_64) and would like to get each of them to be able to hibernate/suspend without interfering with the other.

My current hard drive partitioning looks something like this:

sda 5 = ~2 GB swap -- for Ubuntu
sda 6 = ~60 GB ext3 (Ubuntu)
sda 7 = ~2 GB swap -- for Fedora
sda 8 = ~83 GB (Fedora)

(sda4 includes 5-8) and sda1,2,3 are preinstalled recovery partitions.

I have edited the file /etc/fstab in Fedora such that sda7 is listed as swap and sda5 has been removed. sda7 is not registered in any way in the /etc/fstab file in Ubuntu, or so I think.

Ubuntu will hibernate just file; however it will not resume if I attempt to hibernate Fedora--which hangs because it does not "understand" for some reason that sda7 is where it is supposed to write to disk when suspending. However, when booting Fedora, it states quickly on the screen that it attempted to resume from sda5, which is my Ubuntu hibernation but as it recognized that something was wrong, it booted from scratch without any problems. But then Ubuntu would not boot from this suspended session after Fedora "detected" it.

So, I am wondering if it is possible to "designate" swap partitions for each OS in a way other than by editing /etc/fstab if this is not enough. Alternatively, is it possible to hibernate to an actual file on the OS partitions (in my case sda6 and sda8), that is, without using swap?

Thanks for your help in advance :-)

syg00 07-19-2007 09:38 PM

Depends on which hibernate package(s) you are using.
Good place to start would be to have a look at the resume keyword on the respective bootloaders.

jschiwal 07-19-2007 09:46 PM

Code:

title openSUSE 10.2 - 2.6.18.8-0.5
    root (hd0,4)
    kernel /boot/vmlinuz-2.6.18.8-0.5-default root=/dev/hda5 vga=791 nolapic resume=/dev/hda2 splash=silent showopts
    initrd /boot/initrd-2.6.18.8-0.5-default

Make sure that the resume= entries in the respective stanzas use a different swap partition. If you weren't trying to do this there would be no good reason for having 2 swap partitions.

ordealbyfire83 07-20-2007 02:53 PM

Thanks for the responses. I have added resume keywords on the respective boot entries and now I have the following as primary entries.

title Fedora (2.6.21-1.3194.fc7)
root (hd0,7) kernel /boot/vmlinuz-2.6.21-1.3194.fc7 ro root=LABEL=/ rhgb quiet resume=/dev/sda7
initrd /boot/initrd-2.6.21-1.3194.fc7.img

title Ubuntu, kernel 2.6.20-15-generic
root (hd0,5)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=d01c1070-53f5-4f01-9602-5ed044745790 ro quiet resume=/dev/sda5 splash
initrd /boot/initrd.img-2.6.20-15-generic

Now I can hibernate and resume Ubuntu regardless of whether Fedora is booted in any way. However, Fedora still doesn't hibernate--it hangs upon "Suspending Consoles."

I have also experimented with vga=791 (whatever that is) as well as nolapic in the bootloader. This just changed the look and feel of the bootup/shutdown text but still hung on "Suspending Consoles."

It appears that others with hibernate problems have used "suspend2" effectively, and I looked into it (http://www.mhensler.de/swsusp/index_en.php) and have downloaded via yum the x86_84 files but this too doesn't work. I invoked this as 'hibernate' whilst logged in as root, and the process hangs on a screen that reads "Doing atomic copy" while the text-based progress bar (not using the gui) is around 3/4 of the way finished. This version of suspend2 gives another kernel that appears on the bootloader, which must be selected in order for suspend2 to be used; I have also tried changing the resume to be

resume2=swap:/dev/sda7 (http://gentoo-wiki.com/HOWTO_Software_Suspend_v2)

before booting, which didn't change anything.

I'm not sure what to try next. I'm wondering whether hibernating on Fedora 7 is even possible...

jschiwal 07-20-2007 04:35 PM

You might want to install the kernel source. There may be information in the kernel documentation. Also, examine the .config for your Fedora 7 kernel. Does suspending require a kernel setting that wasn't set, or maybe even unset. If there is more than one way that suspending can work, maybe your Fedora 7 installation is trying to use more than one, causing a hangup. Another thing that can cause a problem is if the swap partition is too small, but that doesn't look like it is the case here unless you have more than 2 GB of memory in use.

In the second link you supplied, the kernel option given is "resume2=" and not "resume=". See if your Fedora 7 kernel is similar to this example. Maybe you need to change the Fedora 7's grub stanza from "resume=/dev/hda7" to "resume2=/dev/hda7.

syg00 07-20-2007 06:47 PM

Different package - I think Fedoara uses the original (in-kernel) suspend support.

Try noresume (and re-boot) first to "clean up", then set resume back again (for Fedora).

ordealbyfire83 07-23-2007 11:53 AM

Thanks for the posts.

(1) Using resume2=... instead didn't work either...

(2) Yes, apparently there are at least two ways of "hibernating," but I'm not sure what each is supposed to do as opposed to what they actually do.

I have another desktop computer running FC5 that hibernates with no problem. But in FC5, when clicking System -> Shut Down, the options are Suspend, Shutdown, Cancel, etc (don't remember the order, but no 'hibernate') and I click "Suspend" and apparently this means suspend to disk (rather than ram, as I can switch off the power strip and no data is lost).

(...Now I'm booting the laptop using the standard kernel, as opposed to the one used by suspend2.)

But in FC7 this button is labelled "hibernate" instead. Is this really something different? Also, if I left-click on the battery icon, two options appear: suspend and hibernate. Is this 'hibernate' the same as the FC7 hibernate? The 'suspend' option doesn't work either (everything hangs on 'suspending consoles,' as the hard drive turns off but nothing else does apparently). (But after the failed 'suspend' I can get to the grub menu on reboot as opposed to automatically fresh-booting Fedora after (both) failed 'hibernate's.

Is there another external package that can be used (other than suspend2, of course) that doesn't use these tools, or eg, some way to restore FC5-style suspend?

Also could there be a problem with my swap? My (Fedora) "swap use" is always precisely zero bytes (out of 2 GB) in the System Monitor--which doesn't seem possible.

Thanks again.

syg00 07-27-2007 05:29 PM

Did you do as I suggested ???. These changes need to be done to the boot-loader script.

ordealbyfire83 07-30-2007 12:11 PM

Yes, I did try different options with 'resume' in the bootloader. But that didn't work. After backing up my files, I decided to reinstall FC7, while leaving Ubuntu untouched. Note that Ubuntu was hibernating on sda5 while this whole install was going on, and that I told the Fedora installer NOT to format the swap partition sda5 (apparently the install wizard thought sda5 was the ONLY swap here...)

Install completed, but there are some changes regarding previous posts. sda7 is now the Fedora OS, and sda8 is now its swap. I applied several system updates through the Package Updater but not all of them (of the 139 available, I only did the following):

gnome-power-manager updated to 2.18.3-1.fc7.x86_64
hal-cups-utils updated to 0.6.9.2-1.fc7.x86_64
kernel updated to 2.6.22.1-33.fc7.x64_64 [from 2.6.21-1.3194.fc7.x86_64]
kernel-devel ...
kernel-headers ...

as well as the dependencies mkinitrd-6.0.9-7.1; nash-6.0.9-7.1

Applied updates, rebooted using new kernel.

Clicked System, Shut Down, Hibernate, and everything appeared to hibernate appropriately!

Resumed Fedora, edited the /boot/grub/menu.lst to include Ubuntu.

Hibernated and rebooted Fedora again, then shut down Fedora completely. Restarted, selected Ubuntu, and it resumed to where I left off before reinstalling Fedora.

The /boot/grub/menu.lst instructions are as follows:

title Fedora (2.6.22.1-33.fc7) // this section generated during install
root (hd0,6)
kernel /boot/vmlinuz-2.6.22.1-33.fc7 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.22.1-33.fc7.img

title Ubuntu, kernel 2.6.20-15-generic // added 'by hand' after install
root (hd0,5)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=d01c1070-53f5-4f01-9602-5ed044745790 ro quiet resume=/dev/sda5 splash
initrd /boot/initrd.img-2.6.20-15-generic
quiet

Notice that there is no resume=... for Fedora. Apparently sda8 is registered as the swap somewhere, although in (Fedora's) fstab I have (generated automatically during install)

LABEL=SWAP=sda81 swap swap defaults 0 0 << why 81 ???

So, this basically works as expected; however, the only (minor) issue is that after hibernating Fedora, I don't get the grub menu on restart so as to choose FC7/Ubuntu. Rather it automatically resumes FC7. Perhaps there is some command to be added to the bootloader?


All times are GMT -5. The time now is 02:16 AM.