My uptime hits 50d

I am bored, working a little bit too much overtime, and I just realized that my work computer’s uptime exceeded 50 days today. Yes, this means that I last rebooted my computer 50 days ago.

I realize that this number is far from impressive, but I can’t help but compare it with the case of our only fellow workmate who uses Windows (XP). He once left his computer on and unattended for a couple of weeks (he went on a trip abroad), and to be fair Windows behaved: it didn’t crash. However, when he is working he religiously turns the computer off every evening, because (he says), “otherwise it eventually slows down to a crawl”. My beloved Debian runs as smoothly as the first day, after being on (and under heavy use) for almost two months.

Comments

First spam e-mail I actually found amusing!

I just received a spam e-mail with the following subject:

Linux is covered by the GNU General Public License (GPL), which allows free distribution of the code please read the GPL in appendix

Except poor punctuation, the sentence makes sense, and covers a subject I could actually be interested on :^)

This e-mail is one of the things I have found most interesting recently.

Well, at least among the ones I’ve sent to complete oblivion with a key press.

Comments

Linux in the metropolitan buses of Donostia

Today I have taken the usual bus to the city center, and noticed that the monitors they have in the buses, showing general info and commercials, where blank. Well, not exactly blank: some white letters littered the black screens. “Oh, dear” – I thought – “another Windows crash”. Not quite: the messages the monitors where showing corresponded to GNU/Linux!!

Below you can see a photo I took. Click in the picture for full-size version.

I also took a second pic, without flash:

I apologize for the poor quality of the pictures, but taking photos of low-luminance screens in bright ambients, and inside a moving bus is not trivial (and my digital camera is not the best ever).

If one forces one’s eyes, the following fragments can be read:

* search_bg_key: invalid format found in block [...]
* is_leaf: free space seems wrong: level 1
* reiserfs_read_inode2: i/o failure ocurred trying to find [...]
* /home/terminal/datos/backup/20070217-def[...]-md5
* Unable to handle paging request at virtual address [...]

From my ignorance, it seems one hard disk failed, or maybe a connection (say, the USB cable to an external disk) was broken, or a device’s capacity exhausted. Of course, it might well be a failure of the OS (albeit quite unlikely, being GNU/Linux).

In any case, I was shocked to discover that the city council has decided to give Linux a go. Well done, Mr. Elorza!

Comments (3)

Vista vs Mepis

Wanna see how a humble GNU/Linux distro such as Mepis compares to Windows Vista? We are not talking of Ubuntu, Debian, Mandriva or SuSE Enterprise Edition here. No big-fat distros. Just Mepis, a distro that fits in a single CD that can be used to install it, or run it as a LiveCD.

You can read a throughout article at DesktopLinux.com. Enjoy!

Comments

Bandwidth shaping made easy with Trickle

I have recently downgraded the bandwidth of my internet connection, switching to a flat rate (previously I had a monthly traffic limit, albeit with a wider bandwidth). This means that now I can download to my heart’s content, but it also means that when doing things like upgrading my Debian OS with aptitude, it eats all of my bandwidth, and I can barely do anything else in the Internet, untill all packages are upgraded.

A similar effect can happen when using p2p software like aMule or KTorrent, but these programs have options to throttle down their bandwidth usage (e.g., set maximum download and upload rates).

When dealing with programs that do not have this facility, we can always resort to Trickle, which can set arbitrary limits to any program it is used with. For example:

% trickle -d 20 aptitude upgrade

will run aptitude upgrade as usual, but with a maximum download rate of 20 kB/s. Note: aptitude usually spawns two processes (downloads files in couples, not one by one), and the limit imposed by trickle is applied to each process, so the used download bandwidth will be double that specified in the command line. Or, in other words, if you want aptitude to use X bandwidth, execute:

% trickle -d X/2 aptitude upgrade

Comments (2)

Software Libre en Computer Hoy

He cometido la herejía de comprar el último ejemplar (Nº 218) de la revista de ordenadores Computer Hoy, porque hablaba de Windows Vista, y tenía ganas de reir un rato.

En general Computer Hoy no es que sea tan mala revista (sobre todo para el razonable precio de 1.80 euros), simplemente está centrada casi exclusivamente en Windows, y por tanto tiene poco interés para mí.

En cualquier caso, he notado que en la revista (al menos en este ejemplar), tienen una curiosa costumbre: llamar simplemente “gratuito” al software libre, evitando escrupulosamente mencionar el adjetivo “libre”, como si fuera simple freeware. Esto me indigna, por el valor insultante que tiene poner en el mismo saco un programa que cierta empresa distrubuye gratis, para captar clientes (con el objetivo último de ganar dinero), con software desarrolado por voluntarios, que creen en ciertos ideales de compartir conocimiento en libertad.

Como tenía tiempo (poco) y ganas (muchas), me he decidido a mandar una carta al director (director[at]computerhoy[dot]com). Abajo transcribo dicha carta:

Estimado Sr. Sagrado,

Como usuario de software libre, y dado mi muy limitado interés en Windows,
comprenderá que no sea un lector asiduo de su revista Computer Hoy. De todos
modos, de vez en cuando la compro, porque suele ser una lectura entretenida,
y los temas no relacionados con Microsoft me parecen interesantes y muy bien
explicados. Felicidades en este sentido.

Mi presente interés concierne al último ejemplar de su revista (Nº 218,
9-Feb-2007), y el trato que en él dan al software libre. Concretamente
quisiera resaltar las menciones que hacen a, al menos, 2 programas (Launchy
p34 y Audacity pp67,87) y un codec (Lame pp86,87). Dicen de ellos que
son “gratuitos”, cuando deberían decir “libres”. En castellano no existe la
posibilidad de confusión entre los dos significados de “free”, y estas tres
piezas de software que menciono son “software libre”, ya que están
licenciadas bajo la GNU GPL. Su gratuidad es circunstancial. Es su libertad
lo consubstancial a estos programas.

En el caso de Audacity (p87), incluso lo meten en el mismo saco de un
convertidor MP3/WMA que es un freeware sonrojante (visite koyotstar.free.fr y
juzgue ud. mismo). Cito:

“[Lame e]s (http://lame.sourceforge.net) un códec gratuito (sic) que se emplea
en muchos programas de edición de audio, o de conversión, también gratuitos
(sic). El ejemplo perfecto es el editor Audacity
(http://audacity.sourceforge.net/?lang=es), o el conversor de archivos Free
MP3 WMA converter (www.koyotstar.free.fr).”

Como revista especializada, entiendo que Computer Hoy tiene la responsabilidad
de formar a sus lectores, o al menos la obligación de ser fieles a la verdad.
Por ello es lamentable ver a expertos informáticos confundir términos tan
diametralmente opuestos como “free software” y “freeware”.

Quiero pensar que tal situación se debe a algún despiste, aunque dicha
eventualidad es relativamente poco verosímil, ya que no una ni dos, sino
todas las menciones que se hacen a software libre en ese número de la revista
omiten el término correcto, sustituyendo libertad por gratuidad.

En caso de que no fuera un despiste aislado, no queda más opción que pensar
que, o bien lo han hecho por ignorancia (lo cual haría perder la fe del
lector en la corrección de los temas tratados en su revista), o bien han
obrado con plena conciencia de dicha incorrección (lo cual haría perder la fe
del lector en la objetividad de los temas tratados en su revista).

Espero sinceramente que la primera de las tres opciones sea la correcta, y
sería realmente positivo que en el futuro dieran al software libre el trato
que merece, calificándolo de libre, y no de gratuito como mero freeware.

Atentamente,

Iñaki Silanes

Comments

WiFi with WPA under Ubuntu/Debian

I finally made my new laptop connect with WPA encryption to my WiFi router!!

I could already connect it to WiFi networks with WEP encryption (or no encription at all), but WPA proved harder.

Mini HowTo

1) My setup is the following:

WiFi router: SMC Barricade WBR14-G2
WiFi card in laptop: Intel PRO/Wireles 3945
OS: Ubuntu 6.06 LTS (Dapper Drake)

2) The router settings:

Wireless encryption: WPA/WPA2 Only
Cipher suit: TKIP+AES (WPA/WPA2)
Authentication: Pre-shared Key (yes, I know 802.1X would be more secure… sue me)
Pre-shared key type: Passphrase (8~63 characters)

3) The package one needs to install:

# aptitude install wpasupplicant

4) Making WPA supplicant run:

First, create a config file, by the name /etc/wpa_supplicant.conf, and inside it, write:

ctrl_interface=/var/run/wpa_supplicant
ap_scan=1

network={
  ssid="your_ssid_name"
  scan_ssid=0
  proto=WPA RSN
  key_mgmt=WPA-PSK
  pairwise=TKIP CCMP
  group=TKIP CCMP
  psk="your_preshared_key"
  priority=5
}

At that point, you should make sure that the WiFi is turned on, and that the correct driver is loaded. In my case:

# modprobe ipw3945

Then, to test the WPA supplicant, run:

# wpa_supplicant -Dwext -ieth1 -c /etc/wpa_supplicant.conf

Recall I have used the wext device, instead of the ipw one, that would seem the appropriate one. Well, I read somewhere, that with 2.6.16 kernels and newer, this should be the case. Now I recall that my kernel is 2.6.15… nevermind, it works that way, and not the other (with -Dipw).

Recall also that my wireless device is eth1. Your mileage may vary (but each wireless card model gives rise to a precise device name, don’t worry).

If everything went fine, the output for the above command should be something like:


# wpa_supplicant -Dwext -ieth1 -c /etc/wpa_supplicant.conf
Trying to associate with xx:xx:xx:xx:xx:xx (SSID='xxxxxxxx' freq=0 MHz)
CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys
Authentication with 00:00:00:00:00:00 timed out.
Associated with xx:xx:xx:xx:xx:xx
WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=TKIP]
CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed (auth)

If you see that “negotiation completed”, it worked (Ctr-C to exit the above).

5) Automating the WPA connection when bringing wireless interface up

Next, I’ll explain the small changes one has to make to /etc/network/interfaces to correctly bring up the interface. As I said, my wireless interface is eth1, so, I added the lines below to the aforementioned config file:


iface eth1 inet dhcp
wireless-essid my_wireless_essid
pre-up wpa_supplicant -Bw -Dwext -ieth1 -c /etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant

And that’s all! Whenever you ifup eth1, you’ll bring up the wireless interface, with WPA encryption working.

Comments (5)

My public and open University II (es)

Copy-paste de un e-mail que recibido de la UPV/EHU, y la respuesta que he mandado. Para información adicional, leer anterior post (en).

Estimada XXXX,

No es cierto que me sea imposible remitir la ficha Teseo en formáto electrónico. De hecho, ya se la he mandado a uds., tanto en RTF como en DOC, como en texto plano y en un PDF escaneado. La Normativa, si no me equivoco, señala que debe cumplimentarse y enviarse dicha ficha, no que deba hacerse en cierto formato concreto (RTF).

El problema es que el RTF (el único formato que uds. hacen accesible), es un formato PRIVATIVO, que solo es correctamente leido por programas NO LIBRES, como Microsoft Word, bajo Microsoft Windows. He hecho todo lo que he podido para leer ese RTF correctamente con programas libres (OpenOffice), y el resultado (lamentable) es lo que mandé a YYYY (doc17_Teseo.rtf), el 19 de diciembre.

Aunque dispuesto a poner buena voluntad, no deseo utilizar productos privados, con licencias abusivas y precios elevados, para acceder a material de una Universidad PÚBLICA, finaciada con dinero PÚBLICO, de todos los contribuyentes. Para el intercambio de ficheros como ese, ya existe un estándar abierto y libre (ISO/IEC 26300), que es el Open Document Format:

http://es.wikipedia.org/wiki/OpenDocument

Me causan uds. una molestia tremenda al no poder acceder libremente al material de la Universidad en la que llevo años estudiando, y que mis conciudadanos y yo pagamos con impuestos.

Cediendo a sus presiones, he accedido a un ordenador con Windows y he generado el RTF que les mando. Compruebo consternado que ni siquiera con Windows el formateo del fichero es correcto, y algunas cosas salen fuera de sitio.

Lamento esta circunstancia, y reitero mi interés en hacer las cosas lo más cómodamente posible, también para uds. Pero también reitero que no estoy dispuesto a ceder mis derechos, como uds. comprenderán.

Finalmente, desearía me informaran de una dirección electrónica a donde dirigirme para quejarme de esta lamentable actitud de la UPV/EHU, ya que si la gente traga y nadie se queja (como uds. bien señalan), parece que no hay problema, y este se perpetuará.

Atentamente,

Iñaki Silanes

On Monday 08 January 2007 10:03, you wrote:
> Estimado Iñaki,
>
> Habiéndose recibido en esta Sección de Master y Doctorado, correo
> electrónico en el que nos indica que le es imposible remitir la ficha
> Teseo correspondiente en un formato electrónico, lamento comunicarle
> que esto es necesario, tal y como indica el artículo 51 de la Normativa
> de Gestión de Doctorado. Hasta el momento, no se han recibido quejas
> sobre la imposiblidad de rellenar dicha ficha Teseo, ni por por
> personal propio de la UPV/EHU, ni por aquellos alumnos ajenos a ésta,
> recibiéndose en todos los casos. Por lo tanto, le solicito que remita
> este documento.
>
> Atentamente
>
> XXXX
> Sección Master y Doctorado

Comments

My backups with rsync

In previous posts I have introduced the use of rsync for making incremental backups, and then mentioned an event of making use of such backups. However, I have realized that I haven’t actually explained my backup scheme! Let’s go for it:

Backup plan

I make a backup of my $home directory, say /home/isilanes. Each “backup” will be a set of 18 directories:

  • Current (last day)
  • 7 daily
  • 4 weekly
  • 6 monthly

Each such dir has an apparent complete copy of how /home/isilanes looked like at the moment of making the backup. However, making use of hard links, only the new bits of info are actually written. All the parts that are redundant are written once on disk, and then linked from all the places referring to it.

Result: a 18 copies of a $home of 3.8 GB in a total of 8.7 GB (14% of the apparent size of 63 GB, and 13% of 18x the info size, 68,4 GB).

Perl script for making the backup

Update (Jun 5, 2008): You can find a much refined version of the script here. It no longer requires certain auxiliary script to be installed in the remote machine, and is “better” in general (or it should be!)

Below is the commented Perl script I use. Machine names, directories and IPs are invented. Bart is the name of my computer.


#!/usr/bin/perl -w

use strict;

my $rsync = "rsync -a -e ssh --delete --delete-excluded";
my $home = "/home/isilanes";
my $logfile = "$home/.LOGs/backup_log";

#
# $where -> where to make the backup
#
# $often -> whether this is a daily, weekly or monthly backup
#
my $where = $ARGV[0] || 'none';
my $often = $ARGV[1] || 'none';

my ($source,$remote,$destdir,$excluded,$to,$from);

# Possible "$where"s:
my @wheres = qw /machine1 machine2/;

# Possible "$often"s:
my @oftens = qw /daily weekly monthly/;

# Check remote machine:
my $pass = 0;
foreach my $w (@whats) { $pass = 1 if ($what eq $w) };
die "$what is an incorrect option for \"what\"!\n" unless $pass;

# Check how-often:
$pass = 0;
foreach my $o (@oftens) { $pass = 1 if ($often eq $o) };
die "$often is an incorrect option for \"often\"!\n" unless $pass;

# Set variables:
if ($what eq 'machine1')
{
# Defaults:
$source = $home;
$remote = '0.0.0.1';
$destdir = '/disk2/backup/isilanes/bart.home.current';
$excluded = "--exclude-from $home/.LOGs/excludes_backup.dat";
$to = 'machine1';
$from = 'bart';
}
elsif ($what eq 'machine2')
{
# Defaults:
$source = $home;
$remote = '0.0.0.2';
$destdir = '/scratch/backup/isilanes/bart.home.current';
$excluded = "--exclude-from $home/.LOGs/excludes_backup.dat";
$to = 'machine2';
$from = 'bart';
}

# Do the job:
unless ($what eq 'none')
{
unless ($often eq 'none')
{
# Connect to the remote machine, and run ANOTHER script there, making a rotation
# of the backup dirs:
system "ssh $remote \"/home/isilanes/MyTools/rotate_backups.pl $often\"";

# Actually make the backup:
system "$rsync $excluded $source/ $remote:$destdir/";

# "touch" the backup dir, to give it present timestamp:
system "ssh $remote \"touch $destdir\"";

# Enter a line in the log file defined above ($logfile):
&writelog($from,$often,$to);
};
};

sub writelog
{
my $from = ucfirst($_[0]);
my $often = $_[1];
my $to = uc($_[2]);
my $date = `date`;

open(LOG,">>$logfile");
printf LOG "home@%-10s %-7s backup at %-10s on %1s",$from,$often,$to,$date;
close(LOG);
};

As can be seen, this script relies on the remote machine having a rotate_backups.pl Perl script, located at /home/isilanes/MyTools/. That script makes the rotation of the 18 backups (moving current to yesterday, yesterday to 2-days-ago, 2-days-ago to 3-days-ago and so on). The code for that:


#!/usr/bin/perl -w

use strict;

# Whether daily, weekly or monthly:
my $type = $ARGV[0] || 'daily';

# Backup directory:
my $bdir = '/disk4/backup/isilanes/bart.home';

# Max number of copies:
my %nmax = ( 'daily' => 7,
'weekly' => 4,
'monthly' => 6 );

# Choose one of the above:
my $nmax = $nmax{$type} || 7;

# Rotate N->tmp, N-1->N, ..., 1->2, current->1:
system "mv $bdir.$type.$nmax $bdir.tmp" if (-d "$bdir.$type.$nmax");

my $i;
for ($i=$nmax-1;$i>0;$i--)
{
my $j = $i+1;
system "mv $bdir.$type.$i $bdir.$type.$j" if (-d "$bdir.$type.$i");
};

system "mv $bdir.current $bdir.$type.1" if (-d "$bdir.current");

# Restore last (tmp) backup, and then refresh it:
system "mv $bdir.tmp $bdir.current" if (-d "$bdir.tmp");
system "cp -alf --reply=yes $bdir.$type.1/. $bdir.current/" if (-d "$bdir.$type.1");

Comments

Beware of new UDEV rules!

As some of you might know, udev is a nice program that gives the user the possibility of giving persistent names to hotplugged items (e.g. USB devices), in GNU/Linux systems.

When a USB device is plugged, the kernel “finds” it, and gives it a device name. This “name” is a special file (located at the /dev directory), with which the communication with the USB device is done. For example, this is the name that has to be used for mounting the device:

# mount /dev/devicename /mnt/mountpoint

Now, the old devfs (superceded by udev) gave subsequently plugged USB devices sequential names (e.g., the first one sda, the second one sdb…). So, the device name would not correspond to the physical device you were plugging: an external HD and a portable music player would be given devices sda and sdb respectively, or the opposite, depending on the plugging order!

To fix this, udev allows for creating rules, so that a device matching this rules will always be given the same device name. Each USB device passes some info to the kernel at plugtime, so udev can use that info to identify the device. For example, an excerpt of dmesg in my Debian box, when I connect my external HD:

scsi6 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 9
usb-storage: waiting for device to settle before scanning
Vendor: FUJITSU Model: MHT2080AT Rev: 0811
Type: Direct-Access ANSI SCSI revision: 00
SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)

The relevant points are that the HD identifies itself as a FUJITSU product, with the model name MHT2080AT. I can now tell udev to create a /dev/woxter device node, each time I plug in a device made by “FUJITSU”, and by the model name of “MHT2080AT”. To do so, I can create a file /etc/udev/rules.d/myrules.rules, with content:

# My Woxter disk:
BUS=="scsi", SYSFS{vendor}=="FUJITSU", SYSFS{model}=="MHT2080AT", NAME="woxter"

Now, the original reason to write this post was that… do you see the '=='? behind 'BUS' and 'SYSFS'? Well, they have the usual meaning of ‘BUS==”scsi”‘ means ‘if BUS equals “scsi”‘, whereas ‘NAME=”woxter”‘ means ‘assign the value “woxter” to “name”‘.

However, in previous versions of udev (I don’t know when they changed), all equal signs in the udev rules were single ‘=’s, and that is the way I had them.

Now, all of a sudden, I update udev, and my USB devices do not get the name they should, according to my rules, because my rules are wrong! Man, they should give a warning or something! Something like:

Warning: file X, line Y. Use of '=' where '==' is expected!

Oh, well. In the end I found out by myself.

Comments

« Previous Page« Previous entries « Previous Page · Next Page » Next entries »Next Page »