# Simple suspend2 kernel sources question

## Nazgulled

I'm following the wiki howto (http://gentoo-wiki.com/HOWTO_Software_Suspend_v2) to install suspend and I've already emerged and "compiled" the latest stable suspend2-sources but I have some doubts.

suspend2-sources is like a few kbytes download, while the gentoo-sources were like 30mb... on the howto, says to change the /usr/src/linux symlink to the suspend2-sources. How will all this work? I mean, how can a kernel have only some kbs and another have some mbs? Isn't something wrong here or am I missing something?

----------

## masteroftheuniverse

do an emerge sync.

i just did a emerge -pv suspend2sources and the download is about 39MB.

----------

## beatryder

 *Quote:*   

> suspend2-sources is like a few kbytes download, while the gentoo-sources were like 30mb... on the howto, says to change the /usr/src/linux symlink to the suspend2-sources. How will all this work? I mean, how can a kernel have only some kbs and another have some mbs? Isn't something wrong here or am I missing something?

 

It has to do with the way portage downloads things. You see it downloads a clean source tarball and then patches it.

So when you downloaded the suspend2 sources, its very likely that you had the kernel source code already in /usr/portage/distfiles/ and so portage only downloaded what it needed. Since gentoo-sources and suspend2-sources are based on the same kernel source code, why would it download it twice?

----------

## Nazgulled

You are right, just checked and the folders and they occupy basically the same space... another question though...

quoting from the how to:

 *Quote:*   

> Initrd/Initramfs's with Suspend2
> 
> Using an initrd with Suspend2 is possible. To use this, you MUST edit your linuxrc (or init) script to contain the line:
> 
> echo > /proc/suspend2/do_resume

 

I did not use genkernel, I used make menuconfig and did everything manually, where is this init script in which I must change to add the above line?

----------

## beatryder

Thats a good question

I dont appear to have either linuxrc or inputrc.  I have never had to do that myself, and I use the initrd.

----------

## Nazgulled

where is that one?

----------

## beatryder

 *Quote:*   

> 
> 
> Using an initrd with Suspend2 is possible....
> 
> 

 

I have an initrd for fbsplash

----------

## Nazgulled

yeah, sorry, I was confusing myself... but are u using suspend2? and did not add that line anywhere and it's working without any data corruption?

and howcome, the latest gentoo-sources is 2.6.15-r7 not stable and suspend2-sources is 2.6.15-r8 stable?

----------

## Nazgulled

well, I tried it... without that line and so far seems to be working fine, can't really tell if I lost any data after coming from hibernation but I don't think so... at elast I had some apps and games opened (just to test), which I left without saving and such and they all restaured just fine...

however, hibernate-ram script, it's not working :S when I get back from hibernation, the screen stays black... any hints?

maybe because I have the ACPI video setting set as module? I still have to go through the rest of the HOW-TO and configure hibernate.conf though...

----------

## beatryder

Ok, I am going you give you a chance to redeem your self and prove that you are as intelligent as I would like to think.

Sorry if this seems like a flame.... But you should go back and read the ENTIRE how to.

I found the answer to your question in about 2 seconds by reading carefully, the answer is there. If you still can't find it. I will help you.

----------

## Nazgulled

if you are talking about this:

 *Quote:*   

> Hint: Should resuming not work for some reason, you have to add noresume2 (and maybe also noresume) to your kernel options when booting.

 

it won't help me... my problme is not resuming from the failed hibernation, I just shuted down the computer and turned it back on and I was able to boot... if I had that noresume2 option I don't think I will be able to resume at all at any of times I try to hibernate, either to disk or to ram...

can't find any other relevant info about my problem...

----------

## beatryder

 *Quote:*   

> Using an initrd with Suspend2 is possible. To use this, you MUST edit your linuxrc (or init) script to contain the line 
> 
> echo > /proc/suspend2/do_resume
> 
> BEFORE the script mounts your filesystem. If the line is missing, your system will not resume. If the line comes after mounting file systems, you will most likely suffer from filesystem corruption. You have been warned. 
> ...

 

note they say it is possible to use an initrd, not that you have to.

----------

## beatryder

 *Nazgulled wrote:*   

> if you are talking about this:
> 
>  *Quote:*   Hint: Should resuming not work for some reason, you have to add noresume2 (and maybe also noresume) to your kernel options when booting. 
> 
> it won't help me... my problme is not resuming from the failed hibernation, I just shuted down the computer and turned it back on and I was able to boot... if I had that noresume2 option I don't think I will be able to resume at all at any of times I try to hibernate, either to disk or to ram...
> ...

 

the noresume2 option PREVENTS resuming.

here is my grub conf

 *Quote:*   

> 
> 
> title           Gentoo (resume)
> 
> root            (hd0,1)
> ...

 

The top entry is for resuming, and the bottom is force it not to resume.

the relevant bits are in bold

Also, one other thing you can do to save your self from some data loss, is to run

```

# sync

```

before you call your hibernate script. This will force the kernel to flush all the read/write buffers on your hard drive(s) to be flushed, thereby making sure that all data is written to the disk. This will not prevent fsck from complaining about not being properly unmounted, but it will help a great deal to prevent data loss.

----------

## Nazgulled

1) about the initrd, I knew it was possible and that I wansn't forced too.. but I wanted to have one...

2) I appreciate everything else you just said, but that din't help, I know the noresume2 option will prevent the system from resuming but that's not my problem... I can boot anyway into gentoo, all I'm having problems with is with the hibernate-ram script, when I use it and try to get back to the system, it fials, the screen stays weird and nothing happens. but after that, I turn off the computer manually, boot again into linux (in a kernel without the noresume2 option) and I still can boot into the system...

Maybe I'm missing something on hibenate.conf, like reloading a video module or something, cause it seems to me that the resume itself is successful but I only can't get the display to work correctly...

----------

## beatryder

Oh FYI:

/etc/hibernate/ram.conf is for hibernate-ram

/etc/hibernate/hibernate.conf is for hibernate

so make sure you are editing the right one.

----------

## Nazgulled

thanks, will take a look at it when I got the time...

----------

## dundas

I'm guilty for bookmarking this page without contributing.

----------

## Nazgulled

 *dundas wrote:*   

> I'm guilty for bookmarking this page without contributing.

 

what?

----------

## dundas

oh, I just mean, I am very interested in this topic, so I replied to receive the updates from it, but I haven't tried, and therefore can't offer any useful opinions at this time.

never mind.

hope my English is getter better, hehe.

----------

## beatryder

You dont have to post to get updates, you can just click the subscribe link at the top. "Watch this topic"

----------

## dundas

 *beatryder wrote:*   

> You dont have to post to get updates, you can just click the subscribe link at the top. "Watch this topic"

 

thx beatryder, sorry about that.

[EDIT], I noticed for me that link is at the bottom, very hard to see.

----------

## beatryder

No need to apologize, I only recently noticed it my self. Till then I was doing what you did.

----------

