Relacionado con la entrada anterior, pero mucho más en serio, un interesante artículo sobre diversos lenguajes de programación.
Es largo, pero muy interesante. Repasa desde C hasta programación funcional. Resumen: se debería echar un vistazo a lenguajes infravalorados como LISP u Ocaml, ya que ofrecen muchas ventajas para proyectos grandes.
Thursday, December 18, 2008
Thursday, December 11, 2008
Recuperar particiones
Si, soy muy hábil. En un alarde de habilidad sin parangón, me he cargado la tabla de particiones de mi flamante nuevo portátil. Y como aquello de "En casa del herrero, cuchara de palo" no tenia ni backups externos, ni copia en el email de nada... ¡ni siquiera me acordaba del tamaño de las particiones! Se que había un swap de 4100Mb al pricipio, y luego todo se volvia borroso. Habia una partición de sistema de unos 40gigas, una de datos de unos 100, luego espacio libre y luego al final la de windows, de unos 50 gigas.
Con Windows empezó el problema. Al mover y redimensionar la partición, había dejado de arrancar (BOOTMGR no encontrado). Para arreglarlo intenté usar los DVD's de recuperación de lenovo. Aquí se juntaron varios factores:
Sólo por probar, intento "reparar el arranque" con un DVD de Vista que había por ahí. Dado que el portátil viene con licencia de Vista me siento menos culpable de usar cosas del bittorrent. El menú es grafico y maravilloso. No ofrece ninguna info sobre lo que va a hacer. Después de 5300 segundos (~ hora y media) de ver una barrita moverse, sí me dice lo que ha hecho (buscar particiones durante 1 segundo y luego escanear todo el disco en busca de sistemas de ficheros durante 5299) y pide reiniciar. No funciona, le doy a reparar de nuevo. Despues de 1 segundo no encuentra nada. Doy a cancelar y me dice "esta operación no se puede cancelar". ¡¿WTF?! ¿Cómo que no, y si apago el ordenador no se cancela? En fin... leo los ~600 feeds en Google Reader mientras se termina la operación incancelable. Me doy por vencido y arranco linux.
Aprovecho que aún tengo el usb de arranque de Arch y miro a ver que trae. Primero lo intento con parted, que ya lo he usado más de una vez con resultados bastante buenos. Nada, mi memoria de pez no ayuda y pierdo otra hora en varios intentos. No tiene que ser tan dificil, despues de todo, en los instantes que me daba cuenta de lo que hacia la herramienta de lenovo no se ha podido cargar casi nada, toda la info ha de seguir ahi... ¿No habrá nada que se lea todos los sectores y mire si se parecen a cabeceras de sistemas de ficheros? Por suerte, sí, pero no está en usb de arranque de Arch. Me bajo gpart, lo paso al portatil con el usb polivalente y ¡voilá! Ahí estan mis particiones detectadas. Y mi memoria no era tan mala: 4.102Mb de swap, 39.997Mb de sistema y 95370Mb de home. Con 50007Mb de Vista.
A apuntar los sectores, fdisk /dev/sda y todo como nuevo. No hay nada como cargarse cosas para "aprender informática".
UPDATE: a favor de Vista he de decir, que tras recuperar la tabla de particiones y dos intentos con sus respectivos reinicios, Windows vuelve a arrancar. En el primer intento restauró el BOOTMGR pero por alguna razón no arregló el sistema de ficheros, que tenía algún fallo, y necesitó otra pasada. Ya funciona todo razonablemente bien :)
Con Windows empezó el problema. Al mover y redimensionar la partición, había dejado de arrancar (BOOTMGR no encontrado). Para arreglarlo intenté usar los DVD's de recuperación de lenovo. Aquí se juntaron varios factores:
- Mi habilidad innata para cargarme cosas.
- Las herramientas de lenovo basadas en Windows para usuarios de Windows (citando a Torvalds: If you think your users are idiots, only idiots will use it).
- El hecho, aún no explicado aquí, de que las herramientas de lenovo estaban en alemán y mi nivel de alemán ahora mismo es directamente proporcional a la calidad de las traducciones de google.
Sólo por probar, intento "reparar el arranque" con un DVD de Vista que había por ahí. Dado que el portátil viene con licencia de Vista me siento menos culpable de usar cosas del bittorrent. El menú es grafico y maravilloso. No ofrece ninguna info sobre lo que va a hacer. Después de 5300 segundos (~ hora y media) de ver una barrita moverse, sí me dice lo que ha hecho (buscar particiones durante 1 segundo y luego escanear todo el disco en busca de sistemas de ficheros durante 5299) y pide reiniciar. No funciona, le doy a reparar de nuevo. Despues de 1 segundo no encuentra nada. Doy a cancelar y me dice "esta operación no se puede cancelar". ¡¿WTF?! ¿Cómo que no, y si apago el ordenador no se cancela? En fin... leo los ~600 feeds en Google Reader mientras se termina la operación incancelable. Me doy por vencido y arranco linux.
Aprovecho que aún tengo el usb de arranque de Arch y miro a ver que trae. Primero lo intento con parted, que ya lo he usado más de una vez con resultados bastante buenos. Nada, mi memoria de pez no ayuda y pierdo otra hora en varios intentos. No tiene que ser tan dificil, despues de todo, en los instantes que me daba cuenta de lo que hacia la herramienta de lenovo no se ha podido cargar casi nada, toda la info ha de seguir ahi... ¿No habrá nada que se lea todos los sectores y mire si se parecen a cabeceras de sistemas de ficheros? Por suerte, sí, pero no está en usb de arranque de Arch. Me bajo gpart, lo paso al portatil con el usb polivalente y ¡voilá! Ahí estan mis particiones detectadas. Y mi memoria no era tan mala: 4.102Mb de swap, 39.997Mb de sistema y 95370Mb de home. Con 50007Mb de Vista.
A apuntar los sectores, fdisk /dev/sda y todo como nuevo. No hay nada como cargarse cosas para "aprender informática".
UPDATE: a favor de Vista he de decir, que tras recuperar la tabla de particiones y dos intentos con sus respectivos reinicios, Windows vuelve a arrancar. En el primer intento restauró el BOOTMGR pero por alguna razón no arregló el sistema de ficheros, que tenía algún fallo, y necesitó otra pasada. Ya funciona todo razonablemente bien :)
Tuesday, December 9, 2008
makepkg... WTF!!!
Acabo de ver el error más sin sentido desde el "Teclado no detectado, pulse F1 para continuar". Esto es lo que me he encontrado al intentar recompilar gcc con Arch:
==> Extracting Sources...Ciertamente WTF. ¿Que cojones pasa, que C es un dialecto del alemán o qué? Y no, hoy no es el día de los inocentes.
-> bsdtar -x -f gcc-core-4.3.2.tar.bz2
-> bsdtar -x -f gcc-g++-4.3.2.tar.bz2
-> bsdtar -x -f gcc-fortran-4.3.2.tar.bz2
-> bsdtar -x -f gcc-objc-4.3.2.tar.bz2
-> bsdtar -x -f gcc-java-4.3.2.tar.bz2
-> bsdtar -x -f libstdc++-man-20080118.tar.bz2
==> Removing existing pkg/ directory...
==> Entering fakeroot environment...
==> Starting build()...
You need the de_DE locale to build gcc.
==> ERROR: Build Failed.
Aborting...
Saturday, December 6, 2008
Installing Arch Linux on a Lenovo ThinkPad X200s
Nota: para una explicación sobre el cambio de idoma, ver el final del post.
___________________________________________________
LAST UPDATE: March 20th, 2011
- Some things have changed: now almost everything works fine out of the box
- Graphics no longer present problems, Urban Terror is playable with no complaints and composition in KDE 4.6 works smoothly.
- Backlight adjustment works in console and graphic mode out of the box.
- Using x86_64, no problems with that.
- X input has switched back to xorg.conf. You have to add your configuration to xorg.conf.d/10-evdev.conf instead of the fdi file. (described in the Trackpoint section below)
- Energy management: check this post for a comparison between two different kernel versions.
- Fingerprint reader still doesn't have drivers.
- Suspension works out of the box. Don't use hibernation - can't comment on that.
- Microphone works (was "not tested" before)
April 7th 2009
- I've tested VGA out, results are in the video section.
- New update @ noise: check this out. I recommend the "rmmod uhci_hcd", as it also _might_ improve battery life. I've found it when looking for this other problem. As of now, running ktorrent keeps the drive busy ;)
- I've added a GRUB section.
- There has been a BIOS update which fixed the conflict that was going on. The tp_smapi module now loads fine.
April 3rd 2009
I just completed a fresh install, and I have good news! Some of the tricky things work without any intervention now:
- Backlight adjusting works out of the box with KDE4.2, I believe it is PowerDevil's work here. Can't say anything about other DEs, if it's behaving strangely you may still need the workaround described in the backlightt section.
- Trackpoint scrolling no longer needs user-compiled drivers, the standard evdev will do just fine.
- Suspend and hibernate also seem to work OK with the default settings.
I didn't experience the noise or video issues mikar described in the comments, so I can't help much with that. Check that you load the proper snd modules and you have the xf86-video-intel drivers installed and no xorg.conf file, it's the only think I can think of.
April 2nd 2009
- If you experience an annoying high-pitched noise, mikar suggests a workaround: enabling USB autosuspend makes it go away.
- There is a new BIOS available from Lenovo which adresses some unproper resource claiming. It may fix the thinkpad_ec problem, but I haven't tested it yet.
- My hard drive failed and I have to make the whole installation process again. If anything changes, I'll update the guide.
March 27th 2009
- Here you can find a energy saving guide for the laptop. Any feedback will be appreciated!
- The 3D performance with the new intel drivers is improved, but the 2D kinda sucks. Switching tabs or text files in kate is so laggy (1 second or more) that I went back to the 2.4 drivers. Also, the CPU usage of the X server is higher with the new ones. Clearly something is not ready yet, but looks promising. Maybe with 2.6.29 kernel and modesetting the whole thing is gonna start to work, but right now it's broken. I'll update the .config file as soon as I update my kernel to 2.6.29.
March 12th 2009
- With testing versions of some packages, now 3D effects seem to be working, check the Video section below for more details.
- Arch has been providing img install files with a new kernel for a while, you should absolutely use those for a new setup.
Feb 26th 2009
- Just let you know, KDE 4.2 (powerdevil actually) manages the screen brightness pretty well, the only problem it's that it is not aware of brightness changes via acpi handler. Maybe there is a way to make the handler notify powerdevil of the key press trough dbus and let powerdevil change the brightness...
- The graphic system doesn't work very well, I dont know if it's something with the intel xf86 driver or with the kernel. I tried svn versions of the packages involved and I saw no improvement whatsoever, so I'm clueless at this point. KDE4 works, but not as fast as KDE3 and Civilization4 on wine is not playable (2-3 fps).
Jan 19th 2009
- New kernel config for 2.6.28.
- Sound configuration update.
- tp_smapi 0.40 now works with a little tweak
- SD card is tested, works ok.
Previous updates: not listed (sorry)
________________________________________________________
I'm going to explain my experience installing i686 Arch Linux on a Lenovo ThinkPad X200s.
The process is a little tricky due to the specific hardware configuration of the laptop. Sorry in advance for any mistakes in the text, English is not my first language!
Hardware:
Here are the guts of this little monster:
Preparing:
To make room for linux, Vista must get shrunk, obviously. First make sure to backup Vista with the recovery media tool from Lenovo, it may come in handy in the future. Then use any tool you like to shink and optionally move the Vista partition. My tool of choice is sysreccd, a small live-cd based on gentoo, but even PartitionMagic on Vista should do the job. I shrunk it to 50GB and moved it to the end of the disk, so I had the faster parts at the beginning of the disk free for linux. Since the laptop has no optical drive and I didn't feel like buying a usb one just for this purpuose, I went with the usb thumbdrive option. I used unetbootin (great tool) to create a live-usb from the iso image and gparted to do the actual work.
UPDATE Dec-11: when you move and shrink Vista, it may stop booting. Use a Vista boot DVD (NOT the lenovo tools, they will mess your disk. You have been warned!) and choose the "Rescue system" and then "fix boot" option. You may have to do this a couple of times since it reboots after fixing every single problem and there may be more than one. Yes, this time you have no choice but to get a USB DVD drive, try borrowing one from a friend.
Usual way:
Again, no optical drive, we have to make a bootable thumbdrive with Arch install. There are several ways to do this, though. You can either use unetbootin to create it from an iso image, create the bootable usb manually with syslinux or grab a ready to use usb image from the Arch website.
First, I tired to download the ftp image for usb thumbdrives.
UPDATE (March 12th 2009): The newer ftp img (torrent, mirrors)from feb09 comes with a nice 2.6.28 kernel with support for both the ethetnet and the intel 5300 wifi card. You should definitely go this way to install a new system.
Alternative way (NOT NEEDED ANYMORE):
Lucky for me, there is a solution on the wiki, download the usb image from Tobias Powalowski's page and it comes with a new shiny 2.6.27 kernel with support for the ethernet AND the wireless card, BUT if you want to use the WiFi to perform the installation, you better go download the firmware for your card, because it may not be on the image. In my case, the 2008.10 image was "firmwareless".
If you follow the usual steps, the whole thing is going to blow up, because the installer loads a i686 kernel (GOOD) but detects the Core2Duo as a 64bit proc and installs the x86_64 packages (BAD). It ends up with an infinite loop of errors when chrooting to create the root password. To avoid this, you have to edit the mirrorlist. Anytime you want (the sooner the better) switch to another terminal and type this:
Switch back to the installation menu and you're good to go, no more specific X200s problems from here (almost). Don't forget to select you firmware in the package selection screen!
The only thing to remember is to check the modules in rc.conf. If the snd-pcsp module is listed before snd-hda-intel, sound will fail most of the time, so swap them if you need. NOTE: as the kernel 2.6.28 config suggest, you shouldn't use pcsp at all. I just removed the module from the kernel config so I don't have the module in my system. No pcsp module, no problem.
Reboot, and welcome to your new shiny Arch system!
What works out of the box:
In Arch? That would be... the keyboard. And that's the point!
Actually, a couple more things work out of the box.
First step:
I personally wanted to mantain /etc backup in subversion based on this method, so I installed subversion and made a first backup before anything, and another one after each step, just in case.
GRUB configuration
GRUB does its job fine, but you may want to improve it with some fancy. You have the whole config file above, but here are the details:
CPU frequency scaling:
Works as soon as you install and configure cpufrequtils:
Edit /etc/conf.d/cpufreq and edit frequencies to something that makes sense for you, or even comment them out, as it works perfectly autodetected.
Sound:
If you checked that snd_hda_intel is loaded before snd_pcsp (or you don't have the pcsp module at all) sound should be working but muted.
BTW: microphone works too.
Video:
The video should work without any issues even without any xorg.conf file, autodetecting the correct parameters. One extra step is necessary to install xf86-video-intel. Of course, it's always safer to follow the steps in the guide and make sure the intel driver is actually used. The new xorg server uses input hotplugging, so remember to start hal before doing any test, or override the policy in xorg.conf. If you do this, remove the Input configuration lines since the hotplugging behavior ignores them. Native 1400x900 resolution is detected flawlessly as well.
VGA-out also works, but with the suboptimally. My guess is the driver is a bit messed up with this also, as it also detects two HDMI "connected", one of them active. Anyway, with 2.4 intel drivers, you need to specify the total resolution with a "Virtual XXXX YYYY" line in your xorg.conf's display subsection, and you may need to specify the resolution you want on your external display with a Modeline in xrandr. This is an example:
UPDATE (March 12th 2009): With xorg-server 1.6.0, xf86-video-intel 2.6.3, and intel-dri 7.3, now the 3D part seem to be working, but the 2D performance is somewhat laggy, specially in Qt4 apps. For example: with several text files open in kate, when you try to switch from one to another, it takes about one second to show the second file contents since you click on its name in the toolbar, and it shows up in "chunks" of the screen. It's nothing serious, but it's certainly annoying. That 2D glithes are kind of weird, but at least glxgears now gives a decent 1140 fps. Since it seems to be a Qt4 problem, I'll try to update Qt to 4.5.0 (now in testing) and then see how things work out.
NOTE: Qt didn't help. I don't use 3D apps so I went back to the old drivers.
To install all these packages, try to compile the new xf86-video-intel module from abs/testing and it'll start complaining about dependencies, so install/build all of those. You'll end up with a small dependency-hell with xorg-server and xf86-input-evdev depending on each other, since xorg is a compile dependency for evedev, force the xorg build with the "-d" switch, install xorg (in my case with "-df" since it complained about both evdev and some existing files) and then build and install the evdev driver.
Backlight adjustment:
UPDATE (April 3rd 2009):
Backlight adjustment works just fine in KDE4, without any intervention, but doesn't work at all in console mode. Use the following instructions if you really need them!
The backlight adjusting with Fn+PgUp/PgDown almost work out of the box. The problem is that for some reason, the "video" acpi module has a one key press lag. Say the brightness is 9. You press down a few times to get it to 5. Now, if you press UP, it will go DOWN to 4 and THEN it'll start to go up, with the next key press. So if you went from 9 to 5 and now you want to go up a notch, you will have to press up three times, as the brightness goes trough 5->4->5->6. If you, like me, are annoyed by this, it has a workaround.
First, install acpid:
Now it should be working as it have. Beware, however, that this is an ugly hack and you should look for a a fixed version of the video acpi module any day soon and use some nice gui like the now broken kde's powerdevil to handle all of this.
Desktop environment:
This one is up to everyone's personal preferences, so you should know how to do it. I use KDE, so kdemod is my choice.
Multimedia Keys:
They pretty much work out of the box. Just assign them to the actions you want. However, remember that the mute key works by muting the /proc/acpi/ibm/volume, not the soundcard, so you will have to unmute it as mentioned above. Almost all the other keys work sending the appropiate XF86Whatever keycode. Fn+F3,F8,F9 send an unmapped scancode, so you can map it to whatever you fancy using Xmodmap. Mute, Fn+F5,Spacebar and Fn + the keys with no blue image send nothing; maybe is a way to fix this playing with the thinkpad-acpi key mask but I haven't looked into it yet.
TrackPoint scrolling with input hotplugging and evdev:
UPDATE (March 20th 2011): The system now got back to xorg.conf instead of fdi files. Add this to /etc/X11/xorg.conf.d/10-evdev.conf:
UPDATE (April 3rd 2009):The stock driver you can install with pacman already works, no need to compile it anymore. You still have to add the fdi file, though.
According to this thread in the Arch forums, the problem with wheel emulation is the xf86-input-evdev version. It should be rebuilt using ABS and the TrackPoint should work without any config tweak. Note: as stated in the gentoo wiki, march should be "native" if gcc>=4.3 and not using distcc. This is the most common scenario, so chances are you should use it. Install and configue ABS, go to /var/abs/extra/xf86-input-evdev, copy to your build dir and edit the PKGBUILD changing:
Suspend and Hibernate:
UPDATE (April 3rd 2009): It's hard to tell, but using the 2.6.28 kernel, suspend seems to work fine out of the box, both in Xx and console. Hibernate didn't fail either. I just tested it a few times, so I you run into trouble, use the old workaround....
It's pretty broken out of the box, usually with the resume part. Fortunately workarounds do exist to fix this. First, check you have pm-utils to try to suspend.
UPDATE: As of 2.6.28 kernel and 2.6.3 intel driver, I still use this solution, I just havent tried to suspend without the workaround, since it doesn't have any unwanted effects.
Fingerprint Reader:
The laptop comes with the new AuthenTec reader, so right now there is no driver for it, but it's being working on. In the future I'll pay it more attention, but right now I don't really need it, so I just let it be there. Besides, it's a pretty weak system.
Bluetooth:
The bluetooth is enabled/disabled via /proc/acpi/ibm/bluetooth file. When enabled, the device appears as a usb adapter. No Arch driver recognizes the hardware though. It's supposed to be supported by the btusb module, which isn't provided with Arch, despite it is in the official kernel source. Definetly something possible to resolve.
UPDATE Dec-9: once recompiled the kernel with the .config linked in the first section, bluetooth is listed in hciconfig and it's possible to scan for other devices with hcitool. No further testing was performed because bluetooth (among others) is pretty broken in KDE4.1.
UPDATE Dec-11: using the acpi handler script above, you can enable/disable bluetooth with Fn-F5.
SMAPI module:
IMPORTANT: Lenovo released a BIOS update that solves the conflict. If you haven't, you should update you BIOS and won't have any problem. If not, keep reading.
The tp_smapi module (AUR) version 0.39 can't load, with the error: thinkpad_ec: cannot claim io ports 0x1600-0x161f. Seems like unsupported hardware for now, have to wait for a new version. Accordingly, neither the accelerometer nor the advanced battery load configuration does work.
UPDATE: The tp_smapi 0.40 allows to force loading the module:
Does NOT work:
The laptop is amazing but there are some broken things.
The graphic 3D acceleration is almost usless, due to a lack of synchronization between the intel driver guys and the kernel developers. In 2.6.28 kernel should be working again. Don't use compiz or switch back to older versions. As soon as I have some spare time I'll take a look at that.
UPDATE (March 20th 201): video works in 3D and 2D without any major issues.
UPDATE (March 12th 2009): 3D acceleration works with testing versions of xorg, intel, drm, dri and a whole lot more stuff, but now 2D has some issues in Qt4 apps (see Video section above). Anyway, it seems to be solved soon.
The fingerprint reader is another one, but I already mentioned that.
Not tested:
These are things that I don't use, so I have no special interest in them.
If you need further info on installing various linux distributions on similar hardware (X200), check out the reports at tuxmobil.
___________________________________________________
Este post está en inglés, por si le es útil a alguien el mundo más allá de paises hispanohablantes. Dado que este portátil no ha llegado aún a España (ni tiene pinta de que lo haga en varios meses), dudo mucho de su utilidad ahora mismo para nadie aquí. En caso de no entender algo, aclararé cualquier duda. Dejo para un posterior post una pequeña review del portátil, porque realmente es una peazo máquina.
___________________________________________________
LAST UPDATE: March 20th, 2011
- Some things have changed: now almost everything works fine out of the box
- Graphics no longer present problems, Urban Terror is playable with no complaints and composition in KDE 4.6 works smoothly.
- Backlight adjustment works in console and graphic mode out of the box.
- Using x86_64, no problems with that.
- X input has switched back to xorg.conf. You have to add your configuration to xorg.conf.d/10-evdev.conf instead of the fdi file. (described in the Trackpoint section below)
- Energy management: check this post for a comparison between two different kernel versions.
- Fingerprint reader still doesn't have drivers.
- Suspension works out of the box. Don't use hibernation - can't comment on that.
- Microphone works (was "not tested" before)
April 7th 2009
- I've tested VGA out, results are in the video section.
- New update @ noise: check this out. I recommend the "rmmod uhci_hcd", as it also _might_ improve battery life. I've found it when looking for this other problem. As of now, running ktorrent keeps the drive busy ;)
- I've added a GRUB section.
- There has been a BIOS update which fixed the conflict that was going on. The tp_smapi module now loads fine.
April 3rd 2009
I just completed a fresh install, and I have good news! Some of the tricky things work without any intervention now:
- Backlight adjusting works out of the box with KDE4.2, I believe it is PowerDevil's work here. Can't say anything about other DEs, if it's behaving strangely you may still need the workaround described in the backlightt section.
- Trackpoint scrolling no longer needs user-compiled drivers, the standard evdev will do just fine.
- Suspend and hibernate also seem to work OK with the default settings.
I didn't experience the noise or video issues mikar described in the comments, so I can't help much with that. Check that you load the proper snd modules and you have the xf86-video-intel drivers installed and no xorg.conf file, it's the only think I can think of.
April 2nd 2009
- If you experience an annoying high-pitched noise, mikar suggests a workaround: enabling USB autosuspend makes it go away.
- There is a new BIOS available from Lenovo which adresses some unproper resource claiming. It may fix the thinkpad_ec problem, but I haven't tested it yet.
- My hard drive failed and I have to make the whole installation process again. If anything changes, I'll update the guide.
March 27th 2009
- Here you can find a energy saving guide for the laptop. Any feedback will be appreciated!
- The 3D performance with the new intel drivers is improved, but the 2D kinda sucks. Switching tabs or text files in kate is so laggy (1 second or more) that I went back to the 2.4 drivers. Also, the CPU usage of the X server is higher with the new ones. Clearly something is not ready yet, but looks promising. Maybe with 2.6.29 kernel and modesetting the whole thing is gonna start to work, but right now it's broken. I'll update the .config file as soon as I update my kernel to 2.6.29.
March 12th 2009
- With testing versions of some packages, now 3D effects seem to be working, check the Video section below for more details.
- Arch has been providing img install files with a new kernel for a while, you should absolutely use those for a new setup.
Feb 26th 2009
- Just let you know, KDE 4.2 (powerdevil actually) manages the screen brightness pretty well, the only problem it's that it is not aware of brightness changes via acpi handler. Maybe there is a way to make the handler notify powerdevil of the key press trough dbus and let powerdevil change the brightness...
- The graphic system doesn't work very well, I dont know if it's something with the intel xf86 driver or with the kernel. I tried svn versions of the packages involved and I saw no improvement whatsoever, so I'm clueless at this point. KDE4 works, but not as fast as KDE3 and Civilization4 on wine is not playable (2-3 fps).
Jan 19th 2009
- New kernel config for 2.6.28.
- Sound configuration update.
- tp_smapi 0.40 now works with a little tweak
- SD card is tested, works ok.
Previous updates: not listed (sorry)
________________________________________________________
I'm going to explain my experience installing i686 Arch Linux on a Lenovo ThinkPad X200s.
The process is a little tricky due to the specific hardware configuration of the laptop. Sorry in advance for any mistakes in the text, English is not my first language!
Hardware:
Here are the guts of this little monster:
- Intel Core 2 Duo SL9400
- 2GiB RAM DDR3 (in 1 module)
- 250Gb SATA 5400rpm HDD
- Intel GM45 Chipset
- Intel X4500HD graphic Adapter
- 12'1 inch, WXGA+ (1440x900) LCD panel
- Intel 5300AGN Wi-Fi Card
- Intel 82567LM Gigabit Network Adapter
- 5 in 1 card reader
- Modem
- TPM module
- Lenovo keyboard + TrackPoint
- ThinkLight
- Broadcom bluetooth module
- lspci
- lsusb with bluetooth enabled
- kernel .config
- A little howto in Spanish about enabling console framebuffer with intelfb to get native resolution consoles. I think the code is pretty easy to follow and I'll answer any questions. In the end, you have to give the kernel the parameter vga=874 in grub and you'll get 1440x900 fb console.
- xorg.conf
- trackpoint.fdi for scrolling with input hotplugging
- Acpi event handler.sh
- Grub's menu.lst
Preparing:
To make room for linux, Vista must get shrunk, obviously. First make sure to backup Vista with the recovery media tool from Lenovo, it may come in handy in the future. Then use any tool you like to shink and optionally move the Vista partition. My tool of choice is sysreccd, a small live-cd based on gentoo, but even PartitionMagic on Vista should do the job. I shrunk it to 50GB and moved it to the end of the disk, so I had the faster parts at the beginning of the disk free for linux. Since the laptop has no optical drive and I didn't feel like buying a usb one just for this purpuose, I went with the usb thumbdrive option. I used unetbootin (great tool) to create a live-usb from the iso image and gparted to do the actual work.
UPDATE Dec-11: when you move and shrink Vista, it may stop booting. Use a Vista boot DVD (NOT the lenovo tools, they will mess your disk. You have been warned!) and choose the "Rescue system" and then "fix boot" option. You may have to do this a couple of times since it reboots after fixing every single problem and there may be more than one. Yes, this time you have no choice but to get a USB DVD drive, try borrowing one from a friend.
Usual way:
Again, no optical drive, we have to make a bootable thumbdrive with Arch install. There are several ways to do this, though. You can either use unetbootin to create it from an iso image, create the bootable usb manually with syslinux or grab a ready to use usb image from the Arch website.
First, I tired to download the ftp image for usb thumbdrives.
# dd if=image_file of=/dev/sd[whatever letter you usb drive is]ThinkVantage key and F12 to select boot media. Arch boots and then our first nasty surprise: no network interfaces. If I understand it right, the build is from June this year, so before the e1000e bug. Maybe it was just too early and there was no support for this card in the kernel. Anyway, no net = no ftp install = crap.
UPDATE (March 12th 2009): The newer ftp img (torrent, mirrors)from feb09 comes with a nice 2.6.28 kernel with support for both the ethetnet and the intel 5300 wifi card. You should definitely go this way to install a new system.
Alternative way (NOT NEEDED ANYMORE):
Lucky for me, there is a solution on the wiki, download the usb image from Tobias Powalowski's page and it comes with a new shiny 2.6.27 kernel with support for the ethernet AND the wireless card, BUT if you want to use the WiFi to perform the installation, you better go download the firmware for your card, because it may not be on the image. In my case, the 2008.10 image was "firmwareless".
If you follow the usual steps, the whole thing is going to blow up, because the installer loads a i686 kernel (GOOD) but detects the Core2Duo as a 64bit proc and installs the x86_64 packages (BAD). It ends up with an infinite loop of errors when chrooting to create the root password. To avoid this, you have to edit the mirrorlist. Anytime you want (the sooner the better) switch to another terminal and type this:
# cd /etc/pacman.d/If you want to install over the WiFi you also have to:
# sed -e 's/x86_64/i686/g' mirrorlist > 686
# mv 686 mirrorlist
# mount /dev/sd[whatever your usb is] /mntIn case you have a WPA[2] network, replace the iwconfig command with the appropiate wpa_supplicant equivalent.
# cp /mnt/path/to/your_firmware /lib/firmware
# ifconfig wlan0 up
# iwconfig [whatever]
Switch back to the installation menu and you're good to go, no more specific X200s problems from here (almost). Don't forget to select you firmware in the package selection screen!
The only thing to remember is to check the modules in rc.conf. If the snd-pcsp module is listed before snd-hda-intel, sound will fail most of the time, so swap them if you need. NOTE: as the kernel 2.6.28 config suggest, you shouldn't use pcsp at all. I just removed the module from the kernel config so I don't have the module in my system. No pcsp module, no problem.
Reboot, and welcome to your new shiny Arch system!
What works out of the box:
In Arch? That would be... the keyboard. And that's the point!
Actually, a couple more things work out of the box.
- The Wifi should work if you installed the firmware. With kernel 2.6.28 it works in monitor mode WITH packet injection support.
- The ethernet card works.
- The Thinkpad goodies (ThinkLight, Brightness, Sensors...) also work without any intervention.
- The brightness has a weird one-press-lag: if you are reducing the brightness and then press the brightness up key, it will reduce the brightness one more step before starting to bring it up as it should (not in KDE4.2).
- The SATA hard drive works.
- The USB ports work.
- The fan is controlled automatically, it is possible to override it but there are some notes not to mess with it so I don't. It works well speeding up and slowing down as needed.
- The card reader works and hal notifies the insertion.
First step:
I personally wanted to mantain /etc backup in subversion based on this method, so I installed subversion and made a first backup before anything, and another one after each step, just in case.
GRUB configuration
GRUB does its job fine, but you may want to improve it with some fancy. You have the whole config file above, but here are the details:
- Add a graphical background to the menu with grub-gfx. This splash is the one I chose.
- Set the console framebuffer to native resolution with "vga=874" parameter to the kernel. If you know Spanish, you can take a look at my howto, if not, you can google for it or just read the commands.
- Allow hibernation/suspend-to-disk, adding the parameter "resume=/dev/YOUR_SWAP_PARTITION" to the kernel line.
CPU frequency scaling:
Works as soon as you install and configure cpufrequtils:
# pacman -S cpufrequtilsEdit /etc/rc.conf and add "acpi-cpufreq cpufreq-ondemand" to MODULES and cpufreq to DAEMONS
Edit /etc/conf.d/cpufreq and edit frequencies to something that makes sense for you, or even comment them out, as it works perfectly autodetected.
Sound:
If you checked that snd_hda_intel is loaded before snd_pcsp (or you don't have the pcsp module at all) sound should be working but muted.
# pacman -S alsa-utilsIf you still don't hear anything, check /proc/acpi/ibm/volume, make sure it is not muted (gets muted with the mute key, in case you were wondering). You can unmute it either by pressing vol up/down key or:
# alsamixer
# aplay /usr/share/sounds/alsa/Front_Center.wav
# echo -n up > /proc/acpi/ibm/volumeIf you only hear noise or very distorted sounds its probably because the audio devices got mixed up. Unload the kernel modules and load them again in the right order, prefferably load only the intel one. Also, don't forget to enable the alsa daemon as noted by the official guide.
BTW: microphone works too.
Video:
The video should work without any issues even without any xorg.conf file, autodetecting the correct parameters. One extra step is necessary to install xf86-video-intel. Of course, it's always safer to follow the steps in the guide and make sure the intel driver is actually used. The new xorg server uses input hotplugging, so remember to start hal before doing any test, or override the policy in xorg.conf. If you do this, remove the Input configuration lines since the hotplugging behavior ignores them. Native 1400x900 resolution is detected flawlessly as well.
VGA-out also works, but with the suboptimally. My guess is the driver is a bit messed up with this also, as it also detects two HDMI "connected", one of them active. Anyway, with 2.4 intel drivers, you need to specify the total resolution with a "Virtual XXXX YYYY" line in your xorg.conf's display subsection, and you may need to specify the resolution you want on your external display with a Modeline in xrandr. This is an example:
$ xrandr --newmode "1920x1080" 172.798 1920 2040 2248 2576 1080 1081 1084 1118 -hsync -vsyncFor the usual VGA, SVGA, etc, resolutions you don't need to do the latter. You can check the detected resolutions with a plain "xrandr". I believe this will change with the new modesetting+xorg+intel pack, maybe even with xorg+intel alone. Feel free to try.
$ xrandr --addmode VGA "1920x1080"
$ xrandr --output VGA --mode "1920x1080"
UPDATE (March 12th 2009): With xorg-server 1.6.0, xf86-video-intel 2.6.3, and intel-dri 7.3, now the 3D part seem to be working, but the 2D performance is somewhat laggy, specially in Qt4 apps. For example: with several text files open in kate, when you try to switch from one to another, it takes about one second to show the second file contents since you click on its name in the toolbar, and it shows up in "chunks" of the screen. It's nothing serious, but it's certainly annoying. That 2D glithes are kind of weird, but at least glxgears now gives a decent 1140 fps. Since it seems to be a Qt4 problem, I'll try to update Qt to 4.5.0 (now in testing) and then see how things work out.
NOTE: Qt didn't help. I don't use 3D apps so I went back to the old drivers.
To install all these packages, try to compile the new xf86-video-intel module from abs/testing and it'll start complaining about dependencies, so install/build all of those. You'll end up with a small dependency-hell with xorg-server and xf86-input-evdev depending on each other, since xorg is a compile dependency for evedev, force the xorg build with the "-d" switch, install xorg (in my case with "-df" since it complained about both evdev and some existing files) and then build and install the evdev driver.
Backlight adjustment:
UPDATE (April 3rd 2009):
Backlight adjustment works just fine in KDE4, without any intervention, but doesn't work at all in console mode. Use the following instructions if you really need them!
The backlight adjusting with Fn+PgUp/PgDown almost work out of the box. The problem is that for some reason, the "video" acpi module has a one key press lag. Say the brightness is 9. You press down a few times to get it to 5. Now, if you press UP, it will go DOWN to 4 and THEN it'll start to go up, with the next key press. So if you went from 9 to 5 and now you want to go up a notch, you will have to press up three times, as the brightness goes trough 5->4->5->6. If you, like me, are annoyed by this, it has a workaround.
First, install acpid:
# pacman -S acpidStart it at boot and now:
# $EDITOR /etc/rc.conf -> DAEMONS += "@acpid"Configure the thinkpad_acpi module to take care of brightness:
# /etc/rc.d/acpid start
# rmmod videoAnd edit /etc/acpi/handler.sh to make the adjustment for you:
# rmmod thinkpad_acpi
# modprobe thinkpad_acpi brightness_enable=1
# cat /sys/devices/platform/thinkpad_acpi/hotkey_all_mask > /sys/devices/platform/thinkpad_acpi/hotkey_mask
[...]NOTE: you have the whole file linked in the files section above.
ibm/hotkey)
case "$4" in
[...]
*1011)
echo down > /proc/acpi/ibm/brightness ;;
*1010)
echo up > /proc/acpi/ibm/brightness ;;
[...]
Now it should be working as it have. Beware, however, that this is an ugly hack and you should look for a a fixed version of the video acpi module any day soon and use some nice gui like the now broken kde's powerdevil to handle all of this.
Desktop environment:
This one is up to everyone's personal preferences, so you should know how to do it. I use KDE, so kdemod is my choice.
Multimedia Keys:
They pretty much work out of the box. Just assign them to the actions you want. However, remember that the mute key works by muting the /proc/acpi/ibm/volume, not the soundcard, so you will have to unmute it as mentioned above. Almost all the other keys work sending the appropiate XF86Whatever keycode. Fn+F3,F8,F9 send an unmapped scancode, so you can map it to whatever you fancy using Xmodmap. Mute, Fn+F5,Spacebar and Fn + the keys with no blue image send nothing; maybe is a way to fix this playing with the thinkpad-acpi key mask but I haven't looked into it yet.
TrackPoint scrolling with input hotplugging and evdev:
UPDATE (March 20th 2011): The system now got back to xorg.conf instead of fdi files. Add this to /etc/X11/xorg.conf.d/10-evdev.conf:
Section "InputClass" Identifier "Trackpoint Wheel Emulation" MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device" MatchDevicePath "/dev/input/event*" Option "EmulateWheel" "true" Option "EmulateWheelButton" "2" Option "Emulate3Buttons" "false" Option "XAxisMapping" "6 7" Option "YAxisMapping" "4 5" EndSection
UPDATE (April 3rd 2009):
According to this thread in the Arch forums, the problem with wheel emulation is the xf86-input-evdev version. It should be rebuilt using ABS and the TrackPoint should work without any config tweak. Note: as stated in the gentoo wiki, march should be "native" if gcc>=4.3 and not using distcc. This is the most common scenario, so chances are you should use it. Install and configue ABS, go to /var/abs/extra/xf86-input-evdev, copy to your build dir and edit the PKGBUILD changing:
- pkgver->2.1.0
- md5sums->a6070ead29b2d81b5b386a96df2661b8 (here is the source if you want to md5 it yourself)
$ makepkgRestart the X server and try. It may work you automatically, but in my case, the autoconf didn't work. Reading /var/log/Xorg.0.log I figured out that it was trying to emulate the wheel with button 4, not 2. To fix this, create "/etc/hal/fdi/policy/trackpoint.fdi" and paste something like this (sorry for the broken indentation, blogger sucks for not including some [code] label. If you want the nice version, check out the snippet section):
# pacman -U xf86-input-evdev-2.1.0-1-i686.pkg.tar.gz
<?xml version="1.0" encoding="utf-8"?>Then, restart hal with:
<deviceinfo version="0.2">
<device>
<match key="info.product" contains="TrackPoint">
<merge key="input.x11_options.Emulate3Buttons" type="string">on</merge>
<merge key="input.x11_options.Emulate3TimeOut" type="string">50</merge>
<merge key="input.x11_options.EmulateWheelTimeOut" type="string">200</merge>
<merge key="input.x11_options.ZAxisMapping" type="string">4 5</merge>
<merge key="input.x11_options.EmulateWheel" type="string">on</merge>
<merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>
<merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
<merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
</match>
</device>
</deviceinfo>
# /etc/rc.d/hal restartRestart the X server (yep, again) and your scrolling should be working perfectly now.
Suspend and Hibernate:
UPDATE (April 3rd 2009): It's hard to tell, but using the 2.6.28 kernel, suspend seems to work fine out of the box, both in Xx and console. Hibernate didn't fail either. I just tested it a few times, so I you run into trouble, use the old workaround....
It's pretty broken out of the box, usually with the resume part. Fortunately workarounds do exist to fix this. First, check you have pm-utils to try to suspend.
# pacman -S pm-utilsJust in case it work, try to both suspend and hibernate. It's a feature that's changing very fast, so by the time you read this it may be working.
# pm-suspendIf it doesn't work, try this solution. For me, it worked perfectly, with a 2.6.27-7 kernel, 1.5.3-3 xorg server and 2.4.3 intel driver. I tried to build the 2.5.1 intel driver with ABS as I did with evdev, but it depends on libdrm>=2.4.0, I have 2.3.1 and I don't want to rush too many updates so I left it with the workaround for now.
[...]
# pm-hibernate
[...]
UPDATE: As of 2.6.28 kernel and 2.6.3 intel driver, I still use this solution, I just havent tried to suspend without the workaround, since it doesn't have any unwanted effects.
Fingerprint Reader:
The laptop comes with the new AuthenTec reader, so right now there is no driver for it, but it's being working on. In the future I'll pay it more attention, but right now I don't really need it, so I just let it be there. Besides, it's a pretty weak system.
Bluetooth:
The bluetooth is enabled/disabled via /proc/acpi/ibm/bluetooth file. When enabled, the device appears as a usb adapter. No Arch driver recognizes the hardware though. It's supposed to be supported by the btusb module, which isn't provided with Arch, despite it is in the official kernel source. Definetly something possible to resolve.
UPDATE Dec-9: once recompiled the kernel with the .config linked in the first section, bluetooth is listed in hciconfig and it's possible to scan for other devices with hcitool. No further testing was performed because bluetooth (among others) is pretty broken in KDE4.1.
UPDATE Dec-11: using the acpi handler script above, you can enable/disable bluetooth with Fn-F5.
SMAPI module:
IMPORTANT: Lenovo released a BIOS update that solves the conflict. If you haven't, you should update you BIOS and won't have any problem. If not, keep reading.
The tp_smapi module (AUR) version 0.39 can't load, with the error: thinkpad_ec: cannot claim io ports 0x1600-0x161f. Seems like unsupported hardware for now, have to wait for a new version. Accordingly, neither the accelerometer nor the advanced battery load configuration does work.
UPDATE: The tp_smapi 0.40 allows to force loading the module:
# modprobe tp_smapiAnd now you can adjust the fan and use the accelerometer as in any thinkpad.
FATAL: Error inserting tp_smapi (/lib/modules/2.6.28-ranger/extra/tp_smapi.ko): Unknown symbol in module, or unknown parameter (see dmesg)
# dmesg
[...]
thinkpad_ec: cannot claim IO ports 0x1600-0x161f... consider using force_io=1.
[...]
# modprobe thinkpad_ec force_io=1
# modprobe tp_smapi
#
Does NOT work:
The laptop is amazing but there are some broken things.
UPDATE (March 20th 201): video works in 3D and 2D without any major issues.
UPDATE (March 12th 2009): 3D acceleration works with testing versions of xorg, intel, drm, dri and a whole lot more stuff, but now 2D has some issues in Qt4 apps (see Video section above). Anyway, it seems to be solved soon.
The fingerprint reader is another one, but I already mentioned that.
Not tested:
These are things that I don't use, so I have no special interest in them.
Microphone input, Integrated MicrophoneTested, works- Modem (might work, some Lenovo come with real modems)
- TPM module (no idea about this one)
If you need further info on installing various linux distributions on similar hardware (X200), check out the reports at tuxmobil.
___________________________________________________
Este post está en inglés, por si le es útil a alguien el mundo más allá de paises hispanohablantes. Dado que este portátil no ha llegado aún a España (ni tiene pinta de que lo haga en varios meses), dudo mucho de su utilidad ahora mismo para nadie aquí. En caso de no entender algo, aclararé cualquier duda. Dejo para un posterior post una pequeña review del portátil, porque realmente es una peazo máquina.
Monday, December 1, 2008
Instrucciones de la NASA
Después de leer en Microsiervos el desenlace de la misión STS-126 de la NASA, he estado leyendo sobre los aviones de transporte de transbordadores espaciales. Hay datos muy curiosos, pero lo que más me gustó fue una nota de aviso en uno de ellos, concretamente en uno de los anclajes para fijar el transbordador al avión. Aquí está la foto del anclaje en cuestión:
Origen: http://edwards.airshowjournal.com/2003/
La nota dice lo siguiente: "ATTACH ORBITER HERE", es decir "Acoplar Transbordador Aqui". Por si no fuera suficiente, debajo hay una aclaracion, "BLACK SIDE DOWN": "Con la parte negra hacia abajo".
En el fondo son unos cachondos estos de la NASA...
Origen: http://edwards.airshowjournal.com/2003/
La nota dice lo siguiente: "ATTACH ORBITER HERE", es decir "Acoplar Transbordador Aqui". Por si no fuera suficiente, debajo hay una aclaracion, "BLACK SIDE DOWN": "Con la parte negra hacia abajo".
En el fondo son unos cachondos estos de la NASA...
Subscribe to:
Posts (Atom)