# suspend to ram and network

## ufayzull

Hi,

I'm trying to get this suspend to ram to work.

My script is pretty simple, consists of just this line:

```
#echo -n "mem" > /sys/power/state
```

Everything works, except when the PC wakes up the network doesn't work anymore. I can't ping anything and basically I have to restart network with 

```
#/etc/init.d/net.eth0 restart 
```

The motherboard is ASUS A8N-E and I'm using integrated nVidia gigabit NIC with forcedeth driver.

Uname info:

```

# uname -a

Linux snow 2.6.19-beyond4 #3 SMP Fri Feb 16 23:34:38 EST 2007 x86_64 AMD Athlon(tm) 64 Processor 3200+ AuthenticAMD GNU/Linux

```

Does anyone have ideas on this? TIA.

----------

## opentaka

Bringing down the interface and restarting the interface should work:

/etc/hibernate/common.conf

```

### network

DownInterfaces eth0

UpInterfaces eth0

```

or if this does not work, try editing the line in the same file: 

```

### services

RestartServices net.eth0

```

----------

## ufayzull

opentaka,

Could you please clarify this for me.

So what you saying is that after waking from suspend the network is always down no matter what, and it does not depend on my NIC or the NIC's driver? And it is the nature of suspend? So before going into the suspend mode I have to bring my ethNs down and then during wakeup I have to bring them back up again?

Or are you suggesting this as a fix to the problem I have?

Thank you.

----------

## ufayzull

Another thing, what package is /etc/hibernate/common.conf is part of?

I'm not using it on a laptop (well I guess you know it already the motherboard is ASUS A8N-E), and all I have is "sys-power/acpid-1.0.4-r3" package. I listen to the power button and when it is pressed i just issue "echo -n "mem" > /sys/power/state".

It doesn't really matter thou, I could add "/etc/init.d/net.eth0 stop" on suspend and "/etc/init.d/net.eth0 start" on wakeup.

----------

## opentaka

 *ufayzull wrote:*   

> Another thing, what package is /etc/hibernate/common.conf is part of?
> 
> I'm not using it on a laptop (well I guess you know it already the motherboard is ASUS A8N-E), and all I have is "sys-power/acpid-1.0.4-r3" package. I listen to the power button and when it is pressed i just issue "echo -n "mem" > /sys/power/state".
> 
> It doesn't really matter thou, I could add "/etc/init.d/net.eth0 stop" on suspend and "/etc/init.d/net.eth0 start" on wakeup.

 

Ah, I thought you are using suspend2, which I strongly recommend:

http://gentoo-wiki.com/HOWTO_Software_Suspend_v2

----------

## Mad Merlin

Suspend 2 is more like suspend to disk than suspend to RAM. IMO, Suspend 2 is a workaround for machines with buggy or missing suspend to RAM implementations. While Suspend 2 may be better than nothing, suspend to RAM is substantially better than Suspend 2, as suspend to RAM is nearly instantaneous for both suspend and resume.

----------

## widremann

 *Mad Merlin wrote:*   

> Suspend 2 is more like suspend to disk than suspend to RAM. IMO, Suspend 2 is a workaround for machines with buggy or missing suspend to RAM implementations. While Suspend 2 may be better than nothing, suspend to RAM is substantially better than Suspend 2, as suspend to RAM is nearly instantaneous for both suspend and resume.

 

It's not an either-or type thing.  There are pros and cons of each...it depends on what you are doing.  Suspend to RAM is quick, yes, but it also uses battery, so eventually you may run out of battery.  Suspend to disk doesn't use battery and also allows you to boot to other operating systems even while suspended.  It may be a little slower, but that's usually not a big deal.

----------

## opentaka

 *Mad Merlin wrote:*   

> Suspend 2 is more like suspend to disk than suspend to RAM. IMO, Suspend 2 is a workaround for machines with buggy or missing suspend to RAM implementations. While Suspend 2 may be better than nothing, suspend to RAM is substantially better than Suspend 2, as suspend to RAM is nearly instantaneous for both suspend and resume.

 

suspend2 = hibernate + hibernate-ram ; !=swsusp

----------

## Mad Merlin

 *widremann wrote:*   

>  *Mad Merlin wrote:*   Suspend 2 is more like suspend to disk than suspend to RAM. IMO, Suspend 2 is a workaround for machines with buggy or missing suspend to RAM implementations. While Suspend 2 may be better than nothing, suspend to RAM is substantially better than Suspend 2, as suspend to RAM is nearly instantaneous for both suspend and resume. 
> 
> It's not an either-or type thing.  There are pros and cons of each...it depends on what you are doing.  Suspend to RAM is quick, yes, but it also uses battery, so eventually you may run out of battery.  Suspend to disk doesn't use battery and also allows you to boot to other operating systems even while suspended.  It may be a little slower, but that's usually not a big deal.

 

Certainly in this case (a desktop machine), battery consumption is not an issue, and for a laptop, it's really not an issue unless you're leaving the laptop suspended and unplugged for days or weeks at a time (a use case I've never encountered).

I also don't dual boot any of my machines, so being able to boot another OS while one is suspended also isn't an interesting use case to me.

Mind you, I do suspend and resume my main laptop quite frequently, so any loss of speed there would be glaringly obvious.

----------

## ufayzull

I installed "hibernate-script" and added DownInterfaces eth0, UpInterfaces eth0 to the common.conf.

Everything seems to work fine. 

I'm curious thou, Mad Merlin, do you have to stop and start eth0 during suspend? Or is it NIC/driver specific issue?

----------

## Mad Merlin

 *ufayzull wrote:*   

> I'm curious thou, Mad Merlin, do you have to stop and start eth0 during suspend? Or is it NIC/driver specific issue?

 

No, I don't need to restart any of my net devices when suspending and resuming, it's likely a NIC/driver specific problem.

----------

## ufayzull

OK, I'll just go with stopping eth0 for now.

Thanks for all the input!

----------

