Archive for the ‘Uncategorized’ Category

h1

Como evitar el error «BAD PASSWORD» al poner una contraseña débil a un usuario en GNU/Linux

08/05/2009

Cuando el propio usuario intenta cambiar su password, el sistema comprueba la resistencia ante ataques del nuevo password. Si cumple unos mínimos, éste se acepta; en otro caso, se rechaza:

[carlos@shirley ~]$ passwd
Changing password for user carlos.
Changing password for carlos
(current) UNIX password: ******
New UNIX password: *******
BAD PASSWORD: it is based on your username
New UNIX password: *******

Si de todas maneras se quiere poner un password débil, éste lo debe poner root a ese usuario:

[carlos@shirley ~]# su -
Password: *******

[root@shirley ~]# passwd carlos
Changing password for user carlos.
New UNIX password: ****
Retype new UNIX password: ****
passwd: all authentication tokens updated successfully.

h1

Como medir temperatura de la placa base, CPU, etc

26/04/2009

En GNU/Linux existe el comando «sensors» para mostrar en consola la información de los sensores de la placa base. Previamente estos deben haber sido activados en la BIOS. Para ver la temperatura se pueden seguir los siguientes pasos:

[root@server4 /]# sensors
Can't access procfs/sysfs file
Unable to find i2c bus information;
For 2.6 kernels, make sure you have mounted sysfs and done
'modprobe i2c_sensor'!
For older kernels, make sure you have done 'modprobe i2c-proc'!

[root@server4 /]# modprobe i2c_sensor
[root@server4 /]# sensors
No sensors found!
[root@server4 /]# sensors-detect (responder Intro a todo lo que pregunte)

This program will help you determine which I2C/SMBus modules you need to
load to use lm_sensors most effectively. You need to have i2c and
lm_sensors installed before running this program.
Also, you need to be `root', or at least have access to the /dev/i2c-*
files, for most things.
If you have patched your kernel and have some drivers built in, you can
safely answer NO if asked to load some modules. In this case, things may
seem a bit confusing, but they will still work.

It is generally safe and recommended to accept the default answers to all
questions, unless you know what you're doing.

We can start with probing for (PCI) I2C or SMBus adapters.
You do not need any special privileges for this.
Do you want to probe now? (YES/no):
Probing for PCI bus adapters...
Sorry, no PCI bus adapters found.

We will now try to load each adapter module in turn.
If you have undetectable or unsupported adapters, you can have them
scanned by manually loading the modules before running this script.

To continue, we need module `i2c-dev' to be loaded.
If it is built-in into your kernel, you can safely skip this.
i2c-dev is not loaded. Do you want to load it now? (YES/no):
Module loaded succesfully.

We are now going to do the adapter probings. Some adapters may hang halfway
through; we can't really help that. Also, some chips will be double detected;
we choose the one with the highest confidence value in that case.
If you found that the adapter hung after probing a certain address, you can
specify that address to remain unprobed. That often
includes address 0x69 (clock chip).

Some chips are also accessible through the ISA bus. ISA probes are
typically a bit more dangerous, as we have to write to I/O ports to do
this. This is usually safe though.

Do you want to scan the ISA bus? (YES/no):
Probing for `National Semiconductor LM78'
Trying address 0x0290... Failed!
Probing for `National Semiconductor LM78-J'
Trying address 0x0290... Failed!
Probing for `National Semiconductor LM79'
Trying address 0x0290... Failed!
Probing for `Winbond W83781D'
Trying address 0x0290... Failed!
Probing for `Winbond W83782D'
Trying address 0x0290... Failed!
Probing for `Winbond W83627HF'
Trying address 0x0290... Success!
(confidence 8, driver `w83781d')
Probing for `Winbond W83697HF'
Trying address 0x0290... Failed!
Probing for `Silicon Integrated Systems SIS5595'
Trying general detect... Failed!
Probing for `VIA Technologies VT82C686 Integrated Sensors'
Trying general detect... Failed!
Probing for `VIA Technologies VT8231 Integrated Sensors'
Trying general detect... Failed!
Probing for `ITE IT8705F / IT8712F / SiS 950'
Trying address 0x0290... Failed!
Probing for `IPMI BMC KCS'
Trying address 0x0ca0... Failed!
Probing for `IPMI BMC SMIC'
Trying address 0x0ca8... Failed!

Some Super I/O chips may also contain sensors. Super I/O probes are
typically a bit more dangerous, as we have to write to I/O ports to do
this. This is usually safe though.

Do you want to scan for Super I/O sensors? (YES/no):

Probing for `ITE 8702F Super IO Sensors'
Failed! (skipping family)
Probing for `Nat. Semi. PC87351 Super IO Fan Sensors'
Failed! (skipping family)
Probing for `SMSC 47B27x Super IO Fan Sensors'
Failed! (skipping family)
Probing for `VT1211 Super IO Sensors'
Failed! (0x52)
Probing for `Winbond W83627HF Super IO Sensors'
Success... found at address 0x0295
Probing for `Winbond W83627THF Super IO Sensors'
Failed! (0x52)
Probing for `Winbond W83637HF Super IO Sensors'
Failed! (0x52)
Probing for `Winbond W83697HF Super IO Sensors'
Failed! (0x52)
Probing for `Winbond W83697SF/UF Super IO PWM'
Failed! (0x52)
Probing for `Winbond W83L517D Super IO'
Failed! (0x52)

Do you want to scan for secondary Super I/O sensors? (YES/no): Probing for `ITE 8702F Super IO Sensors'
Failed! (skipping family)
Probing for `Nat. Semi. PC87351 Super IO Fan Sensors'
Failed! (skipping family)
Probing for `SMSC 47B27x Super IO Fan Sensors'
Failed! (skipping family)
Probing for `VT1211 Super IO Sensors'
Failed! (skipping family)

Now follows a summary of the probes I have just done.
Just press ENTER to continue:
Driver `w83781d' (should be inserted):
Detects correctly:
* ISA bus address 0x0290 (Busdriver `i2c-isa')
Chip `Winbond W83627HF' (confidence: 8)

Driver `w83627hf' (should be inserted):
Detects correctly:
* ISA bus address 0x0295 (Busdriver `i2c-isa')
Chip `Winbond W83627HF Super IO Sensors' (confidence: 9)

I will now generate the commands needed to load the I2C modules.
Sometimes, a chip is available both through the ISA bus and an I2C bus.
ISA bus access is faster, but you need to load an additional driver module
for it. If you have the choice, do you want to use the ISA bus or the
I2C/SMBus (ISA/smbus)?

To make the sensors modules behave correctly, add these lines to
/etc/modules.conf:

#----cut here----
# I2C module options
alias char-major-89 i2c-dev
#----cut here----

To load everything that is needed, add this to some /etc/rc* file:

#----cut here----
# I2C adapter drivers
modprobe i2c-isa
# I2C chip drivers
modprobe w83781d
modprobe w83627hf
# sleep 2 # optional
/usr/bin/sensors -s # recommended
#----cut here----


WARNING! If you have some things built into your kernel, the list above
will contain too many modules. Skip the appropriate ones! You really should
try these commands right now to make sure everything is working properly.
Monitoring programs won't work until it's done.

Do you want to generate /etc/sysconfig/lm_sensors? (YES/no): Copy prog/init/lm_sensors.init to /etc/rc.d/init.d/lm_sensors
for initialization at boot time.
[root@server4 /]#
[root@server4 /]#
[root@server4 /]#
[root@server4 /]# /etc/init.d/lm_sensors restart
Stopping lm_sensors: [ OK ]
Starting lm_sensors: [ OK ]
[root@server4 /]#
[root@server4 /]#
[root@server4 /]# sensors
w83627hf-isa-0290
Adapter: ISA adapter
VCore 1: +0.00 V (min = +0.00 V, max = +0.00 V) ALARM
VCore 2: +0.00 V (min = +0.00 V, max = +0.00 V) ALARM
+3.3V: +0.00 V (min = +3.14 V, max = +3.46 V)
+5V: +5.03 V (min = +4.73 V, max = +5.24 V) ALARM
+12V: +0.00 V (min = +10.82 V, max = +13.19 V)
-12V: -14.91 V (min = -13.18 V, max = -10.88 V)
-5V: -7.71 V (min = -5.25 V, max = -4.75 V)
V5SB: +5.59 V (min = +4.73 V, max = +5.24 V) ALARM
VBat: +1.12 V (min = +2.40 V, max = +3.60 V)
fan1: 0 RPM (min = 3026 RPM, div = 2)
fan2: 0 RPM (min = 10074 RPM, div = 2)
fan3: 0 RPM (min = 4326 RPM, div = 2)
temp1: +127°C (high = +48°C, hyst = +115°C) sensor = thermistor
temp2: +127.0°C (high = +80°C, hyst = +75°C) sensor = thermistor ALARM
temp3: +127.0°C (high = +80°C, hyst = +75°C) sensor = thermistor ALARM
ERROR: Can't get VID data!
alarms: Chassis intrusion detection ALARM
beep_enable:
Sound alarm disabled


En Debian ó Ubuntu concretamente sería parecido a:

root@shirley:/var/cache/apt/archives# apt-get install lm-sensors
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias
Leyendo la información de estado... Hecho
Se instalarán los siguientes paquetes extras:
libsensors4
Paquetes sugeridos:
sensord read-edid i2c-tools
Se instalarán los siguientes paquetes NUEVOS:
libsensors4 lm-sensors
0 actualizados, 2 se instalarán, 0 para eliminar y 0 no actualizados.
Necesito descargar 191kB de archivos.
Se utilizarán 795kB de espacio de disco adicional después de desempaquetar.
¿Desea continuar [S/n]?
Des:1 http://archive.ubuntu.com intrepid/main libsensors4 1:3.0.2-1ubuntu2 [64,7kB]
Des:2 http://archive.ubuntu.com intrepid/main lm-sensors 1:3.0.2-1ubuntu2 [126kB]
Descargados 191kB en 0s (333kB/s)
Seleccionando el paquete libsensors4 previamente no seleccionado.
(Leyendo la base de datos ...
155498 ficheros y directorios instalados actualmente.)
Desempaquetando libsensors4 (de .../libsensors4_1%3a3.0.2-1ubuntu2_amd64.deb) ...
Seleccionando el paquete lm-sensors previamente no seleccionado.
Desempaquetando lm-sensors (de .../lm-sensors_1%3a3.0.2-1ubuntu2_amd64.deb) ...
Procesando activadores para man-db ...
Configurando libsensors4 (1:3.0.2-1ubuntu2) ...
udev active, devices will be created in /dev/.static/dev/
Creating config file /etc/sensors3.conf with new version
Configurando lm-sensors (1:3.0.2-1ubuntu2) ...

Procesando activadores para libc6 ...
ldconfig deferred processing now taking place

Detección e instalación de sensores:

carlos@WhenIGrowUp:/$ sudo sensors-detect
[sudo] password for carlos:
# sensors-detect revision 5016 (2007-11-11 22:20:16 +0100)
This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.
(...)
To load everything that is needed, add this to /etc/modules:
#----cut here----
# Chip drivers
it87
k8temp
#----cut here----

Do you want to add these lines automatically? (yes/NO)yes

# modprobe it87 k8temp

y muestreo de la temperatura:

root@shirley:/var/cache/apt/archives# sensors
k8temp-pci-00c3
Adapter: PCI adapter
Core0 Temp: -49.0°C
Core1 Temp: +111.0°C <- Valor falso

it8712-isa-0290
Adapter: ISA adapter
VCore 1: +1.14 V (min = +0.00 V, max = +4.08 V)
VCore 2: +4.08 V (min = +0.00 V, max = +4.08 V) ALARM
+3.3V: +3.36 V (min = +0.00 V, max = +4.08 V)
+5V: +6.85 V (min = +0.00 V, max = +6.85 V) ALARM
+12V: +12.74 V (min = +0.00 V, max = +16.32 V)
-12V: -15.33 V (min = -27.36 V, max = +3.93 V)
-5V: +4.03 V (min = -13.64 V, max = +4.03 V) ALARM
Stdby: +6.85 V (min = +0.00 V, max = +6.85 V) ALARM
VBat: +3.20 V
fan1: 1126 RPM (min = 0 RPM)
fan2: 3169 RPM (min = 0 RPM)
M/B Temp: +100.0°C (low = -1.0°C, high = +127.0°C) sensor = thermistor
CPU Temp: +43.0°C (low = -1.0°C, high = +127.0°C) sensor = thermistor
Temp3: -128.0°C (low = -1.0°C, high = +127.0°C) sensor = disabled
cpu0_vid: +1.550 V

h1

Conexión SSH lenta o con cortes

05/04/2009

En las actuales versiones de SSH (por ejemplo OpenSSH_5.1p1 Debian-5, OpenSSL 0.9.8g 19 Oct 2007 en Debian 5.0), al conectar a un servidor ssh se pueden producir retrasos, desconexiones o imposibilidad de conectar.

El problema más común es la resolución DNS equivocada del demonio sshd sobre el cliente que se intenta conectar. Se resuelve corrigiendo los DNS del servidor, incluyendo servidores DNS más fiables, y/o añadiendo la IP del cliente en el fichero /etc/hosts, así como verificando la IP propia en dicho fichero .

h1

Problema de alto consumo de CPU en VirtualBox / High CPU load in Virtualbox

31/03/2009

En casos en los que al ejecutar una máquina virtual (vm) de VirtualBox se pueden copar los recursos de la máquina anfitriona sin lógica. Tras haber analizado la memoria asignada a la vm y teniéndola en reposo (idle), sin apenas uso, se pueden ver datos similares al siguiente:

carlos@shirley:~$ top
top - 19:12:44 up 25 min, 1 user, load average: 1.26, 1.38, 1.11
Tasks: 92 total, 2 running, 90 sleeping, 0 stopped, 0 zombie
Cpu(s): 10.2%us, 6.6%sy, 81.5%ni, 0.0%id, 0.0%wa, 1.0%hi, 0.7%si, 0.0%st
Mem: 895708k total, 886940k used, 8768k free, 3176k buffers
Swap: 971924k total, 26028k used, 945896k free, 91784k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
11491 carlos 20 0 416m 278m 6780 S 94.3 31.8 3:21.06 VBoxHeadless Monowall (no-gui)
11536 carlos 20 0 295m 157m 6816 S 2.6 18.1 1:56.37 VBoxHeadless Debian
11180 boinc 39 19 173m 29m 2088 R 2.8 3.4 9:51.67 charmm34_6.15_x
(...)

Para solucionarlo, es tan sencillo como aumentar el tamaño de la memoria de video de la máquina virtual en cuestión y reiniciarla. Es probable que el alto consumo se deba al uso de vrdp o una memoria de video insuficiente, incluso aunque el sistema no tenga interfaz gráfica.

h1

Joomla, instalación de plugin con error JFolder::create

19/03/2009

Si al instalar en Joomla un plugin se produce el siguiente error:
Joomla! • View topic - JFolder::create: Could not create directory
ó

* JFolder::create: No se ha podido crear el directorio
* Unable to create destination

Es necesario tanto asignar permisos de acceso completo (777) al directorio temporal (habitualmente /tmp) como desactivar el modo seguro de ejecución de php:

#nano /etc/php5/apache2/php.ini
(...)
safe_mode = Off
(...)

Si se trabaja con un hosting ajeno, este cambio se puede hacer desde el panel de control del alojamiento o contactando directamente con el soporte técnico del hosting.

h1

Cómo copiar/duplicar un disco VDI de VirtualBox

18/03/2009

Al copiar una imagen de disco de VirtualBox para crear otra máquina idéntica por ejemplo y añadirla en el  Virtual Media Manager, se produce el siguiente error:

Código Resultado
NS_ERROR_INVALID_ARG (0x80070057)
Componente:
VirtualBox
Interface:
IVirtualBox {339abca2-f47a-4302-87f5-7bc324e6bbde}

errorvb

Esto es debido a que las imagenes de disco en Virtual Box llevan un UUID que las identifica, de modo que al añadir otra el gestor comprueba que no esté repetida para evitar que una máquina virtual arranque unas veces con uno y otras con otro disco.

Por ello las imagenes de VB se deben copiar con un comando especial que les genere un UUID nuevo, lo cual no dará problemas a la hora de utilizarla:

carlos@WhenIGrewUp:~/maquinas.virtuales$ sudo VBoxManage clonehd "/home/carlos/maquinas.virtuales/Debian_Ping_Antenas.vdi"  "/home/carlos/maquinas.virtuales/Debian_Router.vdi"
VirtualBox Command Line Management Interface Version 2.1.4(C) 2005-2009 Sun Microsystems, Inc.All rights reserved.0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%Clone hard disk created in format 'VDI'. UUID: 5cfc14a9-2926-444a-9406-1717512ca88b

Es necesario especificar el path completo tanto en la imagen de origen como en la de destino.

h1

Pérdida de teclado en VMWare

03/03/2009

A veces trabajando con VMWare (1.0.8 por ejemplo) en GNU/Linux, al volver al host se desconfigura el teclado, perdiéndose las mayúsculas y acentos. Para ello basta con ejecutar un comando que reestablezca el tipo de teclado.

$ setxkbmap -model logiik -layout es

Como este error suele repetirse frecuentemente, es habitual crear un script para facilitar rapidamente la restauración del teclado:

$ sudo nano /usr/bin/teclado

Con el siguiente contenido:
#!/bin/sh
setxkbmap -model logiik -layout es

Se le da permisos de ejecución:
$ chmod 777 teclado

Y a partir de entonces cada vez que se desconfigure el teclado es suficiente con ejecutarlo:
$ teclado

Otra solución es utilizar una alternativa a VMWare: VirtualBox.

h1

Enviar los sucesos de logs por red

19/02/2009

En GNU/Linux para enviar los eventos que se registran en los logs a un servidor remoto syslogd es necesario editar la configuración de los eventos y añadir la IP a la que se reenviarán.

Es posible grabarlos en local y enviarlos simultanemanete a uno o varios hosts. Para ello se edita el fichero de configuración:

#nano /etc/syslog.conf

y se añade una línea por cada evento que se quiera replicar.

# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages
*.info;mail.none;authpriv.none;cron.none @172.18.222.86

# The authpriv file has restricted access.
authpriv.* /var/log/secure
authpriv.* @172.26.0.5

# Log all the mail messages in one place.
mail.* -/var/log/maillog
mail.* @172.26.0.5

# Log cron stuff
cron.* /var/log/cron
cron.* @LogsServer

# Everybody gets emergency messages
*.emerg *
*.emerg @172.26.0.5

# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler
uucp,news.crit @172.26.0.5

# Save boot messages also to boot.log
local7.* /var/log/boot.log
local7.* @172.26.0.5

Tras editarlo, es necesario reiniciar el demonio de logs
#sudo /etc/init.d/syslog restart

h1

Error gmcs compilando con Monodevelop

09/02/2009

Si compilando con Monodevelop 1.0 ocurre el siguiente error:

ERROR [2009-02-09 21:57:59Z]: System.ComponentModel.Win32Exception: ApplicationName='/usr/bin/gmcs', CommandLine='"@/tmp/tmp1afe7a7c.tmp"', CurrentDirectory='/home/carlos/p3/p3'
at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000]
at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000]
at System.Diagnostics.Process.Start () [0x00000]
at MonoDevelop.Core.Execution.ProcessWrapper.Start () [0x00000]
at (wrapper remoting-invoke-with-check) MonoDevelop.Core.Execution.ProcessWrapper:Start ()
at MonoDevelop.Core.Execution.ProcessService.StartProcess (System.Diagnostics.ProcessStartInfo startInfo, MonoDevelop.Core.Execution.ProcessEventHandler outputStreamChanged, MonoDevelop.Core.Execution.ProcessEventHandler errorStreamChanged, System.EventHandler exited) [0x00000]

Se soluciona en dos pasos:

1º) Instalar gmcs

# sudo apt-get install mono-gmcs

2º) Al disponer de gmcs2 y no de gmcs, crear un enlace para cubrir las llamadas a gmcs

# cd /usr/bin
# sudo ln gmcs2 gmcs

h1

Conocer la topología o diagrama de red de manera gráfica en Linux

04/02/2009

Una necesidad en redes es el estudio topológico de las mismas. Para ello existen herramientas como Zenmap, un interfaz gráfico para nmap, que además realiza un escaneo de la red generando automaticamente un diagrama de la misma.

zenmap3

Para ello es necesario:

1º) Descargar nmap 4.76 o posterior.
Descargar zenmap 4.76 o posterior.
Con versiones anteriores no funcionará.

2º) Instalar el software.
Los paquetes descargados son del tipo .rpm, formato de instalación de GNU/Linux Red Hat, Fedora o derivados. Si se desea instalar en otra distribución, es necesario adaptarlos al formato utilizado. En el caso de Debian ó (K)Ubuntu, se realizará mediante la utilidad «alien»:
# sudo apt-get install alien
# sudo alien nmap-4.76-1.i386.rpm
# sudo alien zenmap-4.76-1.noarch.rpm

Instalación:
# sudo dpkg -i nmap_4.76-2_i386.deb
# sudo dpkg -i zenmap-4.76-1.noarch

3º) Ejecución:
# sudo zenmap
Se mostrará el interfaz de nmap. La búsqueda más sencilla de la red que se puede hacer es:

nmap -T Aggressive -A -v 172.26.0.0/24
(sustituyendo logicamente el rango de red por el propio).

zenmap1

Tras un tiempo de escaneo, se obtendrá en la pestaña «Topology» el diagrama de red buscado:

zenmap2