# Suspend 2 + Sata Hard Drive => kernel panic?!

## Sunnz

Has anyone tried to get Suspend2 to work with a Sata Hard Drive?

I have /dev/sda2 as my swap partition.

I have configured, compiled, and installed suspend2-sources.

I passed resume2=swap:/dev/sda2 in the kernel options, and tried to reboot into it.

It just gives a "Big Fat Warning" that it can't translate /dev/sda2 into a device id.

I have double checked, sda2 is indeed my swap partition and is working. It has twice the size as my RAM too.

Note that I have NOT attempted to suspend yet, I just want to reboot into the new kernel.

----------

## peterk0

 *Sunnz wrote:*   

> Has anyone tried to get Suspend2 to work with a Sata Hard Drive?
> 
> I have /dev/sda2 as my swap partition.
> 
> I have configured, compiled, and installed suspend2-sources.
> ...

 

it could be caused by lot of  things ...

1,check your kernel config, if you have swap writer enabled

```
CONFIG_SUSPEND2_SWAP=y
```

2, maybe post your relevant part od kernel config and grub config, followed by fstab output listing your partitions

----------

## Sunnz

I am not sure which part are most relevent, but I'll try my best, tell me if there anything else missing:

```
#

# Power management options

#

CONFIG_PM=y

CONFIG_PM_LEGACY=y

# CONFIG_PM_DEBUG is not set

# CONFIG_PM_SYSFS_DEPRECATED is not set

# CONFIG_SOFTWARE_SUSPEND is not set

CONFIG_SUSPEND_SMP=y

CONFIG_SUSPEND2_CRYPTO=y

CONFIG_SUSPEND2=y

#

# Image Storage (you need at least one allocator)

#

# CONFIG_SUSPEND2_FILE is not set

CONFIG_SUSPEND2_SWAP=y

#

# General Options

#

CONFIG_SUSPEND2_DEFAULT_RESUME2="s20"

# CONFIG_SUSPEND2_KEEP_IMAGE is not set

CONFIG_SUSPEND2_REPLACE_SWSUSP=y

CONFIG_SUSPEND_SHARED=y

#

# ACPI (Advanced Configuration and Power Interface) Support

#

CONFIG_ACPI=y

CONFIG_ACPI_SLEEP=y

CONFIG_ACPI_SLEEP_PROC_FS=y

# CONFIG_ACPI_SLEEP_PROC_SLEEP is not set

# CONFIG_ACPI_AC is not set

# CONFIG_ACPI_BATTERY is not set

CONFIG_ACPI_BUTTON=y

# CONFIG_ACPI_VIDEO is not set

# CONFIG_ACPI_HOTKEY is not set

CONFIG_ACPI_FAN=y

# CONFIG_ACPI_DOCK is not set

CONFIG_ACPI_PROCESSOR=y

CONFIG_ACPI_HOTPLUG_CPU=y

CONFIG_ACPI_THERMAL=y

# CONFIG_ACPI_ASUS is not set

# CONFIG_ACPI_IBM is not set

# CONFIG_ACPI_TOSHIBA is not set

CONFIG_ACPI_BLACKLIST_YEAR=0

# CONFIG_ACPI_DEBUG is not set

CONFIG_ACPI_EC=y

CONFIG_ACPI_POWER=y

CONFIG_ACPI_SYSTEM=y

CONFIG_X86_PM_TIMER=y

CONFIG_ACPI_CONTAINER=y
```

=========================================================================

Grub:

```
default 0

fallback 2

timeout 5

#splashimage=(hd0,0)/boot/splash.xpm.gz

title=Suspend2

root (hd0,0)

kernel /boot/four root=/dev/sda3 resume2=swap:/dev/sda2

title=Suspend2 noresume2

root (hd0,0)

kernel /boot/four root=/dev/sda3 resume2=swap:/dev/sda2 noresume2

title=Gentoo

root (hd0,0)

kernel /boot/new3 root=/dev/sda3

```

=========================================================================

fstab:

```
# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/sda1               /boot           ext2            noauto,noatime  1 2

/dev/sda3               /               xfs             noatime 0 1

/dev/sda4               /home           xfs             noatime,nodev,nosuid 0 1

/dev/hda1               /mnt/wd250      xfs             noatime,nodev,noexec,nosuid 0 1

/dev/sda2               none            swap            sw              0 0

/dev/cdroms/cdrom0      /mnt/cdrom      auto            noauto,ro,user,nosuid,noexec,nodev      0 0

/dev/fd0                /mnt/floppy     auto            noauto,user,nosuid,noexec,nodev         0 0

# NOTE: The next line is critical for boot!

proc                    /proc           proc            defaults        0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for

# POSIX shared memory (shm_open, shm_unlink).

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will

#  use almost no memory if not populated with files)

none                    /dev/shm        tmpfs           nodev,nosuid,noexec    0 0
```

=========================================================================

Just in case you think it is something to do with compression:

```
#

# Cryptographic options

#

CONFIG_CRYPTO=y

CONFIG_CRYPTO_ALGAPI=y

CONFIG_CRYPTO_BLKCIPHER=y

CONFIG_CRYPTO_HASH=y

CONFIG_CRYPTO_MANAGER=y

CONFIG_CRYPTO_HMAC=y

CONFIG_CRYPTO_NULL=y

CONFIG_CRYPTO_MD4=y

CONFIG_CRYPTO_MD5=y

CONFIG_CRYPTO_SHA1=y

CONFIG_CRYPTO_SHA256=y

CONFIG_CRYPTO_SHA512=y

CONFIG_CRYPTO_WP512=y

CONFIG_CRYPTO_TGR192=y

CONFIG_CRYPTO_ECB=m

CONFIG_CRYPTO_CBC=y

CONFIG_CRYPTO_DES=y

CONFIG_CRYPTO_BLOWFISH=y

CONFIG_CRYPTO_TWOFISH=y

CONFIG_CRYPTO_TWOFISH_COMMON=y

# CONFIG_CRYPTO_TWOFISH_X86_64 is not set

CONFIG_CRYPTO_SERPENT=y

CONFIG_CRYPTO_AES=y

CONFIG_CRYPTO_AES_X86_64=y

CONFIG_CRYPTO_CAST5=y

CONFIG_CRYPTO_CAST6=y

CONFIG_CRYPTO_TEA=y

CONFIG_CRYPTO_ARC4=y

CONFIG_CRYPTO_KHAZAD=y

CONFIG_CRYPTO_ANUBIS=y

CONFIG_CRYPTO_DEFLATE=y

CONFIG_CRYPTO_LZF=y

CONFIG_CRYPTO_MICHAEL_MIC=y

CONFIG_CRYPTO_CRC32C=y

CONFIG_CRYPTO_TEST=m
```

----------

## DirtyHairy

[Uuups - sorry, didn't read fully through your post, this doesn't apply to you (yet  :Smile:  )]

AFAIK, suspending and resuming don't work with SATA in stock kernels yet - the kernel fails to re-initialize the disk after a resuming. There is a patch floating around on the web somewhere that adds the necessary stuff, a version can be found http://vizzzion.org/stuff/thinkpad-t60/. Also, the patch was accepted into sata git some days ago, if I remember correctly.

----------

## peterk0

 *DirtyHairy wrote:*   

> [Uuups - sorry, didn't read fully through your post, this doesn't apply to you (yet  )]
> 
> AFAIK, suspending and resuming don't work with SATA in stock kernels yet - the kernel fails to re-initialize the disk after a resuming. There is a patch floating around on the web somewhere that adds the necessary stuff, a version can be found http://vizzzion.org/stuff/thinkpad-t60/. Also, the patch was accepted into sata git some days ago, if I remember correctly.

 

hm, that's wierd because i'm using vanilla-2.6.19.1 with suspend2-2.2.9 without any additional patches and everything works just fine. i'm with ahci sata intel ich7 on thinkpad z61m.

----------

## peterk0

Sunnz, you have a mistake in your kernel config, CONFIG_SUSPEND2_DEFAULT_RESUME2 should be set to your swap ...

```
CONFIG_SUSPEND2_DEFAULT_RESUME2="swap:/dev/sda2"
```

----------

## DirtyHairy

Hmmm, VERY interesting, 'cause this is the reason I avoided 2.6.19 for until now. I can't find any traces of the patch in the sources 2.6.19, and I definitely needed the patch on a T60 with 2.6.17 (and I did see that patch added in the git log)... Since it is needed for suspend to RAM, I assumed that it would be needed for software suspend as well, but I might be wrong on that. I guess I should try out when I find time  :Smile: 

----------

## Sunnz

 *peterk0 wrote:*   

> Sunnz, you have a mistake in your kernel config, CONFIG_SUSPEND2_DEFAULT_RESUME2 should be set to your swap ...
> 
> ```
> CONFIG_SUSPEND2_DEFAULT_RESUME2="swap:/dev/sda2"
> ```
> ...

 

Done.

Still got the same old problem... "cannot translate device id".

Any other ideas??

P.S. On Google I seen some people say the Sata driver may not have loaded yet... could this be happening in Gentoo as well?

----------

## peterk0

 *Sunnz wrote:*   

>  *peterk0 wrote:*   Sunnz, you have a mistake in your kernel config, CONFIG_SUSPEND2_DEFAULT_RESUME2 should be set to your swap ...
> 
> ```
> CONFIG_SUSPEND2_DEFAULT_RESUME2="swap:/dev/sda2"
> ```
> ...

 

well, if your sata drivers and other requirements are compiled in kernel and not loaded as modules, it should not happen.

i was wondering if you made 

```
make distclean
```

 or 

```
make mrproper
```

 before you recompiled your kernel, sometimes it helps. (sometimes not, but you're willing to try anything right?)

anyway, maybe put down some information about your hadware especially sata stuff (maybe also relevant kernel config parts).

----------

## Sunnz

 *peterk0 wrote:*   

> 
> 
> well, if your sata drivers and other requirements are compiled in kernel and not loaded as modules, it should not happen.
> 
> anyway, maybe put down some information about your hadware especially sata stuff (maybe also relevant kernel config parts).

 I think they are compiled in the kernel, not modules... here's the full .config for your referrence: http://rafb.net/paste/results/vyHJN086.html

My hardware:

AMD Opteron 185 2.6ghz Dual Core

Mobo: Gigabyte GA-K8N Pro-SLI

HDD Sata: WD Raptor 74GB WD740ADFD (/dev/sda1 = /boot(ext2); /dev/sda2 = SWAP; /dev/sda3 = /(XFS); /dev/sda4 = /home(XFS))

HDD IDE: WD 250GB (/dev/hda1 = /home/me/space (XFS))

DVD-IDE.

----------

## Sunnz

 *peterk0 wrote:*   

> i was wondering if you made 
> 
> ```
> make distclean
> ```
> ...

 

Yes I am willing to try... unfortunately it did not work...

----------

## DirtyHairy

Does the kernel boot if you don't specifiy the resume partition? Can you post the parts of your kernel config relevant to sata? Which version are you compiling? Also, what comes to my mind, if you have also suppport for IDE compiled into your kernel, then this will override SATA, and you controller will not only run in IDE compatibility mode, but also will you drives be named /dev/hda[x] nstead of /dev/sda[x]

----------

## Sunnz

 *DirtyHairy wrote:*   

> Does the kernel boot if you don't specifiy the resume partition? Can you post the parts of your kernel config relevant to sata? Aslo, which version are you compiling?

 

You mean like this?

```
kernel /boot/four root=/dev/sda3 resume2
```

I'll try it now.

But, I have tried the following and didn't work:

```
kernel /boot/four root=/dev/sda3 resume2=swap:/dev/sda2 noresume2
```

I don't know which part of the kernel config is the Sata driver... they just work when I booted up in gentoo-sources. Here's the whole config: http://rafb.net/paste/results/vyHJN086.html

I am on gentoo-sources-2.6.17-r8 now. I am trying and having trouble booting into linux-2.6.19-suspend2.

----------

## Sunnz

 *DirtyHairy wrote:*   

> Does the kernel boot if you don't specifiy the resume partition?

 

Ok, I have tried that, but since the default swap setting in the kernel, it still try to use /dev/sda2 and still can't translate device id for it.

----------

## Sunnz

 *DirtyHairy wrote:*   

> If you have also suppport for IDE compiled into your kernel, then this will override SATA, and you controller will not only run in IDE compatibility mode, but also will you drives be named /dev/hda[x] nstead of /dev/sda[x]

 

Yes, that's why I have (hd0,0) in the grub entry.

But root=/dev/sda3 needs to be sda3 - not /dev/hda2 nor /dev/hda3; or it won't work.

I also tried /dev/hda2, it couldn't find the partition at all! hda which I think is the IDE HDD, has only 1 partition.

----------

## DirtyHairy

This doesn't have anything to do with grub; the bootloader is active before the kernel loads... Your configuration shows that your kernel is configured for IDE and not for SATA at all. To get this working, I would advise you to remove the ATA/ATAPI support section completely and then activate ATA device support. You'll have to select the correct SATA chipset driver there (do lspci to find the correct setting) and remember to build it INTO the kerner and not as a module  :Wink:  Also, make sure you don't select any PATA driver here that might conflict with the SATA driver (although I am not sure if this could happen, the handling of ATA stuff has changed from 2.6.18 to 2.6.19)...

[Edit:] I just saw that you also have a PATA disk; things get a bit messy then... If they are on different chipsets, then you can savely activate IDE of you select ONLY the chipset needed. If they are on the same, then it might work out of the box (there is a PATA over SATA way of doing things, but I don't know much about it). Alternatively, you might try to compile the IDE stuff as modules and insert them somewhere in the boot process; this will keep the IDE driver from claiming the SATA disk. As an advice on how to do solve this, you might take a look at the way your current kernel (a genkernel, I suppose) handles things...

----------

## Sunnz

Umm well at least it boots up now!!  :Very Happy: 

----------

## peterk0

well, i worked myself through your .config and i haven't found anything suspicious.   :Sad: 

could you also post your dmesg output somewhere?

----------

## Sunnz

The suspend kernel now boots up correctly.

However I am having trouble getting it to read my IDE hard disk now. The IDE isn't / or anything, just a bunch of movies I haven't watched yet.

EDIT: The IDE HDD now works after some fiddling around compiling IDE drivers as modules!! Everything works I may now actually try to suspend!!!

Thanks so much for your help!!! I can't give enough kudos and thanks to all the advice here!!!

----------

## Sunnz

So suspend is working quite beautifully - it does what I wanted!!!

But... it happens that... my swap partition is actually a few meg less then actual RAM... I feel sooo stupid now!!!

Is it possible to add a new partition to the same disk and using that instead??? Say if I add sda6, would I be able to use to 2 swap partitions while running, and use sda6 for hibernate??

----------

## peterk0

 *Sunnz wrote:*   

> So suspend is working quite beautifully - it does what I wanted!!!
> 
> But... it happens that... my swap partition is actually a few meg less then actual RAM... I feel sooo stupid now!!!
> 
> Is it possible to add a new partition to the same disk and using that instead??? Say if I add sda6, would I be able to use to 2 swap partitions while running, and use sda6 for hibernate??

 

hey, i'm really happy for you !   :Very Happy: 

if your swap is only a few mbs smaller you should not bother, the compression will always squeeze those few mbs from the actual ram size, i think. however, if you create a new swap it will work too, although i'm not quite sure if it's possible to use 2 partitions as swap space. (unionfs comes in my mind, but i know only little about the filesystem, try to look it up somewhere)

let me know, if you figure something out i'm pretty curious   :Wink: 

----------

## DirtyHairy

Nice it works  :Smile:  AFAIK you can use several swap devices; just enable/disable them with swapon (you can even set priorities). If your swap is too small to suspend, you can also use a large file for suspending (best consult the swsusp2 documentation for that).

----------

## Sunnz

 *peterk0 wrote:*   

> if your swap is only a few mbs smaller you should not bother, the compression will always squeeze those few mbs from the actual ram size, i think.

 Yea I guess... is there a way to check if compression is used? LZF is being turned on in the kernel, but in the Cryto section.

----------

## peterk0

 *Sunnz wrote:*   

>  *peterk0 wrote:*   if your swap is only a few mbs smaller you should not bother, the compression will always squeeze those few mbs from the actual ram size, i think. Yea I guess... is there a way to check if compression is used? LZF is being turned on in the kernel, but in the Cryto section.

 

yes it is, you have to have:

1, LZF compiled in, which you have

2, setting in your /etc/hibernate/suspend2.conf:

```
Compressor lzf
```

Than everything should be set.

----------

## Sunnz

 *peterk0 wrote:*   

>  *Sunnz wrote:*    *peterk0 wrote:*   if your swap is only a few mbs smaller you should not bother, the compression will always squeeze those few mbs from the actual ram size, i think. Yea I guess... is there a way to check if compression is used? LZF is being turned on in the kernel, but in the Cryto section. 
> 
> yes it is, you have to have:
> 
> 1, LZF compiled in, which you have
> ...

 Umm somehow settings in suspend2.conf doesn't have any effect... at least I think... is there a way to tell if suspend2.conf is used? BTW I just go "sudo hibernate" to hibernate.

(Actually I'll try Verbosity 3 in suspend2.conf and see if anything happens next time I hibernate.)

----------

