Debian SID, Linux 2.6.31.5, TuxOnIce y laptop Lenovo G530

Imagen de RazaMetaL

Tema: 

Hace unas semanas adquirí una laptop Lenovo G530 en la cual he instalado Debian SID. Me gusta mucho este nuevo cacharro porque todo el hardware funciona y fué reconocido y sin problemas.

He instalado además linux 2.6.31.5 con el cual he notado un rendimiento superior que con las versiones de linux-image que se encuentran en los repositorios de Debian, aunque tuve que instalar a mano el módulo wl para habilitar la tarjeta wifi broadcom bcm4312.

Voy a explicar como instalé el kernel 2.6.31.5 y además como habilitar y configurar TuxOnIce, este paquete lo llevo utilizando varios años y me gusta mucho por la rapidez para hacer una imágen de mi trabajo actual cuando bajo la tapa de la laptop y la rapidez para restaurarla cuando la enciendo.

Lo primero es descargar el kernel a nuestro disco duro y luego descomprimirlo:

cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.5.tar.bz2
tar jvxf linux-2.6.31.5.tar.bz2

Descargarmos el parche de TuxOnIce para linux 2.6.31 y lo aplicamos:

wget http://www.tuxonice.net/downloads/all/current-tuxonice-for-2.6.31.patch-20091009-v1.bz2
cd /usr/src/linux-2.6.31.5
bzip2 -d -c ../current-tuxonice-for-2.6.31.patch-20091009-v1.bz2 | patch -p1

Lo siguiente es configurar las opciones de nuestro nuevo kernel, ajustándolas a nuestros requerimientos, yo partir de la configuración del kernel en uso, eso me facilita la tarea de configuración:

cd /usr/src/linux-2.6.31.5
cp /boot/config-`uname -r` .config

Completamos la configuración:

make menuconfig

Seleccionamos las siguientes opciones para TuxOnIce y luego al salir las guardamos:

Power management and ACPI options --->
Enhanced Hibernation (TuxOnIce) --->
<*> Userspace User Interface support
(/usr/lib/tuxonice-userui/tuxoniceui_fbsplash) Default userui program
[*] Replace swsusp by default

Creamos los paquetes deb para el nuevo kernel:

make-kpkg clean

El siguiente parámetro va a utilizar nuestros dos procesadores para que la tarea de compilación sea mas rápida y por ende tome menos tiempo. Luego de finalizada la tarea tendremos paquetes deb para linux-image, linux-source y linux-headers 2.6.31.5:

CONCURRENCY_LEVEL=`getconf _NPROCESSORS_ONLN || echo 1` make-kpkg --initrd --append_to_version=-tuxonice --revision=`date "+%m%d%y"` kernel_source kernel_headers kernel_image

Necesitamos copiar el siguiente script para que la imágen initrd sea generada de manera adecuada:

cp /usr/share/doc/kernel-package/examples/etc/kernel/postinst.d/initramfs /etc/kernel/postinst.d/

Instalamos los paquetes generados y reniciamos:

cd /usr/src
dpkg -i linux-image-2.6.31.5-tuxonice_110509_i386.deb
dpkg -i linux-headers-2.6.31.5-tuxonice_110509_i386.deb
dpkg -i linux-source-2.6.31.5-tuxonice_110509_all.deb

Ahora debemos configurar TuxOnIce.

Creamos el archivo /usr/share/initramfs-tools/hooks/tuxonice_userui :

PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac

. /usr/share/initramfs-tools/hook-functions

TUXONICE_ENABLED=/sys/power/tuxonice/user_interface/enabled

# Don’t do anything if the kernel does not support tuxonice_userui,
# nor the module is there
if [ -f ${TUXONICE_ENABLED} ]; then
if [ `cat ${TUXONICE_ENABLED}` = 0 ]; then
echo "TuxOnIce user interface is disabled, skipping…"
exit 0
fi
elif [ ! -f ${MODULESDIR}/kernel/power/tuxonice_userui.ko ]; then
echo "This kernel does not seem to support TuxOnIce user interface, skipping…"
exit 0
fi

# Add the module and its dependencies and load it automatically if it
# exists

force_load tuxonice_userui

TUXONICEDIR=/usr/lib/tuxonice-userui

mkdir -p ${DESTDIR}${TUXONICEDIR}

copy_exec ${TUXONICEDIR}/tuxoniceui_text ${TUXONICEDIR}
copy_exec ${TUXONICEDIR}/tuxoniceui_fbsplash ${TUXONICEDIR}

# The following file does not exist on ia64 as usplash is not
# available on this architecture
if [ -x ${TUXONICEDIR}/tuxoniceui_usplash ]; then
copy_exec ${TUXONICEDIR}/tuxoniceui_usplash ${TUXONICEDIR}
fi

Creamos el archivo /usr/share/initramfs-tools/modules.d/lzo que contenga:

lzo

Creamos el archivo /usr/share/initramfs-tools/scripts/local-premount/tuxonice_do_resume que contenga:

PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
if [ -d /sys/power/tuxonice ]; then
echo 1 > /sys/power/tuxonice/do_resume
fi

Damos permisos de ejecución a los archivos antes creados:

chmod a+x /usr/share/initramfs-tools/hooks/tuxonice_userui
/usr/share/initramfs-tools/scripts/local-premount/tuxonice_do_resume

Actualizamos initramfs:

update-initramfs -u -k all

Instalamos el script hibernate 2.0 que descargaremos desde www.tuxonice.net:

cd /usr/src
wget http://www.tuxonice.net/downloads/all/hibernate-script-2.0.tar.gz
tar zvxf
tar zvxf hibernate-script-2.0.tar.gz

Lo instalamos:

cd hibernate-script-2.0
./install.sh

Editamos /etc/hibernate/tuxonice.conf:

# Example tuxonice.conf file.
#
# See hibernate.conf(5) for help on the configuration items.
#
# NOTE: TuxOnIce is an improved version of suspend-to-disk which currently
# requires patching your kernel. For more information, see www.tuxonice.net
#
# If you do not wish to patch your kernel but still be able to suspend to
# disk, see disk.conf instead.

### TuxOnIce
UseTuxOnIce yes
Reboot no
EnableEscape yes
DefaultConsoleLevel 1
#
# Utilizamos lzo y no lzf
#
Compressor lzo
Encryptor none
# ImageSizeLimit 200

## useful for initrd usage:
#
# En la línea siguiente debemos especificar nuestra particion swap
#
SuspendDevice swap:/dev/sda2

## Powerdown method - 3 for suspend-to-RAM, 4 for ACPI S4 sleep, 5 for poweroff
# PowerdownMethod 5

## Any other /proc/software_suspend setting can be set like so:
# ProcSetting expected_compression 50

## Or traditionally like this:
# TuxOnIceAllSettings 0 0 2056 65535 5

## Or even from the results of hibernate --save-settings with this:
# TuxOnIceAllSettingsFile /etc/hibernate/suspend-settings.conf

## For filewriter:
# FilewriterLocation /suspend_file 1000
# VerifyFilewriterResume2 yes

## Specify a userui like this:
ProcSetting userui_program /usr/lib/tuxonice-userui/tuxoniceui_usplash

# Scale CPU to full speed to make sure we suspend as fast as possible.
FullSpeedCPU yes

Include common.conf

Editamos /etc/hibernate/common.conf para que luzca de la siguiente manera:

# Configuration options common for suspending to disk or RAM.
# Options are not case sensitive.
#
# See hibernate.conf(5) for help on the configuration items.

##############################################################################
### Some global settings
##############################################################################

Verbosity 3
LogFile /var/log/hibernate.log
LogVerbosity 3
LogTimestamp yes
# AlwaysForce yes
# AlwaysKill yes
# HibernateVT 15
# Distribution debian (or fedora/gentoo/mandrake/redhat/slackware/suse)
Distribution debian
# XDisplay :0

##############################################################################
### Scriptlets
### Scriptlets provide support for doing all sorts of things before and after
### suspending. The defaults settings here should work for most people, but
### you may wish to edit these to taste. Consult "hibernate -h" for help on
### the configuration settings.
##############################################################################

### bootsplash
## If you use bootsplash, also enabling SwitchToTextMode is recommended if
## you use X, otherwise you may end up with a garbled X display.
# Bootsplash on
# BootsplashConfig /etc/bootsplash/default/config/bootsplash-1024x768.cfg

### clock
SaveClock restore-only
#DirectIsa

### devices
# IncompatibleDevices /dev/dsp /dev/video*

### diskcache
# DisableWriteCacheOn /dev/hda

### fbsplash (enable SwitchToTextMode if you use this)
FBSplash on
FBSplashTheme tuxonice

### filesystems
# Unmount /nfsshare /windows /mnt/sambaserver
# UnmountFSTypes smbfs nfs
# UnmountGraceTime 1
# Mount /windows

### grub
# ChangeGrubMenu yes
# GrubMenuFile /boot/grub/menu.lst
# AlternateGrubMenuFile /boot/grub/menu-suspended.lst
# BackupGrubMenuFile /boot/grub/menu.lst.hibernate.bak

# see http://bugs.debian.org/317479
# RemountXFSBoot yes

### hardware_tweaks
# IbmAcpi yes
# RadeonTool yes
# Runi915resolution yes
# FullSpeedCPU yes

### lilo
# EnsureLILOResumes yes

### lock (generally you only want one of the following options)
## For console you need vlock available.
## For x you need xscreensaver-command-command available.
## For gnome you need gnome-screensaver-command available.
## For kde you need dcop, kscreensaver available.
## For XAuto you need xautolock available.
## For Xtr you need xtrlock available.
## For Freedesktop (for example KDE4) you need dbus-send available
# LockConsoleAs root
# LockXScreenSaver yes
# LockGnomeScreenSaver yes
# LockFreedesktop
# LockKDE yes
# LockXLock yes
# LockXAutoLock yes
# LockXtrLock yes

### misclaunch
# OnSuspend 20 echo "Good night!"
# OnResume 20 echo "Good morning!"

### modules
# UnloadModules snd_via82cxxx usb-ohci
# UnloadAllModules yes
UnloadBlacklistedModules yes
LoadModules auto
# LoadModulesFromFile /etc/modules

### modules-gentoo
# GentooModulesAutoload yes

### network
# DownInterfaces eth0
# UpInterfaces auto

### networkmanager
# EnableNMReconnect yes

### pause_audio
# MuteAudio yes
# PauseAudio yes

### pcmcia
# EjectCards yes

### programs
# IncompatiblePrograms xmms

### services
RestartServices laptop_mode anacron wicd avahi-daemon
# StopServices alsasound
# StartServices aumix

### vbetool
# EnableVbetool yes
# RestoreVbeStateFrom /var/lib/vbetool/vbestate
# VbetoolPost yes
# RestoreVCSAData yes

### xhacks
SwitchToTextMode yes
# UseDummyXServer yes
# DummyXServerConfig xorg-dummy.conf

### xstatus
## This can be set to gnome, kde or x:
## For gnome you need zenity available.
## For kde you need dcop, kstart, kdialog available.
## For x you need to have xosd OR xmessage available.
# XStatus gnome
# XmessageDisable yes
# XSuspendText Preparing to suspend...
# XResumeText Resuming from suspend...
## When using XStatus x, and you have xosd installed:
# XosdSettings --font '-misc-fixed-medium-r-semicondensed--*-120-*-*-c-*-*-*' --colour=Green --shadow 1 --pos bottom --align center --offset 50

### xbacklight
# BackLight yes

### gaim
## You need to have dbus, gaim_remote available.
# LogoutGaim yes
# GaimRestoreStatus yes
# GaimLogoutMessage Hibernating
# GaimLoginMessage Back from hibernation

### pidgin
# LogoutPidgin yes
# PidginRestoreStatus yes
# PidginLogoutMessage Hibernating - bye!
# PidginLoginMessage I'm back!

### SSH and PGP keys
# AgentsClearGPG yes
# AgentsClearSSH yes

### Virtualbox
# SuspendVirtualbox yes

Autorizamos a nuestro usuario para que pueda ejecutar el script hibernate, ejecutamos visudo y agregamos la línea:

razametal ALL= NOPASSWD: /usr/local/sbin/hibernate

Ahora debemos configurar grub2 (Debian SID utiliza grub2). Editamos el archivo /etc/default/grub y modificamos la siguiente línea:

GRUB_CMDLINE_LINUX_DEFAULT="quiet"

Debiendo quedar como sigue:

GRUB_CMDLINE_LINUX_DEFAULT="quiet vga=792 splash i915.modeset=0 resume=swap:/dev/sda2"

Para aplicar los cambios ejecutamos:

update-grub2

Donde /dev/sda2 es mi partición swap que TuxOnIce usará para guardar la imágen congelada.

Finalmente, si utilizamos gnome vamos a las propiedades de la alimentación de poder en System -> Preferences -> Power Management (uso gnome en inglés :)) y configuramos que cuando cerremos la tapa el sistema hiberne.

Comentarios

Buena pregunta, deberían

Imagen de RazaMetaL

Buena pregunta, deberían incluirlo ya que funciona muy bien.

-----

Visita este [url=http://www.sindominio.net/ayuda/preguntas-inteligentes.html]link[/url] :evil:

[img]http://www.bbspot.com/Images/News_Features/2003/01/os_quiz/debian.jpg[/img]

(adsbygoogle = window.adsbygoogle || []).push({});