Michal Čihař - Blog Archives for Linux

Intel SSD firmware update on Linux

For quite some time, I've suffered slow boot - it had useless 10 seconds delay while initializing SATA with SSD disk:

[    2.761669] ata1: SATA max UDMA/133 abar m2048@0xf2528000 port 0xf2528100 irq 44
[    8.118202] ata1: link is slow to respond, please be patient (ready=0)
[   12.764701] ata1: COMRESET failed (errno=-16)
[   13.084612] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

After some googling, I came to conclusion it is bug in SSD firmware and looked for update. Release notes documented some fixes to slow boot, what seemed to be related. The only issue was that the firmware update is available only as ISO image. And guess what I have no CDROM (actually I have no clue for what I would have used it).

Fortunately the update is doable with just grub and syslinux.

First, download ISO provided by Intel and extract eltorito boot image from it using geteltorito script and copy it to /boot/. Then get yourself syslinux and copy memdisk to /boot/.

Now you just need to edit grub configuration to include following lines (you might need to adjust it according to your partition setup):

menuentry "SSD Update" {
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos1)'
        linux16 /memdisk
        initrd16 /ssd-fw.img

Now you can reboot and choose SSD Update from the grub menu and perform update!

After update the slowest part of boot process is me entering LUKS password, but I'm afraid this is not easily fixable :-).

PS: The difference you can see after update:

[    2.797551] ata1: SATA max UDMA/133 abar m2048@0xf2528000 port 0xf2528100 irq 44
[    3.115694] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

Audio playback at home

Just set up Synology Audio Station for music playback at home. I originally thought about some more open solution, but this was the easiest choice which might still change. Main motivation was that I got really cheaply Synology Remote, what is wireless remote and USB sound card and I was too lazy to set it up with something else.

It works quite nicely but now I'd like to control it from my N950 phone. Synology provide app for iPhone and Android, but others are left in the dark (there is also no documentation about the protocol). The options for me are to write native client or emulate some well know protocol, where I could use existing clients.

Quick googling have shown me python-mpd-server, what looks exactly as half of program I need, so I would have to implement only bindings to (not documented) Audio Station protocol (there is open-syno, which seems to implement this protocol, so at least there will be some hints).

ColorHug with non English locales

Since infamous erasing of factory calibration in my ColorHug device and restoring calibration matrix, I noticed it did screen calibration wrong. However I did not find time to properly investigate the issue. Yesterdays mail from Richard was actually trigger for me so I've opened up this topic.

In the end it turned out to be caused by Little CMS wrongly parsing CCMX in case you are using locales which use something else than . as decimal point.

After lot of googling, I've realized there is probably no good way of parsing floats independent on current locales, so I used one of hacks I found and I think it's less intrusive - get current decimal point by printing float string using printf and then convert the string to it. I know it looks ugly, but including own implementation of strtod is also not nice and playing with locales is definitely something not thread safe to do within widely used library.

Anyway I've asked upstream to merge my patches, so let's see what they think of it.

Configuring standalone XBMC

I have a laptop used for playing music (and occasionally also videos) which is currently running Windows XP with XBMC. Reinstalling this beast to Linux is on my todo list for ages and now I've finally found time to try that.

Starting Debian installer worked like charm and in few minutes I got Debian system running. I've chosen to run sid, well for reason I run it usually on place where I want latest software. Installing XBMC from Debian multimedia worked also fine and you can easily find some howtos for directly starting XBMC.

And that's where I ran into trouble - XBMC is damn slow. Notebook has oldish nVidia GeForce FX Go5200 card, which seems to be poorly supported by nouveau (and "Do not file bug reports about this driver." suggest that this is what authors do expect). Okay, I can survive having some binary crap so let's try nVidia proprietary drivers. I've quickly realized that the legacy drivers won't work with recent xserver and probably also not with the kernel.

Maybe I should try installing something older, what would run binary drivers, but for now I gave up and system is back on Windows (with all problems I have there...).

Linux hardware support

Remembering not so far away history, I'm always a bit afraid when I'm about to use new hardware with Linux. It used to be troublesome to make some devices work.

After getting Linux based phone last week, I've also received new notebook, where I want to run Debian as well. I expected various troubles, but surprisingly everything works like a charm without single line of configuration. Wireless networking, docking station, card reader, webcam, fingerprint reader and so on.

All I had to do is to pull SSD out of old X60 notebook and put it into new X220. The only (though unnecessary) change was installation of 64-bit kernel (I currently see no big benefit in migrating to 64-bit userspace) and everything is working. Can your operating system do this?

Thanks to all people who have helped in this.

Playing with DLNA aka uPNP

Having Synology diskstation, notebook with XBMC and smart phone with Symbian, it should be possible to make all these talk together being able to play music stored on the diskstation using XBMC and controlled by phone, right?

I tried to set it up some time ago, but I used samba export on the diskstatio and all I found for controlling was XBMC Symbian S60 Remote v2, which is indeed useful, but choosing what to play remotely is quite limited. Luckily yesterday I've discovered world of DLNA aka uPNP and was surprised that this works pretty well. I've configured diskstation to behave as a uPHP media server, XBMC is able to act as media renderer and my Nokia E52 has ability to act as a controller. If you are lost in these terms, good overview is available here.

Well the control interface of Nokia E52 is far from perfect, but still provides good way to control all the stuff. Maybe I will look for some other solution in future, I'm sure it will exist as well.

CTest not submitting to IPv6 dashboard

For some time, I observed that Gammu test dashboard does not get updates from my Debian box. Looking the CTest logs, the problem was in using IPv6 even when the box does not have it enabled:

Failed to connect to 2001:1528:136:dead:beef::1003: Network is unreachable

Due to lack of time I ignored it, but it looks all what was needed is to update curl. The bug was caused by using c-ares resolver, which for some reason favors AAAA records even when the system has no IPv6.

Upgrading OpenWrt

While doing some bigger downloads, my wifi network used to have big problems, seeing tx errors, frame errors on the router. The router is old ASUS WL-500g Deluxe which was running OpenWrt Kamikaze up to now. I was anyway thinking going for something with 802.11a or 802.11n support, so I started to look for replacement. While looking for it and checking what newer boxes are supported by OpenWrt, I noticed, that I can finally try using 2.6 kernel and I should get working wireless as well with free (what was not possible for very long time).

I gave it a try and upgraded to Backfire 10.03.1-rc4. And looks there is no need to upgrade hardware right now. No more tx errors, the wireless is much more stable and faster.

Thanks to anybody who helped to create free drivers for Broadcom 4306 wireless chip.

PS: Upgrading OpenWrt while keeping configuration lead to horrible mess in my case, so I rather did clean install reconfiguring everything and rediscovering all errors I've made in the past.

Looking for VServer alternative

It seems like VServer is not something for long run because it does not seem to want to be upstream and there is also no good future for having it as patch in Debian for long run. So I should look for alternatives and probably migrate to some other solution while upgrading my server to Squeeze (once it is released or really close to the release).

There are various options, starting with OpenVZ, through Linux Containers (LXC) up to full virtualization (probably KVM based). With OpenVZ the situation won't be much better, so it is not a real option. For various reasons I don't want to go to full virtualization, I simply thing containers are good enough and avoid too much overhead in some situations.

So the only remaining solution seems to be LXC. There even seem to be some people who managed to migrate from VServer, which is good and will be definitely helpful. Now it's time to play with lxc a bit before I will try to implement it for real.

Configuring system for SSD

I decided to upgrade my notebook to SSD disk. The disk replacement went easy, installed fresh Debian on it and now comes the tricky part how to properly tune system to use as much as SSD can provide.

The first obvious thing for me is changing IO scheduler. But which one to choose? Most of howtos seem to suggest noop or deadline, without stating benefits of each. For now I've chosen deadline, without string coninfidence, that I'm doing the right thing.

The next major part of tips includes removing filesystem journalling. Well I think journalling exists for good reason and disabling it won't help me much (no, I really don't want to wait for fsck after each crash).

The last tweak seems to be using tmpfs for any temporary data (/tmp) or even for logs. For /tmp it might make sense, on cost of loosing available memory (or swapping it out, what really does not help the SSD anyway). However I definitely don't want to loose my logs on every reboot.

Maybe I'm missing some bit, but the only important thing seems to be the IO scheduler.