Catalyst 2960 with speed/duplex issues (100BaseLX-FE SFP)

I just got fucking tired of having a list of alleged experts on Cisco IOS not being able to solve what seemed to be a simple problem: I have a Catalyst 2960 with an SFP (100BaseLX-FE) on Gi0/1; although the link is up and operational it’s only working at half-duplex (100mbps). The crazy thing is that we are unable to force speed or duplex because none of those commands is available.

Now, I know next to nothing of IOS. But starring at the fucking thing and saying “that’s weird” doesn’t really fix it, does it? And, at least to me, upgrading/downgrading the IOS version doesn’t sound like a reasonable first approach to the solution.

After politely telling two “experts” to piss off, I decided to read some fucking manuals. Here’s what I got with 30 seconds of google (straight ou of
The SFP port is supported for the GE port 0 only. GE port 1 supports only RJ-45 (or copper mode) operation.
To select SFP type for GE port 0, use the following commands from the command-line interface (CLI):

router(config)# int gigabitEthernet 0/0
router(config-if)# media-type sfp
GigabitEthernet0/0: Changing media to SFP.

And here’s what I did next:
Fibra#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Fibra(config)#interface gigabitEthernet 0/1
Fibra(config-if)#media-type spf

Lo and behold, Cisco folks were actually right:
Fibra#show interfaces gigabitEthernet 0/1
GigabitEthernet0/1 is up, line protocol is up (connected)
Hardware is Gigabit Ethernet, address is 081f.f3f9.a189 (bia 081f.f3f9.a189)
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive not set
Full-duplex, 100Mb/s, link type is auto, media type is 100BaseLX-FE SFP
input flow-control is on, output flow-control is unsupported

Fucking morons are charging 740€ for wasting my time.

OpenBSD 4.6 -> 4.7 upgrade

I’ve had plenty of horror stories upgrading Debian. Many more upgrading Fedora and CentOS. I lost count to the number of times I have helped friends that had a broken system when upgrading Ubuntu.
That said, here is how my private server OpenBSD upgrade from 4.6 to 4.7 went. Let me say that it is a firewall, router, mail server and http server (Yes, I’m cheap. You can send your money my way though, if you so desire, and I’ll spend it buying another machine for failover).

Without further delays, here is a high level description of how it went:

$ cd / && wget
$ reboot

(boot loader prompt)
> boot bsd.rd

(select upgrade)
(follow instructions on screen)

$ reboot

Follow the “final steps” instructions as devised here:
These final steps basically involve copying of files, making sure your local modifications are included in the newer versions.
They also include issuing the following right in the end:
$ pkg_add -ui -D update -D updatedepends && pkg_delete p5-parent p5-Parse-CPAN-Meta

NOTE: Don’t forget to set your PKG_PATH to the new version before the last commands above. I set up mine like this: $ export PKG_PATH=

How easier could an upgrade to a server get?

TeX, Latin, and spacing

TeX usually assumes that a period (“.”) ends a sentence if it is followed by a space. By default, it puts extra whitespace after each such period than it does between any two words of the next.

While at a first glance this looks pretty nice, a not-so-nice consequence is that if you type something like “i.e. ice-cream”, TeX will assume that the period after the “e” ends a sentence, and will put too much space after it. The same principle applies to constructions such as “et al.” and “e.g.”.

You can contradict this behavior by typing “i.e.\ “. The backslash followed by the space tells TeX that you want a normal inter-word space, not a sentence-separating space, after the “i.e.”.

Being lazy is one of my best qualities, so I always have these macros around:
\newcommand{\ie}{i.e.\ }
\newcommand{\eg}{e.g.\ }
\newcommand{\etal}{et al.\ }
\newcommand{\cf}{cf.\ }

Then I can just focus on writing things like “\eg chocolate and strawberry” without having to worry about spacing issues.

Professional tables with LaTeX

I used to think that my LaTeX tables were quite nice.
I learned how to do it with the second edition of ‘The LaTeX Companion’ and, after getting used to the shitty syntax, just kept on drawing them in the same way.

Yesterday I found the booktabs package and it completely changed the way I feel on presenting tabular data.

The documentation alone raises a lot of questions and is enough to make you ask yourself weather you should be using a different approach.

I just changed more than 20 pages worth of typical-but-fucking-ugly-and-difficult-to-read-tables.

Give it a try. It may look awkward at first, but you won’t be disappointed with the end result.

OpenSolaris, iSCSI, and NTFS extend

Say you want to make a ZFS volume (on a box running OpenSolaris) available to some Windows machine thru iSCSI.
You can use either the nice new tools and interface from the COMSTAR project, or the “old” iSCSI Target Daemon. The zfs ‘shareiscsi’ property uses the iSCSI Target Daemon, so if you want/need some feature available only on COMSTAR, life just got complicated…

Now suppose you want to take advantage of ZFS’s volume resizing features. You’re expecting to be able to resize the formatted NTFS partition on the initiator side without to much of a fuss. This is true if and only if you decided not to use COMSTAR:
zfs create -V 2T pool/volume
zfs set shareiscsi=on pool/volume

Log in to the initiator, add the target, mount the volume, format the thing, and you’re set.

To resize it:
zfs set volsize=4T pool/volume
Then, if you’re using Windows 2008, Vista, or 7, just go to the storage manager, right click on the volume and choose ‘Expand’/’Shrink’. On previous versions of Windows you’ll need some third party software (Partition Magic, or something like that).

As an alternative, if you decide to be a smart ass (kind of like I did) and use COMSTAR anyway prepare yourself for a couple of hours of pain before returning to the iSCSI Target Daemon.
Now, the bad news is that the iSCSI Target is deprecated and planned to be removed from future releases. When COMSTAR is installed, the ‘shareiscsi’ property is not available. Without this property, volume resizing does not seem to work. When will Sun/Oracle put it back together?…

OpenBSD mpstat / pmap

Unfortunately, OpenBSD does not have mpstat. mpstat is pretty useful for me in linux. For those who do not know what mpstat does, mpstat provides data for various statistics on your available processor(s). You can look at data for every processor using mpstat -P ALL or individually issuing a mpstat -P #cpu (e.g. mpstat -P 1)

If you’re wondering which package to install, normally your distribution should have a package called sysstat that has it.

Anyway, I tried to look for it for OpenBSD, or something like it, but couldn’t find one so simple/nice. Hope you have better luck.

Another tool I really enjoy is pmap in linux, which, good news!!!, has a brother in OpenBSD called procmap. Almost the same thing and in all honesty, way better than pmap. You can guess what it does, just by reading the name: displays a process memory map.

procmap -p PID and you’re all set for a good trip into your process memory. Below is an example of a procmap to my sendmail server:

-bash-4.0# procmap -a -d -v -p 6847 | less
MAP 0xd72c5a48: [0x1000->0xcfbfe000]
        #ent=81, sz=36978688, ref=1, version=5605, flags=0x1
Start    End         Size  Offset   rwxpc  RWX  I/W/A Dev     Inode - File
 - 0xd723bd14: 0x3d4e000->0x3d54000: obj=0xd716f974/0x0, amap=0x0/0
        submap=F, cow=T, nc=T, prot(max)=5/7, inh=1, wc=0, adv=0
        (dev=0,0 ino=2416545 [/usr/lib/] [0xd716f974])
03d4e000-03d53fff      24k 00000000 r-xp+ (rwx) 1/0/0 00:00 2416545 - /usr/lib/ [0xd716f974]
 - 0xd723b9a4: 0x550e000->0x5599000: obj=0xd7284798/0x0, amap=0x0/0
        submap=F, cow=T, nc=T, prot(max)=5/7, inh=1, wc=0, adv=0
        (dev=0,0 ino=2417436 [/usr/lib/] [0xd7284798])
0550e000-05598fff     556k 00000000 r-xp+ (rwx) 1/0/0 00:00 2417436 - /usr/lib/ [0xd7284798]
 - 0xd723bc64: 0x75ad000->0x75b5000: obj=0xd7284548/0x0, amap=0x0/0
        submap=F, cow=T, nc=T, prot(max)=5/7, inh=1, wc=0, adv=0
        (dev=0,0 ino=2445976 [/usr/libexec/] [0xd7284548])
075ad000-075b4fff      32k 00000000 r-xp+ (rwx) 1/0/0 00:00 2445976 - /usr/libexec/ [0xd7284548]
 - 0xd723becc: 0x8ea6000->0x8f8f000: obj=0xd716f8e0/0x0, amap=0x0/0
        submap=F, cow=T, nc=T, prot(max)=5/7, inh=1, wc=0, adv=0
        (dev=0,0 ino=2417437 [/usr/lib/] [0xd716f8e0])
08ea6000-08f8efff     932k 00000000 r-xp+ (rwx) 1/0/0 00:00 2417437 - /usr/lib/ [0xd716f8e0]
 - 0xd717ed68: 0xd72b000->0xd760000: obj=0xd716f7b8/0x0, amap=0x0/0
        submap=F, cow=T, nc=T, prot(max)=5/7, inh=1, wc=0, adv=0
        (dev=0,0 ino=2416541 [/usr/lib/] [0xd716f7b8])
0d72b000-0d75ffff     212k 00000000 r-xp+ (rwx) 1/0/0 00:00 2416541 - /usr/lib/ [0xd716f7b8]
 - 0xd717e8f0: 0xecca000->0xeccb000: obj=0xd72b6000/0x0, amap=0x0/0
        submap=F, cow=F, nc=F, prot(max)=5/5, inh=0, wc=0, adv=1
        ([ uvm_aobj ])
0ecca000-0eccafff       4k 00000000 r-xs- (r-x) 0/0/1 00:00       0 -   [ uvm_aobj ]
 - 0xd717e948: 0x1c000000->0x1c078000: obj=0xd716f690/0x0, amap=0x0/0
        submap=F, cow=T, nc=T, prot(max)=5/7, inh=1, wc=0, adv=0
        (dev=0,0 ino=2445996 [/usr/libexec/sendmail/sendmail] [0xd716f690])
1c000000-1c077fff     480k 00000000 r-xp+ (rwx) 1/0/0 00:00 2445996 - /usr/libexec/sendmail/sendmail [0xd716f690]
 - 0xd717edc0: 0x23d4e000->0x23d4f000: obj=0xd716f974/0x6000, amap=0x0/0
        submap=F, cow=T, nc=T, prot(max)=1/7, inh=1, wc=0, adv=0
        (dev=0,0 ino=2416545 [/usr/lib/] [0xd716f974])

I didn’t include a lot of detail in here for one simple reason… open your shell and start reading and experimenting!
man procmap/pmap and man mpstat are your friends ;)

Drobo – behind RAID

Listening to an increasing number of people babbling about “that amazing Drobo thingy” is really starting to piss me off. It’s an expensive toy with a simple set of features that any CS major should be able to reproduce in a number of different (and cheaper) ways.

Now, I like numbers (as in facts, not that boring TV series) and having access to a Drobo, I ran a couple of tests. The Drobo is using four 1TB drives, connected to a Debian box, with the data being accessed through a CIFS share (mounted with ‘nounix’ because otherwise it is sloooooow(er)).

Here’s the quick “benchmark”:
jupiter:/drobo# dd if=/dev/zero of=foo count=100000 bs=1024
100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 93.9097 s, 1.1 MB/s
jupiter:/drobo# dd if=foo of=/dev/null count=100000 bs=1024
100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 14.3171 s, 7.2 MB/s

There was actually another (reader) process accessing the share in the background and that slowed things down a little bit. The same test with a single connection gives us an astonishing 9.7MB/s (writing) or 13.8MB/s (reading).
And just in case you are curious, the same ‘dd’ commands with 10 concurrent reading connections result on speeds of 2.3kB/s-2.6kB/s. I think it’s faster than a 3.5” floppy, but I’m not sure.

Someone told me “That’s the price to pay for redundancy”. If this is how you feel, please go and kill yourself.

The good news is: it would completely replace my old copy of Sedra and Smith’s “Microelectronics” as a paper weight on the flatbed scanner.

Emacs’ keyboard shortcuts

Well, I guess they leave a pretty bad first impression, but then…. they kind of grow on you (I already tried to use C-d on the WordPress text editor 3-4 times by now).

I just found this web page with quite a detailed explanation on the reason behind the “C-x M-c M-butterfly” combos , and thought it was worth sharing with the world.

The link at the bottom, to a page on modernizing Emacs, also raises a few interesting questions (although I happen to like the “*scratch*” buffer).


Linden Labs may have created something I really don’t like, Second Life, but they got something right. They created one of the few libraries that make my job easier.

Eventlet is not like Twisted or Tornado, or any other async library. It just works, it’s easier to understand and to adapt your code to.

Give it a try and you’ll probably be positively surprised.

Unfinished business

If there is one thing I dislike in software development (personal or professional) is unfinished projects. Not unfinished in the sense of  “in progress” but more in the sense of  “it will never ever see light”.

A lot of companies do that, mainly in order to protect themselves. I can’t really say anything there as one needs to think business-wise :)

What I don’t like are projects that I start and never finish for one reason or another. Need an example? This blog. Me and the other “grunt” here started to code a blog to live in this space that did exactly what we needed and no more or less. Until I stumbled with wordpress in our provider admin page. The thought arrived fast: “Do we finish coding the blog or just use what is known to work quite well (wordpress)?”

We decided to finish coding the blog _and_ use wordpress at least for the time being. Why the decision to finish the code? goto: first paragraph