Mostrando entradas con la etiqueta debian. Mostrar todas las entradas
Mostrando entradas con la etiqueta debian. Mostrar todas las entradas

jueves, 5 de noviembre de 2009

Sony Vaio VPC W110XL con Linux??

Compre hace poco una netbook Sony Vaio VPC-W110XL. Probe Ubuntu en 9.04 y no reconocio a la primera las interfaces de red. Ahora estoy probando Fedora 11 y parece funcionar de manera general bastante bien.

Alguien le ha puesto Debian 5? .... Debian sera su siguiente SO :P

martes, 28 de abril de 2009

autoexpect....

Como en el paquete que contiene el expect no esta incluida la utileria autoexpect, aqui esta el script necesario:


#!/usr/bin/expect --
# Name: autoexpect - generate an Expect script from watching a session
#
# Description:
#
# Given a program name, autoexpect will run that program. Otherwise
# autoexpect will start a shell. Interact as desired. When done, exit
# the program or shell. Autoexpect will create a script that reproduces
# your interactions. By default, the script is named script.exp.
# See the man page for more info.
#
# Author: Don Libes, NIST
# Date: June 30 1995
# Version: 1.4b

set filename "script.exp"
set verbose 1
set conservative 0
set promptmode 0
set option_keys ""

proc check_for_following {type} {
if {![llength [uplevel set argv]]} {
puts "autoexpect: [uplevel set flag] requires following $type"
exit 1
}
}

while {[llength $argv]>0} {
set flag [lindex $argv 0]
if {0==[regexp "^-" $flag]} break
set argv [lrange $argv 1 end]
switch -- $flag \
"-c" {
set conservative 1
} "-C" {
check_for_following character
lappend option_keys [lindex $argv 0] ctoggle
set argv [lrange $argv 1 end]
} "-p" {
set promptmode 1
} "-P" {
check_for_following character
lappend option_keys [lindex $argv 0] ptoggle
set argv [lrange $argv 1 end]
} "-Q" {
check_for_following character
lappend option_keys [lindex $argv 0] quote
set argv [lrange $argv 1 end]
} "-f" {
check_for_following filename
set filename [lindex $argv 0]
set argv [lrange $argv 1 end]
} "-quiet" {
set verbose 0
} default {
break
}
}

################################################## ###########
# Variables Descriptions
################################################## ###########
# userbuf buffered characters from user
# procbuf buffered characters from process
# lastkey last key pressed by user
# if undefined, last key came from process
# echoing if the process is echoing
################################################## ###########

# Handle a character that came from user input (i.e., the keyboard)
proc input {c} {
global userbuf lastkey

send -- $c
append userbuf $lastkey
set lastkey $c
}

# Handle a null character from the keyboard
proc input_null {} {
global lastkey userbuf procbuf echoing

send -null

if {$lastkey == ""} {
if {$echoing} {
sendcmd "$userbuf"
}
if {$procbuf != ""} {
expcmd "$procbuf"
}
} else {
sendcmd "$userbuf"
if {$echoing} {
expcmd "$procbuf"
sendcmd "$lastkey"
}
}
cmd "send -null"
set userbuf ""
set procbuf ""
set lastkey ""
set echoing 0
}

# Handle a character that came from the process
proc output {s} {
global lastkey procbuf userbuf echoing

send_user -raw -- $s

if {$lastkey == ""} {
if {!$echoing} {
append procbuf $s
} else {
sendcmd "$userbuf"
expcmd "$procbuf"
set echoing 0
set userbuf ""
set procbuf $s
}
return
}

regexp (.)(.*) $s dummy c tail
if {$c == $lastkey} {
if {$echoing} {
append userbuf $lastkey
set lastkey ""
} else {
if {$procbuf != ""} {
expcmd "$procbuf"
set procbuf ""
}
set echoing 1
}
append procbuf $s

if {[string length $tail]} {
sendcmd "$userbuf$lastkey"
set userbuf ""
set lastkey ""
set echoing 0
}
} else {
if {!$echoing} {
expcmd "$procbuf"
}
sendcmd "$userbuf$lastkey"
set procbuf $s
set userbuf ""
set lastkey ""
set echoing 0
}
}

# rewrite raw strings so that can appear as source code but still reproduce
# themselves.
proc expand {s} {
regsub -all "\\\\" $s "\\\\\\\\" s
regsub -all "\r" $s "\\r" s
regsub -all "\"" $s "\\\"" s
regsub -all "\\\[" $s "\\\[" s
regsub -all "\\\]" $s "\\\]" s
regsub -all "\\\$" $s "\\\$" s

return $s
}

# generate an expect command
proc expcmd {s} {
global promptmode

if {$promptmode} {
regexp ".*\[\r\n]+(.*)" $s dummy s
}

cmd "expect -exact \"[expand $s]\""
}

# generate a send command
proc sendcmd {s} {
global send_style conservative

if {$conservative} {
cmd "sleep .1"
}

cmd "send$send_style -- \"[expand $s]\""
}

# generate any command
proc cmd {s} {
global fd
puts $fd "$s"
}

proc verbose_send_user {s} {
global verbose

if {$verbose} {
send_user -- $s
}
}

proc ctoggle {} {
global conservative send_style

if {$conservative} {
cmd "# conservative mode off - adding no delays"
verbose_send_user "conservative mode off\n"
set conservative 0
set send_style ""
} else {
cmd "# prompt mode on - adding delays"
verbose_send_user "conservative mode on\n"
set conservative 1
set send_style " -s"
}
}

proc ptoggle {} {
global promptmode

if {$promptmode} {
cmd "# prompt mode off - now looking for complete output"
verbose_send_user "prompt mode off\n"
set promptmode 0
} else {
cmd "# prompt mode on - now looking only for prompts"
verbose_send_user "prompt mode on\n"
set promptmode 1
}
}

# quote the next character from the user
proc quote {} {
expect_user -re .
send -- $expect_out(buffer)
}


if {[catch {set fd [open $filename w]} msg]} {
puts $msg
exit
}
exec chmod +x $filename
verbose_send_user "autoexpect started, file is $filename\n"

# calculate a reasonable #! line
set expectpath /usr/local/bin ;# prepare default
foreach dir [split $env(PATH) :] { ;# now look for real location
if {[file executable $dir/expect] && ![file isdirectory $dir/expect]} {
set expectpath $dir
break
}
}

cmd "#![set expectpath]/expect -f
#
# This Expect script was generated by autoexpect on [timestamp -format %c]
# Expect and autoexpect were both written by Don Libes, NIST."
cmd {#
# Note that autoexpect does not guarantee a working script. It
# necessarily has to guess about certain things. Two reasons a script
# might fail are:
#
# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet,
# etc.) and devices discard or ignore keystrokes that arrive "too
# quickly" after prompts. If you find your new script hanging up at
# one spot, try adding a short sleep just before the previous send.
# Setting "force_conservative" to 1 (see below) makes Expect do this
# automatically - pausing briefly before sending each character. This
# pacifies every program I know of. The -c flag makes the script do
# this in the first place. The -C flag allows you to define a
# character to toggle this mode off and on.

set force_conservative 0 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}

#
# 2) differing output - Some programs produce different output each time
# they run. The "date" command is an obvious example. Another is
# ftp, if it produces throughput statistics at the end of a file
# transfer. If this causes a problem, delete these patterns or replace
# them with wildcards. An alternative is to use the -p flag (for
# "prompt") which makes Expect only look for the last line of output
# (i.e., the prompt). The -P flag allows you to define a character to
# toggle this mode off and on.
#
# Read the man page for more info.
#
# -Don

}

cmd "set timeout -1"
if {$conservative} {
set send_style " -s"
cmd "set send_slow {1 .1}"
} else {
set send_style ""
}

if {[llength $argv]>0} {
eval spawn -noecho $argv
cmd "spawn $argv"
} else {
spawn -noecho $env(SHELL)
cmd "spawn \$env(SHELL)"
}

cmd "match_max 100000"

set lastkey ""
set procbuf ""
set userbuf ""
set echoing 0

remove_nulls 0

eval interact $option_keys {
-re . {
input $interact_out(0,string)
} -o -re .+ {
output $interact_out(0,string)
} eof {
cmd "expect eof"
return
}
}

close $fd
verbose_send_user "autoexpect done, file is $filename\n"

martes, 31 de marzo de 2009

Nagios 3 en Debian Squeeze

Instalacion y configuracion general y basica de Nagios 3 en un sistema Debian Squeeze/sid.


1) # apt-get update

2) # apt-get install nagios3 nagios-nrpe-plugin

3) # cd /etc/nagios3; htpasswd -c htpasswd.users nagiosadmin

4) # cp /etc/nagios3/apache2.conf /etc/apache2/sites-enabled

5) # /etc/init.d/apache2 restart

6) http://localhost/nagios3/

7) Definiendo mis propios comandos, utilizando los plugins de Nagios.

# vi /etc/nagios3/commands.cfg


define command{
command_name check-ldap
command_line $USER1$/check_ldap -H $HOSTADDRESS$ -3 -b "dc=dominio,dc=dominio1"
}

define command{
command_name check_alfred
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 9000
}

define command{
command_name check_root_partition_remote
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_disk
}




8) Cambiando detalles de configuracion:

# vi /etc/nagios3/nagios.cfg


cfg_file=/etc/nagios3/contactgroups.cfg
cfg_file=/etc/nagios3/contacts.cfg
cfg_file=/etc/nagios3/timeperiods.cfg
cfg_file=/etc/nagios3/hostgroups.cfg
cfg_file=/etc/nagios3/hosts.cfg
cfg_file=/etc/nagios3/services.cfg


9) Creando cada archivo que defini en el apartado anterior:

# vi /etc/nagios3/contactgroups.cfg
define contactgroup{
contactgroup_name SysAdmin
alias Admin
members Sistemas
}



# vi /etc/nagios3/contacts.cfg

define contact{
contact_name Sistemas
alias SysAdmin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email mi_dir@corre
}




# vi /etc/nagios3/timeperiods.cfg

define timeperiod{
timeperiod_name 24x7
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}


# 'workhours' timeperiod definition
define timeperiod{
timeperiod_name workhours
alias "Normal" Working Hours
monday 10:30-19:00
tuesday 10:30-19:00
wednesday 10:30-19:00
thursday 10:30-19:00
friday 10:30-19:00
}


# 'nonworkhours' timeperiod definition
define timeperiod{
timeperiod_name nonworkhours
alias Non-Work Hours
sunday 00:00-24:00
monday 00:00-09:00,17:00-24:00
tuesday 00:00-09:00,17:00-24:00
wednesday 00:00-09:00,17:00-24:00
thursday 00:00-09:00,17:00-24:00
friday 00:00-09:00,17:00-24:00
saturday 00:00-24:00
}



# vi /etc/nagios3/hosts.cfg

# 'msantos-pruebas.ing.ollin' host definition
define host{
use generic-host ; Name of host template to use
host_name m-pruebas.ing
alias m-pruebas.ing
address 172.16.30.2
check_command check-host-alive
max_check_attempts 10
notification_interval 120
notification_period 24x7
notification_options d,u,r
contact_groups SysAdmin
}

# 'piedra.domain' definition
define host{
use generic-host ; Name of host template to use
host_name piedra.domain
alias piedra.domain
address 172.16.30.115
check_command check-host-alive
max_check_attempts 10
notification_interval 120
notification_period workhours
notification_options d,u,r
contact_groups SysAdmin
}



# vi /etc/nagios3/services.cfg

define service{
use generic-service ; Name of service template to use
host_name backups.domain, piedra.domain, m-prueba.ing
service_description PING
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups SysAdmin
notification_interval 120
notification_period 24x7
notification_options c,r
check_command check_ping!100.0,20%!500.0,60%
}

# Service definition
define service{
use generic-service ; Name of service template to use
host_name backups.domain
service_description HTTP
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups SysAdmin
notification_interval 120
notification_period 24x7
notification_options c,r
check_command check_http
}

viernes, 27 de marzo de 2009

Etch to Lenny

Se que hay miles de links en la red, que hablan sobre este tema; pero uno en mi blog no estaria de mas ;)


1) vi /etc/apt/sources.list

:%s/etch/lenny/g

2) apt-get update

3) apt-get -u dist-upgrade

miércoles, 16 de julio de 2008

Debian en Mac G5

Para no variar queria experimentar Debian en una Mac G5. He aqui mi historia.

Instalacion:

Use un CDROM, pero debo confesar que no conozco mucho del mundo Mac asi que tuve que investigar como bootear desde la unidad de CD ( ya aprendi es encender el equipo y presionar la tecla Option-alt ).

Despues de haber logrado bootear desde cdrom, pense que seria en el prompt de boot, el clasico install, pero resulto que si lo hacia me aparecia este error:


opening display /pci@0, f0000000/NVDA,parent@10/NVDA,Display-A@0... ok
copying 0F device tree...done
Initializing fake screen: NVDA,Display-B
Calling quiesce ...
returning 0x01400000 from prom_init

Invalid memory access at %SRR0: 00000000.01403b88 %SRR1: 10000000.00083030

Apple Powermac 7,2 5.1.5f2 BootROM built on 09/21/04 at 11:58:53
Copyright 1994-2004 Apple Computer, Inc.
All Rights Reserved

Welcome to Open Firmware, the system time and date is 22:46:07 10/27/2004

To continue booting, type 'mac-boot' and press return
To shut down, type 'shut-down' and press return

Release keys to continue!



Leyendo un poco en la red encontre que se soluciona usando en el boot: expert64 video=ofonly

Despues otra que sucedio es que particione segun considere necesario, pero mas adelante en la instalacion me aparecio un error que decia:

No NewWorld boot partition was found. The yaboot boot loader requires an Apple_Bootstrap partition at least 819200 bytes in size, using the HFS Macintosh ...

Por lo que entendi, es que debia tener una particion para poner el boot loader. Creandola es suficiente.


Operacion:

Tan bella como siempre en un Debian ;)

martes, 4 de marzo de 2008

Sony Vaio VGN-CR160F con Debian lenny/sid

Para actualizar de Etch a Lenny en Sony Vaio VGN-CR160F.

1) apt-get update
2) apt-get dist-upgrade
3) El sistema ya no levanta debido a que no se carga el modulo para el disco duro. Manda como el mensaje de error siguiente:

Begin: Waiting for root filesystem...
Done.
WARNING boot device may be renamed. Try root = /dev/hda3
ALERT! /dev/hda3 does not exist. Dropping to a shell!
Check your root= boot argument (cat /proc/cmdline)
Check for missing modules (cat /proc/modules), or device files (ls /dev)

BusyBox v1.01 (Debian 1:1.01-4) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: can't access tty; job control turned off
/ #


4) En el shell ejecutar: modprobe ide-disk; modprobe ide-generic; exit
5) Cargando los modulos anteriores el sistema termina de arrancar. Pero es necesario que esos modulos sean cargados siempre:
a) agregar al archivo /etc/initramfs-tools/modules, las lineas ide-generic e ide-disk
b) mkinitramfs -v -o /boot/initrd.img-2.6.22.14 2.6.22.14

6) Reiniciar

Recapitulando:

* video: Es necesario xserver-xorg-video-intel, aunque ya no asi el paquete 915resolution.

* sonido: Paquetes alsa* a versiones 1.0.15-2 o superiores.

* La interfaz Ethernet: Modulo r8169.

* Red inalambrica: Modulo mac80211, iwlwifi-4965

* motioeye: Modulo r5u870-0

sábado, 11 de agosto de 2007

Beryl en Debian 4.0

* Beryl

1) Agregar repositorio de Beryl en /etc/apt/source.lists

deb http://debian.beryl-project.org/ etch main

2) Modificacion de configuracion de Xorg

Asegurarse que se hace referencia al modulo glx en la seccion Module

Load "glx"



Agregar en la seccion Device

Section "Device"
.
.
.
Option "RenderAccel" "true"
Option "AllowGLXWithComposite" "true"
Option "AddARGBGLXVisuals" "true"
EndSection


Agregar al final del archivo de configuracion:

Section "Extensions"
Option "Composite" "Enable"
EndSection


3) Instalar Beryl

apt-get install beryl beryl-manager

4) Beryl cada vez que iniciemos sesion:
system --> Session --> New Beryl-manager comando beryl-manager
system --> Session --> New Beryl comando beryl-glx


Nota: JAC gracias ;)

martes, 7 de agosto de 2007

Sony Vaio VGN-CR160F con Debian 4.0

Esta pagina esta basada en mi experiencia de ejecutar Debian GNU/Linux en Sony Vaio VGN-CR160F; pero si deseas usar cualquier otro sistema operativo en tu maquina, quiza alguna parte de esto te sea de utilidad.


Nota: Advierto que esto no esta excento de fallos, asi que leelo y usalo bajo tu responsabilidad. La pagina ha sido escrita sin acentos.


Contenido

Caracteristicas principales
Instalacion de sistema base (Debian 4.0)
Configuracion especial


Caracteristicas principales:

* Procesador Intel® CoreTM 2 Duo T7100 con Tecnología Móvil Intel® Centrino® Duo.
* Disco duro de 120GB2 SATA
* 2GB RAM.
* Pantalla ancha 14.1” con Tecnología XBRITETM de Sony
* Unidad óptica integrada DVD±R Doble Capa/DVD±RW
* Interfaz digital i.LINK® (IEEE 1394)5 S400


Instalacion del sistema base Debian 4.0

El medio de instalacion fue CDROM, al hacerlo sin opciones marca el error "No common CD-ROM drive was detected", y es debido a que hay un conflicto con el driver cargado para el Disco Duro y para el CDROM. Para evitarlo encontre que debi dar un argumento en la linea de boot.

boot: install libata.atapi_enable=1

Eso fue suficiente para permitir una instalacion simple. En este paso ten en cuenta tus propias opciones de instalacion.

Configuracion especial


Actualice mi kernel a la version 2.6.22.14 ( creandolo al estilo debian ) debido a que tenia problemas para detectar el motion eye y el WiFi. Asegurate que esten habilitadas las opciones CONFIG_SONY_LAPTOP y CONFIG_SONYPI.

Algo que he notado que falla son las teclas especiales (Bl Num, Bl Des, etc.) que tiene la laptop.


* Video:

El dispositivo es Mobile Intel 965GM Express Chipset Family. Para usar una resolucion de 1280x800 ( la misma que usa Windows Vista), hice lo siguiente:

1. Instalacion de los paquetes adicionales
xserver-xorg-video-intel ( contiene el drive intel)
915resolution ( modifica la resolucion de chipsets de Intel )


2. Definicion de la resolucion deseada en el archivo /etc/default/915resolution

XRESO=1280
YRESO=800


3. Modificacion de la configuracion del servidor X's en el archivo /etc/X11/xorg.conf en la seccion de Device, Drive intel por vesa.

Section "Device"
Identifier "Generic Video Card"
# Driver "vesa"
Driver "intel"
BusID "PCI:0:2:0"
EndSection


* Sonido:

lpsci reporta como dispositivo:

00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)

1) La lista de modulos:
snd
snd_hda_intel
snd_mixer_oss
snd_page_alloc
snd_pcm
snd_pcm_oss
snd_timer
soundcore

2) En archivo /etc/modprobe.d/alsa-base adicione:
options snd-hda-intel model=auto
3) Actualize los paquetes alsa* a versiones 1.0.15-2, debido a que hay problemas con los modulos de sonido, porque es reconocido el dispositivo, es cargado correctamente el driver, no presenta error durante la reproduccion de archivo, sin embargo no hay sonido.


* La interfaz Ethernet:

Sin problemas con el driver r8169 (Gigabit Ethernet driver 2.2LK-NAPI)


* Red inalambrica

El dispositivo es: Intel(R) Wireless WiFi Link 4965AGN.

a) Habilitar el modulo mac80211 necesario para iwlwifi en el kernel.
b) Este howto http://www.intellinuxwireless.org/?p=iwlwifi&n=HOWTO-iwlwifi. La version usada de los driver son iwlwifi-1.2.0 y iwlwifi-4965-ucode-4.44.1.18.
c) Reinicie y el dispositivo es detectado correctamente
d) Adicionar configuracion a /etc/network/interfaces para que automaticamente al momento de arrancar tenga disponible la red inalambrica.


* Motion Eye

El dispositivo de motion eye reportador por lsusb:

Bus 006 Device 002: ID 05ca:1839 Ricoh Co., Ltdr5u870-VCC6

a) $ tar xjvf r5u870-0.20.tar.bz2
b) $ cd r5u870-VCC6/
c) $ make
d) # make install
e) Asegurarse que cargar los modulos r5u870.ko, videodev, video-buf, v4l1-compat y v4l2-common.
f) # cp ./r5u870-VCC6/r5u870_1839.fw /lib/firmware
g) # chmod 666 /dev/video1
h) Reiniciar y verificar que es detectado el motion eye. Debera ver en el dmesg algo asi:

kernel: usbcam: registering driver r5u870 0.10.0
kernel: r5u870-0: Detected Sony VGP-VCC6
kernel: r5u870-0: Unexpected microcode version (exp:0113 got:0030)
kernel: usbcore: registered new interface driver r5u870
kernel: meye: using 32 buffers with 600k (19200k total)for capture
kernel: usbcore: registered new interface driver usblcd



i) $ xawtv -c /dev/video1 -geometry 320x240

j) Instalar motioneye y motion. Ajustar en /etc/motion/motion.conf el dispositivo y ademas poner los permisos o el directorio correcto para la opcion target_dir.
k) motion


Pendiente aun mas detalles de configuracion de los dispositivos.