Sunday, June 22, 2008

Firefox 3 bug.


Just installed Firefox 3 on Mandriva.
Got a bug: incorrect rendering of cursor and stuff in text input boxes (sometimes on text boxes on the webpages too). I guess it works with some fonts, but not all.
What the f* . Looks like off-byone bugs - in programming, thats a mark of a "n00b".

Tuesday, June 17, 2008

More photos








Saturday, June 7, 2008

Biking: photos.

Some photos i took when biking to the park and around city:



(the halo is from prev. week)





(I'll add more photos to this post as i prepare them with gimp)

Tuesday, June 3, 2008

Installing Mandriva; adding new Western Digital HDD

I spent half weekend biking and other half installing Mandriva Linux (version 2008 "One" , spring) on my "server box", the one i replaced capacitors on. Also, on monday I got new SATA hard drive.

The biking deserves its own blog post with photos, though i didnt see or photo anything particularly interesting. Thats the thing with biking, you make bigger distance, but do much less photographing.

So i'll blog about Mandriva and new hard drive.

Installation was very smooth. However there is several nasty quirks in mandriva:
1: Mandatory reboot after fsck. Severety: VERY high. Fix: VERY trivial.
When i disconnected one of hard drives to troubleshoot some hardware issue, and tried to boot, it tried to fsck partitions on removed disk, fsck failed, and it asked for admin password or ctrl-d for continue. After ctrl-d it just reboots. After exiting admin mode, it reboots. Happens in failsafe startup as well. Very annoying.

Advantage of reboot after fsck, if any, seems very, very dubious. Linux only needs reboot when you modify the kernel. It is not windows which needs reboot after everything, and not OS X which needs reboots after many big installs.
Linux always did configure things the right way. So on Linux you normally have to reboot only when it is real, physical necessity, i.e. only after you change kernel.

Disadvantage is extremely massive for newbies: it makes system impossible to boot after one drive has been removed or failed. If course there is workaround - when it asks to repair manually, enter root password, then edit /etc/fstab . Or try init 3 .
Editing is very tricky when you do not have any normal console editor (i made a copy of fstab then used grep to filter out lines that i didnt want) and thats far beyond newbie. Especially when [s]he has 1 pc or no internet, and cannot get online to ask.
Negates the "linux is more reliable than windoze" entirely.
Solution is trivial: locating the idiotic commit that added this reboot behavior, and removing it.

2: It didn't detect my ram size properly, not even with explicit kernel option. I have 1280MB on this machine, thats 1024+256 MB. Mandriva's kernel detected 884mb = 1024-128-12 . I have AGP aperture size set to 128mb, so that might be it. Definately a bug, old ubuntu detected size correctly regardless of AGP aperture size.
Thats no big issue for me, I will rebuild kernel anyway, or install vanilla kernel. But would be bad for newbie.

Some linux tips, while i remember:
Mount drives with noatime,nodiratime option. That disables updating of access times on files (the time when file was last read). It gives much faster, less energy consumption system. In some cases, it gives >2x speedup.
Without this option, when you read file, the access time has to be written to disk. And it has to be written even if file is in buffer. That can more than double overhead for reading lot of tiny files.
I never need access times, and do not have any applications that uses them. Maybe back in seventies and eighties, access times did correspond to user accessing the file and were useful for cleanup and pinpointing unused files, but today, having all sorts of applications that read lot of files automatically and dont disable access time update, and having really cheap hard drives (i got 500gb for 75 Euro), access times are entirely meaningless.
More on access times: http://kerneltrap.org/node/14148

Now about the hard drive. I got western digital wd5000aaks drive (internal), 500GB , SATA2 capable, 3 years warranty.
Minor quirks>:
To connect it to old SATA (also known as SATA 1500 or SATA 150) controller, i had to add jumper (a tiny connector thingy) between jumper pins 5 and 6 . OEM package does not include jumper. You can ask for jumper (and bolts to install drive, too) at shop, any self respecting shop has surplus of those and will provide for free.
For pin numbering, consult label on hard drive. Its second column from the left when label is up and connectors are to the left of jumper slot. (the pin numbering starts from the right, dunno why) . BTW, my label didnt have print about the sata1.
NOTE: if you have different hard drive, do NOT connect jumper based on this blog post. Google for your specific hard drive!

By funny coincidence, some girl i know got same hard drive on same day. Besides jumper, she had to enable SATA in BIOS (some BIOSes have it disabled by default). Search for it in BIOS, check "integrated peripherals" section first.

Thursday, May 29, 2008

SolderNPlay technology...

My PC was becoming more and more crashy lately (I use Linux, normally once its up and running, it never crashes by itself), and was getting progressively worse, to the point that i had to disable all power saving features (apm, acpi, and hlt) as temporary remedy. When it crashed today, it was one crash too many, so i took pc apart and inspected motherboard more closely...
Not surprisingly, I found 5 suspicious-looking electrolytic capacitors near CPU.

3300uF 6.3v , 10mm diameter, slightly swelled tops (only visible when you take motherboard out from case, and look from side), manufactured by "OST ".
Same crapacitors removed from board:
(timeline: i bought replacement first, then removed bad caps)

Thats a common problem. Good article on the issue. With little googling i found OST="Taiwan Ostor Corporation", known crapacitor manufacturer.
Rule of thumb: if you have a chance to look at motherboard before buying, don't buy one with capacitors manufactured by unknown brands. Big Japanese-brand capacitors are good.

With more googling, i found this immensely useful page with list of suppliers:
http://www.badcaps.net/forum/showthread.php?t=613
, found closest shop (I am in Lithuania by the way, and that was http://www.lemona.lt/ . Very nice shop in Vilnius, with nice people). Bought replacement capacitors (with big manufacturer, Matsushita), unsoldered old ones, and soldered in replacements. Solder-n-play technology.

Took about two and half hours from crash to end of repair, including finding local shop and walking there. Sorry, no photos of finished board yet. My camera ran out of charge and I simply couldn't wait to check my fix :-). I can photo it later.

BTW. Interestingly, bad caps also feel very lightweight for their size. I think all the electrolyte have evaporated. I shall do autopsy...

Some guidelines on repair, for those who came here from google search:

Before you start:
Check your skills. I used to build various nice devices back in school days, and repaired relatively low tech things like radio and tv.
I wouldn't recommend capacitor repair to someone holding soldering iron for first time, unless its "repair or toss away" situation... Also, if you have some hi-tech device that you don't mind breaking irreparably, you can practice soldering and unsoldering capacitors on it.

Finding what to replace: Look for any capacitors whose tops look even a tiniest big swollen or a tiniest bit leaky. If one capacitor is bad, its good idea to replace all capacitors with same specs. Those are very likely to be bad too but not visibly so.
The problem with testing electronics by looks is that, often, failed capacitors look same as good ones.

Buying replacement: Replacement must have same or higher max voltage, same or higher capacitance (if higher, by reasonable amount of course, say, 2x should be allright. Higher values will increase charging time on startup), same or lower ESR (effective serial resistance), must fit in available space. At least 105 degrees Celsius max temperature (you will overheat leads while soldering; also higher max temperature translates into longer lifetime at your pc's temperature).
Choose big, known Japanese brand manufacturer. Even though they too make it in China, they usually use proper chemistry, unlike small companies.

What you need:
Steady hand.
Replacement capacitors. (get them before unsoldering anything)
Small wire cutter.
Soldering wire, alloy (the one i used is 70% tin 30% lead , if i recall correctly).
Soldering resin (or use soldering wire with resin core).
Soldering iron, any reasonable sized one will do. Something to keep iron on.
Optionally, solder sucker aka desoldering pump.
When you remove bad capacitor, the hole fills with soldering alloy, and you cant insert new one. You have to heat up the hole while trying to push through capacitor from other side. Which is difficult with thick multi-layer boards. I did that without soldering pump, but it was pain in the ass. I did heat up the hole from one side with tip of soldering iron, while pushing capacitor leads into hole from other side.

Grounding:
It really doesn't matter if you use properly grounded equipment or not, all that matters is that everything is at same potential (otherwise motherboard may be ruined).
Connect the soldering iron to common "ground" on the motherboard, using wire. You can unscrew a little screws on any port (parallel port, or serial, for instance) and use it to attach wire. Actually you can see that on photo above. After you connect, check with multimeter that tip of soldering iron got small or zero resistance to "ground" pins in power connector on motherboard, and that resistance between soldering iron tip and soldering iron mains is infinite.
This will save motherboard from being ruined by things like tiny leakage current from mains to the soldering iron. Connect yourself to that common ground. Ideally through resistor (in case your soldering iron begins to leak mains onto tip as you work).

Soldering:
If you are not familiar with basics of soldering, read tutorials and practice first, dont try to replace capacitors as your first soldering experience. Its not easy.
Don't forget about polarity(!). It is very important. If you wire polarized capacitor backwards, it will blow very soon. Theoretical physics types forget it all the time.
Avoid pushing soldering iron hard and at all cost avoid slipping soldering iron over board. Computer boards typically have hundreds of hair-thin tracks everywhere, and if you accidentally cut one, it'll be very difficult to fix.

Tuesday, May 27, 2008

A comment on so called "quantum cryptography"

I've been reading a lot about cryptography lately, and naturally, came across many "quantum cryptography" related discussions. Both proponents and opponents miss something really obvious. "Quantum cryptography" is a kind of *physical security*, not really a kind of cryptography.
Lets simply compare quantum cryptography(QC) hardware & maintenance of said hardware with one time pads (OTP) that you buy from someone. You can see that all the risks of one time pads apply to quantum cryptography. Attacker can copy pads, you say?* Attacker can modify quantum hardware on the way to you just as well, with modifications ranging from smart changes like removal of filters and other protection so that attacker could send pulses along the cable and deduce state from reflection, to trivial replacement of firmware with one that doesn't care about quantum stuff and just uses some stream cipher with key that attacker knows. Bad crypto looks exactly like good crypto.
(*which requires opening hard drive in the cleanroom if its single-read hard drive.)

In both cases security boils down to physical security and trust in potentially malicious third party. Physical objects have to be physically produced and delivered (QC hardware or those hard disks with one time pads) which you need to physically protect from attacker (there's really a lot of ways how QC hardware could be modified to make it insecure). In both cases you need to trust manufacturer that it isn't complete snake oil. In both cases you rely on armored truck delivery. 
With quantum cryptography theres far more extra risks though. Man in the middle for instance. Or flawed implementations. Working with single photons is hard, naturally you can expect that almost all working solutions use many-photon pulses that can be trivially eavesdropped on. Keep in mind that the crypto hardware manufacturer is not just some neutral third party. Its a company which would any time choose to use cheap fake stuff over real if they can get away with it. So far, crypto hardware manufacturers can get away with anything.

The crucial difference: quantum crypto is thousands times more expensive to deploy and maintain than one time pads. 

Quantum cryptography is indeed just fiction now. It does not solve any existing real problems, and it could not improve security comparing to normal one time pads. It is really interesting academic thing, but not a solution to any existing problems.

Standard, mathematical cryptography, with (for example) Diffie-Hellman key exchange, public/private keys,  and things like that is far more secure than either QC or OTP. Source code is not a black box with high precision optics (or snake oil) inside, it can be reviewed. You can even do key exchange entirely "by hand" using email and Mathematica or similar package, if you don't trust cryptographic libraries. You can use really bigass exponent sizes if you worry about new methods. 
(And if one is worried that general math functions in Mathematica have backdoors, well, better to put on tinfoil hat, disconnect from internet, and make computer starting from sand, with own software).

Snail photos





Not really technology related in any way... photos of a tiny snail i found on groceries. Its sitting on glass. To get the exposure right i had to put several layers of paper over camera's flash, and take a lot of photos to get few good ones. After photographing i released snail in park. No gastropoda has been harmed during production of this blog post :-)