Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
TuxOnIce + Hibernate Resume Problem
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
eleanor
l33t
l33t


Joined: 01 Nov 2004
Posts: 666

PostPosted: Sun Oct 28, 2012 9:51 am    Post subject: TuxOnIce + Hibernate Resume Problem Reply with quote

Hi,

I'm using LUKS + LVM with my partitions on the system. This is why I have to use the initrd to decrypt the partitions before using them. I have a suspend_file saved in the /root/suspend_file on partition, which is mapped through LVM as /dev/mapper/vg-root and is also encrypted with LUKS. The initrd /init script currently does the following:

Code:

#!/bin/busybox sh

# init to execute after switching to real root
init=/sbin/init


# Die function if something goes wrong
die() {
   info "Dropping you into a minimal shell:"
   exec /bin/sh
}


# Parse the arguments passed to the kernel option in grub.conf
parse_kernel_args() {
  local x
  CMDLINE=`cat /proc/cmdline`
  for param in $CMDLINE; do
    case "${param}" in
      root=*)
        root_device="`echo "${param}" | cut -d'=' -f2`"
        ;;
      ikmap=*)
        kmap="`echo "${param}" | cut -d'=' -f2 | cut -d':' -f1`"
        ;;
      iswap=*)
        swap_device="`echo "${param}" | cut -d'=' -f2 | cut -d':' -f1`"
        ;;
      esac
    done
}






#
# Main Function
#
# path to search for binaries
export PATH="/sbin:/bin:/usr/bin:/usr/sbin"
umask 0077

# create needed directories (for mountpoints)
#for dir in proc sys dev newroot; do mkdir -p /$dir; done

# mount needed filesystems
/bin/busybox mount -t proc proc /proc
/bin/busybox mount -t sysfs sysfs /sys
/bin/busybox mount -t devtmpfs udev /dev

# parse grub's kernel arguments
parse_kernel_args

# load keymap if it exists
if [ -n "$kmap" ]; then
  loadkmap < "/etc/${kmap}"
else
  die "Error: keymap /etc/${kmap} does not exist."
fi

# create /dev/sda encrypted partition
echo /bin/mdev > /proc/sys/kernel/hotplug
/bin/busybox mdev -s

# LUKS: decrypt the encrypted partition
/sbin/cryptsetup -T 5 luksOpen "${root_device}" system

# LVM: enable the LVM partitions
/sbin/lvm vgscan
/sbin/lvm vgchange -ay


# mount the root filesystem
#/bin/busybox mount /dev/mapper/system /newroot
/bin/busybox mount /dev/mapper/vg-root /newroot
if [ "$?" -ne 0 ]; then
  /sbin/cryptsetup luksClose system 2>/dev/null || cryptsetup remove system
  die "Error: mount root failed, dm-crypt mapping closed."
fi

# unmount unneeded filesystems
if mountpoint -q /dev/pts ; then umount /dev/pts; fi
/bin/busybox umount -l /proc
/bin/busybox umount -l /sys
/bin/busybox umount -l /dev

# move the mounted filesystems to newroot
#/bin/busybox mount --move /sys /newroot/sys
#/bin/busybox mount --move /proc /newroot/proc
#/bin/busybox mount --move /dev /newroot/dev


# switch to root of another filesystem and start the init process
exec switch_root /newroot "${init}"



My grub.conf looks like this:
Code:


default 0
timeout 5

title=Gentoo
root (hd0,0)
kernel /boot/kernel-tuxonice-3.0.35 root=/dev/sda3 ikmap=slovene.bin elevator=noop splash resume=UUID=ff446f4b3a97486689804ec8f520e303:0x60e9458
initrd /boot/initramfs.cpio.gz


Here: http://en.gentoo-wiki.com/wiki/TuxOnIce#Alternative:_Using_a_Dedicated_File I found our that I use resume from the /root/suspend_file with the following command:

Code:

echo 1 > /sys/power/tuxonice/do_resume



But the problem is that I'm not using the resume parameter in the initrd anywhere, so how can the kernel know from which file to resume.
Code:

resume=UUID=ff446f4b3a97486689804ec8f520e303:0x60e9458


The question is: what do I have to add to the initrd to make it resume from the /root/suspend_file?

Thank you
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13867

PostPosted: Sun Oct 28, 2012 4:34 pm    Post subject: Re: TuxOnIce + Hibernate Resume Problem Reply with quote

eleanor wrote:

Code:

echo 1 > /sys/power/tuxonice/do_resume

But the problem is that I'm not using the resume parameter in the initrd anywhere, so how can the kernel know from which file to resume.
Code:

resume=UUID=ff446f4b3a97486689804ec8f520e303:0x60e9458

The question is: what do I have to add to the initrd to make it resume from the /root/suspend_file?
You may not need to add anything. The kernel can still parse its cmdline even when an initrd is used. If the kernel is not properly preparing the resume file from the parameter shown, then you will need to set the resume device in the same way that you set the suspend device.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum