Michal Čihař - Blog Archives for Linux

Bugged by duplicity file matching

I always wondered why backups of my sever using duplicity are so huge, but simply looking at list of files to include seemed to be correct. However I should really spend more time by reading documentation, because now it was obvious to me that the file list is simply wrong.

What a small difference in file list:

- /var/lib/vservers/
+ /var/lib

Versus the old one:

+ /var/lib
- /var/lib/vservers/

Changing network at home

Spending almost whole day on network infrastructure at home. I decided to say good bye to commercial provider and move to JM-Net, which is local community network. I bought EapStation earlier this week and tested the setup, but what was left was to install the device permanently and connect it to my home (OpenWRT based) router.

Everything went quite smoothly and I now use new connection. It's faster, lower latencies and cheaper than what I used to have. Plus as a bonus it should have soon native IPv6.

The only little issue I've faced is how to add additional IP address to otherwise DHCP interface in OpenWRT. Googling did not reveal much, however this seem to do the trick:

cat > /etc/hotplug.d/iface/40-second-ip << EOT
#!/bin/sh
[ "$ACTION" = "ifup" -a "$INTERFACE" = "eth0.1" ] && ip a add 192.168.1.100/24 dev eth0.1
EOT

Cygwin in Wine?

As some people complained that Gammu does not build under Cygwin, I decided to setup a test environment. And of course I'm not going to use real Windows, that would not allow me to use it effectively, so let's do it in Wine. I currently have 1.1.12, which is in Debian packages (in experimental), so I blindly downloaded Cygwins installer, started it and (even if Wine complained quite loudly about not supported things) it installed without a single problem!

So let's try to compile Gammu in it. First attempt fails, because Cygwin symlinks do not work in Wine. But there is an easy workaround - just copy as.exe and ld.exe instead of symlinks and now even the compiler works. Rest is surprisingly without any problems, so I can nicely get test results to Gammu dashboard.

Kudos to all people who make this work.

Icecream weirdness

Can somebody tell me, why ICECC_VERSION variable is used as path to file with used toolchain? Why does help say "see create-env" when there is no such thing I could see? Why does not it properly tell, that I have to use icecc --build-native and then use absolute path to resulting tarball as ICECC_VERSION and then it will start to work?

Quick notes for future:

icecc --build-native
export ICECC_VERSION=`pwd`/b98eeead34edf15d2edf2383c2c4e317.tar.gz

Speed up SSH logins

I just discovered (not new) feature of OpenSSH, which allows to have several sessions over a single network connection. If you are once connected to the server, all other sessions can use existing connections and this makes much faster things like working with remote SVN or shell completion of remote filenames.

All you need in config file to make it work is something like this:

Host *
    ControlPath ~/.ssh/sock/%r@%h:%p
    ControlMaster auto

Firefox hidden config of the day

browser.tabs.loadDivertedInBackground = True and Firefox 3 no longer steals focus when I open link from external application.

PS: This seems to be most interesting post in my blog, at least when counting email feedback - looks like there was lot of people annoyed by this behaviour and too lazy to search for solution :-).

Why to make sensible error messages?

Yesterday I faced problem with VMware server that it can not run 64-bit guest system. I'm using 64-bit SUSE and 64-bit VMware, so it should work, right? I can select 64-bit system in VMware, but the guest is simply 32-bit without any error.

In documentation, man can find only "VMware Server supports 64-bit guest operating systems only on host machines with supported processors.". How helpful! After a bit of googling, it turns out that VT needs to be enabled and usually it is not enabled in BIOS (any reason for this?).

So let's reboot, go to BIOS, enable VT and it should work. Unfortunately not, after reboot, still same problem. I was almost given up at this point, but I decided to recheck BIOS, whether I really enabled the right thing. Yes I did, but I did not notice small note, that to apply this setting, I need to power off and on the computer. That was the trick! Now it finally works. I just wonder why it has to be so complicated...

Why gpg-agent does not work?

Summary: If programs would have useful man pages or error messages, man would not have to look into source code.

I just set up Debian sid chroot on my computer and have to sign something inside this chroot (dpgk-buildpackage). Okay, I want it to use gpg-agent in my host system, that should not be hard. Looking at gpg man page, GPG_AGENT_INFO variable is used to forward information about agent socket, PID and protocol version, so I set this variable according to host system, but it still does not work, giving nothing saying error that agent is not working.

So let's debug this beast - strace reveals, that communication with agent works, but it replies "113 Server Resource Problem". Hmm, still not much useful information, but let's google for this problem. Fortunately Google reveals related Seahorse code, where man can find, that not set DISPLAY variable is causing this issue. Could not the error be more friendly, so that it tells me directly what is wrong?

White Russian and Aiccu problems

Today, I wanted to finish something what looked like easy task from beginning. To bing IPv6 connectivity to my home using tunnel from Sixxs. As I have an OpenWRT, I expected it should not be harder than setting up same thing on my Debian notebook.

There exists several howtos on the net, we can take the one on Sixxs wiki as a good starting point. Just follow the instructions and you should get it working right? Unfortunately not. Aiccu connects, IPv6 addresses are assigned, subnet is correctly distributed over network using radvd, but IPv6 connectivity does not work.

Going deeper into this issue, I found out that some packets go out, but nothing comes back. When comparing results with Aiccu set up on my Debian notebook, I noticed that packets from OpenWRT router are few bytes larger, but I didn't though it could be a reason. Unfortunately it was -- OpenWRT contains wrongly compiled Aiccu, which does not strip ethernet headers from outgoing packets and gateway then throws them out.

This is a well known bug, but unfortunately nobody fixed it for White Russian. Anyway I'm not going to reinstall whole system to Kamikaze just to make the thing work, so I compiled the Aiccu package on my own and now the tunnel works fine. If you are interested, you can get the package here.

Synchronizace s mobilem - konečně

Už dlouho na mém seznamu úkolů hnije synchronizace mezi telefonem (Sony-Ericsson K750i) a nějakou rozumnou PIM aplikací v Linuxu (protože používám GNOME, tak jako cesta nejmenšího odporu se jeví Evolution). Už jsem se o to pokoušel několikrát, ale zatím to nikdy nefungovalo. Dneska (když už bylo venku tak jak bylo) jsem tomu věnoval opět nějaký čas a tentokrát jsem uspěl na první pokus :-).

Než jsem s čímkoliv začal, zazálohoval jsem si všechno z telefonu. Gammu to zvládne v pohodě a čemu jinému bych měl věřit než nástroji, který jsem si sám napsal?

 gammu backup /tmp/phonebook.vcf
gammu backup /tmp/calendar.vcs

A teď už je na čase si hrát s OpenSyncem . Pro tyto účely se může hodit setup guide a SyncML guide . Protože jsem dřív míval problémy s oběmi konci synchronizace - jak telefon tak Evolution končily s nějakou chybou, rozhodl jsem se na to jít tentokrát pomalu a začít se synchronizací z telefonu do souborů:

 msynctool --addgroup file2phone
msynctool --addmember file2phone file-sync
msynctool --addmember file2phone syncml-obex-client

Teď už jenom nastavit ukládání souborů:

 msynctool --configure file2phone 1

A nastavit cestu, kam se mají data ukládat:

 <?xml version="1.0"?>
<config>
  <!-- directory path for file-sync -->
  <path>/home/foo/phone-backup/</path>

  <!-- should care of subdirectories (TRUE or FALSE) -->
  <recursive>FALSE</recursive>
</config>

Tím máme jednoduchou část za sebou a potřebujeme nastavit připojení k telefonu:

 msynctool --configure file2phone 2

Naštěstí můžeme použít příklad z SyncML guide , jen stačí přidat Bluetooth adresu (dá se zjistit pomocí hcitool scan ) a kanál ( sdptool browse 00:b0:0b:fa:ce:00 ):

 <?xml version="1.0"?>
<config>
  <bluetooth_address>00:b0:0b:fa:ce:00</bluetooth_address>
  <bluetooth_channel>7</bluetooth_channel>
  <identifier>Sony Ericss</identifier>
  <version>1</version>
  <wbxml>1</wbxml>
  <username></username>
  <password></password>
  <type>2</type>
  <usestringtable>0</usestringtable>
  <onlyreplace>0</onlyreplace>
  <onlyLocaltime>0</onlyLocaltime>
  <recvLimit>0</recvLimit>
  <maxObjSize>0</maxObjSize>
  <contact_db>Contacts</contact_db>
  <calendar_db>Agenda</calendar_db>
  <note_db>Notes</note_db>
</config>

A teď už by měla fungovat synchronizace kontaktů z telefonu do vybraného adresáře:

 msynctool --sync file2phone

Když už toto funguje, stačí přidat Evolution a mělo by být hotovo. Vytváření synchronizační skupiny je stejné, jen se použije jiný plugin. Synchronizaci s Evolution většinou není potřeba nijak nastavovat, výchozí hodnoty jsou rozumné (použije se jediná databáze, kterou Evolution automaticky vytvořila):

 msynctool --addgroup phone2evo
msynctool --addmember phone2evo evo2-sync
msynctool --addmember phone2evo syncml-obex-client
msynctool --configure phone2evo 1
msynctool --configure phone2evo 2

Ale ještě pořád není vyhráno - telefony Sony-Ericsson phones většinou mají rozbité cosi v synchronizaci poznámek (nebo to je možná rozbité v OpenSync, ale vyjde to nastejno, prostě bez tohoto kroku synchronizace neprojde) a je potřeba vypnout jejich synchronizaci. To můžeme udělat změněním filtrů ve vytvořené synchronizační skupině (filtr je v souboru ~/.opensync-0.22/group2/filter.conf ):

 <?xml version="1.0"?>
<filter>
  <note/>
</filter>

A teď už konečně můžeme zkusit synchronizaci a mělo by to fungovat:

 msynctool --sync phone2evo

Pokud chcete o trochu víc klikat, dá se to samé udělat pomocí GUI multisync0.90 , ale stejně nakonec skončíte u editování XML souborů :-).