Archive for the ‘English’ Category

Capture input/output of a process with gdb

Tuesday, September 14th, 2010

My tip of day. When you lose control of a process (for example with a process launched with disown or, another example, when you close your SSH terminal with “unsynced” mutt), thanks gdb.

$ tty
$ gdb --pid=`pidof mutt`
(gdb) call close(0)
(gdb) call close(1)
(gdb) call close(2)
(gdb) call open("/dev/pts/13", 2, 0)
(gdb) call dup(0)
(gdb) call dup(0)
(gdb) detach
Detaching from program: /usr/bin/mutt-org, process 2932

Thanks to this comment on for the original idea.

Edit: correction on dup() calls. Thanks to Peter Pentchev for his explanation in comments.

Network connection with HTC Hero and Debian

Saturday, July 17th, 2010

I have an HTC Hero, an Android phone, for one year. But I never tried to share his network connection with my Debian laptop. To prepare my trip to Debconf10, I try it today and… I’m surprised because it’s so easy!

1. Plug your phone on USB
2. Active “Share your phone network” on phone (in french: “Partage du réseau mobile”)
3. You see now an usb0 ethernet device:

usb0      Link encap:Ethernet  HWaddr a2:17:af:4f:fa:da
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

4. Configure usb0 to have the network configuration with your favorite tool (ifconfig for example).
5. Now you can ping your phone with Use it as gateway and enjoy: your laptop is now connected with Wi-Fi, GPRS or 3G+!

Note: I use HTC Hero with Android 1.5 (build number: and the french mobile phone provider Orange.

SFR Huawei 3G+ USB key with Debian

Wednesday, July 29th, 2009

After Orange GPRS with Nokia 6630 and SFR GPRS with Nokia E65, I use now mainly Huawei 3G+ USB key with SFR (french mobile phone provider).

lsusb info about this Huawei 3G+ USB key:

Bus 003 Device 003: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E270 HSDPA/HSUPA Modem

And dmesg info:

[208765.818448] option 3-1:1.0: GSM modem (1-port) converter detected
[208765.818448] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB3
[208765.830451] usb-storage: probe of 3-1:1.1 failed with error -5
[208765.830451] option 3-1:1.1: GSM modem (1-port) converter detected
[208765.830451] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB4
[208765.830502] scsi12 : SCSI emulation for USB Mass Storage devices
[208765.834458] usb 3-1: New USB device found, idVendor=12d1, idProduct=1003
[208765.834458] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[208765.834458] usb 3-1: Product: HUAWEI Mobile
[208765.834458] usb 3-1: Manufacturer: HUAWEI Technologies
[208765.834458] usb-storage: device found at 3
[208765.834458] usb-storage: waiting for device to settle before scanning
[208770.863868] usb-storage: device scan complete
[208770.866850] scsi 12:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[208770.887881] sr0: scsi-1 drive
[208770.887881] sr 12:0:0:0: Attached scsi CD-ROM sr0
[208770.887881] sr 12:0:0:0: Attached scsi generic sg1 type 5

For connecting, I tried an infamous GUI distributed by Vodafone in Debian package. Too buggy, too complex. The best solution is using a PPP chatscript.

Then, plug USB key, sleep 20 and unlock it:

echo 'at+cpin="1234"' > /dev/ttyUSB3

Note: 1234 is PIN code (or not) and /dev/ttyUSB3 is modem device.

Create these 2 files:


connect "/usr/sbin/chat -v -f /etc/ppp/peers/"
user ignored
remotename whatever
ipparam whatever


# Chat file for Huawei E220 HSDPA USB modem
'' AT
OK 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
OK 'AT+CGDCONT=1,"IP","websfr"'
OK ATDT*99***1#

Finally you can:

pppd call gprs

New GPG key

Monday, May 11th, 2009

With last attacks against SHA-1 digest algo, I create a new GPG key (following instructions from Daniel Kahn Gillmor):

pub   4096R/B8612B5D 2009-05-10
uid                  Gregory Colpart <>
uid                  Gregory Colpart (Evolix) <>
uid                  Gregory Colpart <>
sub   4096R/7D40310B 2009-05-11

A good excuse for beer^Wkey exchange next weeks :-)

Migration from GNU Arch to Git for Horde packages

Sunday, May 3rd, 2009

All Horde packages (horde3, imp4, kronolith2…) were in GNU Arch repository. After Lenny release, we decided to migrate to Git. Git has a lot cool features, and I was convinced by Pierre Habouzit talk about Packaging with Git. Technically, I used git-archimport to keep all history of packaging. Each package has a Git repository with some branches: upstream, upstream+patches, upstream+repack (if needed), pristine-tar, debian-sid (imported from GNU Arch) and debian-<release>. The hardest step was to set up a common ancestor for debian-sid and upstream branches: I found git-merge-unrelated-branch script to do it automagically. I write guidelines for packaging Horde with Git on Debian Wiki with some notes about migration from GNU Arch to Git. Comments welcome!

Delete facsimileTelephoneNumber attribute

Wednesday, February 4th, 2009

ldapvi is so wonderful. No Java/Python/PHP for “browsing” LDAP trees and the power of vi for LDAP administration. Nevertheless, today I had difficulty for deleting a facsimileTelephoneNumber attribute:

$ ldapvi
Action? [yYqQvVebB*rsf+?] y
ldap_modify: Inappropriate matching (18)
additional info: modify/delete: facsimileTelephoneNumber: no equality matching rule

Here is the LDIF change tried by ldapvi:

dn: uid=foo,ou=people,dc=evolix,dc=net
changetype: modify
delete: facsimileTelephoneNumber
facsimileTelephoneNumber: 0000

After a little search on the web, I find the reason on openldap-bugs list archives:

Since the schema definition of facsimileTelephoneNumber has no matching rule
defined, the only modifications you can make are Replace or Delete w/ no

facsimileTelephone attribute actually doesn’t have SYNTAX definition. See in core.ldif file:

Number olcAttributeTypes: ( NAME ( 'facsimileTelephoneNumber' 'fax' )
  DESC 'RFC2256: Facsimile (Fax) Telephone Number'

By default, ldapvi tries to delete a specific value (even if there is only one value) for an attribute. But according documentation, it’s impossible to delete only one of values for facsimileTelephoneNumber attribute!

Note: for deleting all values of facsimileTelephoneNumber attribute, the LDIF change must be:

dn: uid=foo,ou=people,dc=evolix,dc=net
changetype: modify
delete: facsimileTelephoneNumber

Set up IPv6 in Xen domU with nat-mode

Sunday, January 11th, 2009

I have a Xen dom0 with nat-mode and IPv6 enabled. Set up IPv6 in Xen domU is like a classical IPv6 network: add IPv6 addresses on vif interfaces on dom0 and IPv6 addresses on domU (manually or with radvd on dom0). The only tip is how adding IPv6 addresses on vif interfaces which are dynamically created by Xen. Here is my dirty hack to do it on /etc/xen/scripts/vif-nat file:

        [ "$dhcp" != 'no' ] && dhcp_up
        +# Add IPv6 addresses
        +[ "$vif_ip" = '' ] && ifconfig "$vif" add 2001:6f8:143d:1::101:1234/64
        +[ "$vif_ip" = '' ] && ifconfig "$vif" add 2001:6f8:143d:2::101:1234/64

Where $vif_ip is the IP address from domU configuration : vif=[‘ip=].

I think the best solution is adding ipv6 option to domU configuration. I will consider to open a wishlist bug for that.

History of my NM application

Wednesday, September 10th, 2008

I apply (2007-07-26)
I am advocated (2007-07-26)
Mail from FD(myon) (2007-08-12)
I reply (2007-08-15)
FD(myon) says OK (2007-08-17)
AM assigned (2007-12-05)
First mails from my AM(white) (2007-12-06)
ID check done (2007-12-07)
P&P1 check done (2007-12-21)
P&P2 check done (2008-01-17)
T&S1 check done (2008-05-04)
T&S2 check done (2008-05-13)
AM report (2008-05-13)
FD(wouter) check done (2008-07-23)
DAM(myon) approval (2008-09-03)
Account created by DSA(weasel)  (2008-09-08)
Debian Beer/Pastis Party in Marseille (2008-09-15)

Thanks to all Debian people in particular opal, lmamane, white, madcoder, myon, wouter and weasel.

No /dev/net/tun in xen Linux domU

Wednesday, August 20th, 2008

No persistent /dev/net/tun in xen Linux domU… Hacky workaround is adding

mkdir /dev/net && mknod /dev/net/tun c 10 200

while booting (for example in rc.local or in your init.d script which need it).

For example tun device is useful for SSH VPN. Without it, you will have errors like:

channel 0: open failed: administratively prohibited: open failed

SFR GPRS with Debian

Wednesday, August 6th, 2008

I use Nokia E65 phone and SFR (french mobile phone provider). Note there is at least two possibilities for access: wapsfr (for WAP browsing and AFAIK illimited) and websfr (less restricted but with high-cost level). I will only speak about wapsfr here. For connecting, it’s the same method like Orange SFR with Debian excepted you set wapfr instead of in /etc/ppp/peers/gprs-wvdial.conf file. Then you are now connected but access seems restricted to 80 and 443 ports via proxy (NetApp/6.0.7 NetCache appliance announced by HTTP headers). For HTTP browsing, you must change your User-Agent to Vodafone/1.0/HTC_Mercury/ for HTTP browsing. Of course, no problem for HTTPS browsing. And for SSH (for example SSH tunnel to have a full Internet access), you can use corkscrew and a SSH server reachable on tcp/443 to bypass the proxy. Just “apt-get” it and launch:

ssh -o "ProxyCommand /usr/bin/corkscrew %h %p %h %p" -p 443 login@your_ssh_server