Posts about sysadmin (old posts, page 2)

2007-08-10 13:06

Good experience with VoIP service: Metrotel

Trying to create a more serious looking infrastructure for my consulting business, I decided I needed a non-mobile phone number, and a way to receive Faxes [1]. While I would use this as a secondary business number, it's just my home phone.

Since the costs for old-fashioned phone service in Argentina are stupid [2] I started investigating VoIP alternatives.

On a subway ticket, I found an ad for Metrotel which is quite interesting.

First, there is the numbers:

  • No installation fee
  • $35 for 1000 minutes
  • Cheaper long distance service

What they do is provide you a simple Handytone 486 box, and you plug it to your Internet-connected LAN on one side, and a phone on the other.

You can also plug in your land line and use the phone to call on either one, and another ethernet device (example, a computer o switch). If you have only one computer, you just stack it onto your cablemodem or whatever.

Absolutely trivial installation... unless they ship you the wrong gadget, as they did to me, sending me one that was disabled. But that's ok, they fixed it in a couple of days.

I have three small issues:

You have to sign a 12-month contract. However, if you take the smallest plan, the 12-month contract is cheaper than the connection fee for Telefónica de Argentina! And you still get 1200 free minutes in that year!

You must use the gadget. While it's a simple SIP device, they won't give you the user and password, so you can't use a softphone or a real VoIP phone with this service (unless you hack it, but why bother).

Because of that, it's kinda tricky that the ads say you can use this phone line "everywhere". I mean, it's true... if you have broadband internet connections with ethernet connections "everywhere".

However, if you do your due dilligence and figure out what you are getting into, it's a very nice service, which works well, and has great cost advantages over the traditional alternative.

It's specially great if you want to have a Buenos Aires phone number and work from somewhere else (for example, labour costs in other provinces are usually below 75% of those in Buenos Aires).

[1] Although Faxes make no sense whatsoever in 2007, some companies still ask me for a fax number.
[2] How about $181.50 to install and $36.50 monthly with no minutes included? And that's for home service. Commercial service is more expensive still. Those are pesos, but trust me, they look just as high to me as dollars would for you. The beauties of local monopoly!

2007-06-19 11:08

I must be doing something right

Here are the two largest mail servers I manage. They handle over 20K users, with full mail service.

[[email protected] ~]# uptime
 11:02:29 up 217 days,  3:09,  3 users,  load average: 1.54, 5.79, 7.40

[[email protected] ~]# uptime
 11:02:25 up 227 days, 21:58,  1 user,  load average: 6.78, 4.61, 3.90

Ok, the load is a little high, but I know the reason and it's not a big problem.

2007-05-20 22:37

Why I use Arch Linux

I have been an Arch Linux for a while now, and I am still liking it.

Here's the good side of it:

  • It's small (one CD)
  • It's simple (it comes with very little)
  • It has a decent package selection (if you consider AUR, more about that later)
  • It uses pretty much unpatched upstream software
  • It's a binary distro (except for AUR. Again, more about it later)
  • It's pretty stable (no crashes I can remember)
  • It has rolling releases (unlike, say, Fedora or Debian)
  • It's easy to keep updated (like all of them nowadays)
  • It's not ideologically dogmatic, but pragmatic (yes, there are NVidia drivers, and test-drive games, and whatever)
  • It doesn't seem to be a one-guy joint

And the bad side:

  • Updates sometimes break things (about twice a year)
  • Admin tools are between unexistant and disjointed

And of course, there is the very very good side: AUR

AUR is a comunity repository. And there is a rather large community. And packaging things for Arch is so easy, and putting things in AUR is so simple, even I find time to contribute (my packages).

And it's a calm community, and pretty much, instead of compiling my random unknown packages for myself, I save the steps to build them and stick them in a PKGBUILD and upload them. Takes two minutes for most things.

It's a throwback to the old days of Linux: quiet, competent (or learning) people doing things, sharing, you use them, you give back... I had not felt that way with a distro for years.

2007-05-18 14:25

Small software released: RA-WebPass

I just released a wee piece of software, called RA-WebPass which is simply a webpage that you can use to change linux system passwords.

Basically, I wrote it today out of my frustration with customers asking me "how can I change the password for the FTP server". Ok, this is how you can.

It's simple and doesn't have too many dependencies, so it should be rather secure, but don't trust me on that, and you need to run it as root, so be very very careful.

RA-WebPass home page

On a related note: it's quite satisfying to write something in two hours and just release it :-)

2007-05-16 11:37

A KDE hack: Faster mail searches in kmail, using mairix

Kmail searches slowly.

I have been a kmail user for a couple of years, since I settled in my own home office with my own computer.

I like the thing.

However, it annoys me that it takes sooooo long to find a message in my mailstore. Hey, it's only 13000 messages!

So, while I wait for KDE4 to bring all its searching goodness, I decided to see if I could hack something quickly.

Enter mairix: a mail indexer/search thing.

Convincing mairix to index all my mail was rather simple (here is my ~/.mairixrc):


What does it do?

  • It indexes mail stored at ~/Mail and everywhere in my kmail imap folders.
  • It stores search results in ~/Mail/mairix and ignores its contents when searching. The results are stored as links, so they waste no disk space.

After running mairix so it builds its DB (took about a minute, which is less than most kmail searches) , you can search for things like this:

[[email protected] ~]$ time mairix b:bartleblog
Matched 6 messages

real    0m0.232s
user    0m0.012s
sys     0m0.204s

And the result can be seen in kmail, in the mairix folder:


However, there is a problem. It will work for the first search, but not for the second one. On the second search, you get the same content listing, but all messages appear empty.

That's because kmail saves an index file of each folder. To work around that, I wrote a little shell wrapper, kmairix:

rm ~/Mail/.mairix* -f
mairix $*

And you use that instead of calling mairix directly.

But there are still improvements to be done. If your kmail is currently displaying the mairix folder, searching doesn't update the message list.

DCOP to the rescue! We can switch to the inbox, then back to mairix (adjust as needed for yourself):

dcop kmail KMailIface selectFolder /Local/inbox
dcop kmail KMailIface selectFolder /Local/mairix

Missing pieces:

  • How about switching to the kmail window? Sadly, the kwin DCOP interface seems incomplete. Maybe assigning kmail a hotkey and work from there? Let me know if you have any ideas.

    UPDATE as suggested by Anno Heimburg: just call kmail.

  • A GUI (of course!) probably with a tray icon...

  • A way to auto-update the Mairix DB when new mail arrives. I am thinking about doing it with incron but have not done it yet.

So, here is the final version, put it somewhere in your path, and use ALT+F2 to search your mails :-)

rm ~/Mail/.mairix* -f
mairix $*
dcop kmail KMailIface selectFolder /Local/inbox
dcop kmail KMailIface selectFolder /Local/mairix

2007-05-13 21:15

Sometimes I am stupid. Then again, it doesn't matter, because I am lucky!

I am working on changing BartleBlog so it can be used from scratch. That may sound odd but because I have been using it since day 2 to post this blog, it has grown very organically, meaning there are things that only work because of the way I used it while developing it.

So, I created a test user, and created a test blog there, and I am working, and decide to do another from-scratch test, and...

I deleted my production copy.

Yes. The one that generates this blog. So this blog disappeared. Because I used the wrong terminal window.

And I had one-week old backups.

So I felt very very stupid.

Because undeleting in Linux is a joke.

So I was thinking how to spend a few hours recreating the last week of posts, and whatever, when I noticed on the taskbar... bartleblog was still running.

Which means that the DB was still open by a process. Which means...

[[email protected] bartleblog]$ ps ax | grep python
17063 pts/1    S     24:33 python
17161 ?        S      0:04 konqueror [kdeinit] -mimetype text/html
17454 pts/1    D+     0:00 grep python
[[email protected] bartleblog]$ su
[[email protected] bartleblog]# cd /proc/17063/fd
[[email protected] fd]# ls
0  1  10  11  12  2  3  4  5  6  7  8  9
[[email protected] fd]# ls -l
total 0
lrwx------ 1 ralsina users 64 2007-05-13 21:07 0 -> /dev/pts/1
lrwx------ 1 ralsina users 64 2007-05-13 21:07 1 -> /dev/pts/1
lrwx------ 1 ralsina users 64 2007-05-13 21:07 10 -> socket:[159486]
lrwx------ 1 ralsina users 64 2007-05-13 21:07 11 -> socket:[159488]
lrwx------ 1 ralsina users 64 2007-05-13 21:07 12 -> /mnt/centos/home/ralsina/.bartleblog/blog.db (deleted)
lrwx------ 1 ralsina users 64 2007-05-13 21:07 2 -> /dev/pts/1
lr-x------ 1 ralsina users 64 2007-05-13 21:07 3 -> /mnt/centos/home/ralsina/Desktop/proyectos/bartleblog/bartleblog/BartleBlog/ui/
lr-x------ 1 ralsina users 64 2007-05-13 21:07 4 -> pipe:[159481]
l-wx------ 1 ralsina users 64 2007-05-13 21:07 5 -> pipe:[159481]
lr-x------ 1 ralsina users 64 2007-05-13 21:07 6 -> pipe:[159482]
l-wx------ 1 ralsina users 64 2007-05-13 21:07 7 -> pipe:[159482]
lr-x------ 1 ralsina users 64 2007-05-13 21:07 8 -> pipe:[159485]
l-wx------ 1 ralsina users 64 2007-05-13 21:07 9 -> pipe:[159485]
[[email protected] fd]# cp 12 /root/db
[[email protected] fd]# ls -l ~/db
-rw-r--r-- 1 root root 3582976 2007-05-13 21:07 /root/db
[[email protected] fd]# sqlitebrowser ~/db
[[email protected] fd]# cp ~/db /home/ralsina/.bartleblog/blog.db

And I got the database back.

If you don't understand how that worked.... here's the explanation:

  • On unix, files are really unlinked (removed from directories) when no process has them open. Even then, the data is not deleted, but finding it is much harder.
  • On /proc/PID you can see the file descriptors each process has open.
  • You can actually copy a file descriptor.

So I went and copied the open file. And got it back. And this blog didn't go away.

So I am lucky! Stupid. But lucky!

2006-11-07 09:28

Veanme en CafeConf 2006! / See me at CafeConf 2006!

Como todos los años, voy a dar una charla en CafeConf 2006, el tema de este año es "Booteando más rápido y mejor usando runit".

Si buscan runit en este blog se van a enterar mas o menos de las mismas cosas, pero la charla debería ser más prolija :-)

La primera persona que mencione el nombre de este blog en la parte de preguntas y respuestas se gana un regalo sorpresa!

Like every year, I will be speaking at CafeConf, Sat. Nov 11. This year's topic is "Botting faster and better using runit".

If you look for runit in this blog, you will find out more or less the same things, but this should be more organized.

The first guy to mention the blog in the Q&A session gets a surprise gift.

2006-05-16 00:20

Using runit is even simpler

I have posted in the past about runit.

One of the problems people migrating to runit have is that all your services are SysV scripts.

The runit author has a collection of scripts you can use, but usually they require some adjustment to work on a specific version of Linux.

So, I wrote a lame python script that takes the SysV scripts you are currently using and turns them into runit services, including dependencies.

Suppose you usually start on runlevel 3. Then you save this script and run it like this:

mkdir services
python 3

And you should end with a bunch of runit services inside services/

Those services will start in roughly the same order as if you were using SysV init. That's probably way too much dependencies.

The main difference is that kdm will start earlier and the ttys will start way earlier than you are used to.

I have found that my notebook boots faster using this, but I can't provide a bootchart because it simply doesn't seem to work in my computer.

If anyone is willing and able to run the tests and quantify the difference, I am all ears.

For some reason kudzu, iptables and arptables_jf don't work with this approach, so just stick them at the bottom of /etc/runit/1

Also, please understand that these are not correct runit services. They are not managed, so if your service crashes it stays crashed.

So, you should still eventually migrate to correct scripts. This is just a way to make that simpler.

Contents © 2000-2019 Roberto Alsina