Posts about linux (old posts, page 6)

2007-07-04 10:06

The Linux software ecosystem is boring and a little lame (a rant).

Quick, answer this:

What was the last time a basic piece of the Linux system was redesigned and replaced by everyone?

And the new piece was not a drop-in replacement or evolutionary development for the old garbage?

Please post the answers on comments, because the best I can come up with is one of the following:

  • Postfix replacing Sendmail
  • Everything else replacing Wu-ftpd
  • GRUB replacing LILO ? (not that GRUB is all that great, but at least you have a decent chance of fixing it when it breaks)
  • OpenSSH replacing telnet and rlogin

There are still distros shipping Wu-imap and its offspring!

There are still distros shipping the old syslog!

Let's consider a basic, tty Linux first.

  1. GRUB (ok)
  2. Linux kernel (ok I guess)
  3. Ancient SysV init (unless you use pardus/gobo/some other radical distro)
  4. Services, which probably include
    1. Syslog-NG (which is marginally less broken than old syslog)
    2. Sendmail (even if only for loopback addresses, it's still lame)
    3. OpenSSH (ok, although I think the client sucks because I can't figure out how to store passwords and passfrases in KWallet)
  5. A getty

At least here there is not much room for innovation because we are trying to start something that is a lot like a 30-year-old Unix box.

So, let's go server-ish. What would you normally use?

  • BIND

    Ancient software with a terrible security history. Yes I know it's rewritten lately. They did that before, too, you know.

  • Apache

    For all the good things Apache has, it has some bad ones, too.

    • It's overkill for most servers.
    • As the A in LAMP it has lead people to believe PHP4 is the right language to develop applications in, and MySQL a good place to store their data.
    • If it fails to do what you want, you may get an error. Or not.
    • The configuration is in some sort of pseudo-XML

    Let's get real. For most modern web apps what you want is a decent, high performance WSGI thingie for python apps, and whatever you use for Rails. Apache may or may not be that or have that inside, but who needs the rest of it? What for? PHP pages? mod_perl web apps?

    No, really, I'm asking a question here. What pieces of Apache do you use nowadays?

  • Samba

    • It does what it does.
    • Noone else does it.
    • Ergo, it's the best at what it does.
    • That doesn't mean that losing its TDB every once in a while while doing a "RPC vampire" is not annoying.

    But actually, I am pretty happy about Samba. I mean, what's the alternative, here? NFreakingS?

  • CUPS

    Ok, not too many new print servers out there, but hey, it's better than LPRng!

And if I had written this rant three years ago, I would have used the exact same examples.

Where's the vibrant new server app?

Who's going to write a cool, performing, easy to configure HTTP+WSGI server in D?

Who's going to implement a fast, secure, simple, zeroconf-enabled, file serving daemon?

Who's going to replace BIND?

Who's going to create a Linux server distro with only decent software in it?

Me? No way, I have diapers to change. And there used to be smarter and more driven people around to do this stuff. Are they all changing diapers now?

Come on, stop rehearsing with your band that plays "metal with medieval influences"! Stop growing your stamp collection! Stop

Come on, it's only going to consume at most a year or two of your life. It's not going to harm you more than a budding alcoholism, or a poetry hobby, or attending furry conventions, young man (or woman)!

You don't need to be all that knowledgeable (look at the BIND4 sources) or brilliant, all you need is to be industrious.

Grow a spine and get cranking! Show us old hacks what you've got!

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-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 bartleblog.py
17161 ?        S      0:04 konqueror [kdeinit] -mimetype text/html http://www.google.com/search?q=python+copy+file&ie=UTF-8&oe=UTF-8
17454 pts/1    D+     0:00 grep python
[[email protected] bartleblog]$ su
Password:
[[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/bartleblog.py
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!

2007-03-22 19:53

History of KDE: A generous offer...

Back in october of 1996, when everyone was saving for the flying car we would buy in 5 years, and KDE was starting, slowly, to take shape in the minds of a few.... there was a generous offer...

Matthias Ettrich ([email protected]) wrote:*
>         -------------------------------------------
>         New Project: Kool Desktop Environment (KDE)
>         -------------------------------------------
>
>                     Programmers wanted!

Freedom Software would be willing to contribute with
the source code of Freedom Desktop Light for this effort.
Please don't subestimate the task of building a
desktop manager. Several Years have been spent building
Freedom Desktop.  We could also contribute with
other pieces of technology (i.e Freedom Rt - Object oriented
toolkit). For more information about Freedom Desktop,
please visit http://www.fsw.com

Freedom Software is about to announce a free version
of the software for Linux (personal use only). This version
is called Freedom Desktop Light for Linux.

If I were you, I wouldn't restrict the project to a specific
toolkit (at least for now). There are many pieces of public
software that can be reused easily. It could take a long
time to rebuild everything from scratch. Try to reuse
the more you can now. You can standarize on a single
toolkit later.

Also keep in mind that Motif  is the defacto standard.
Most Unix platform ship with Motif. It would be nice
if your desktop work on all the versions of Unix

Edgar Galvis
Freedom Software
http://www.fsw.com/motif.html - Home of Freedom Desktop for Motif
[email protected]

UPDATE: I had not bothered checking, but freedom desktop's site has been available until very recently. There is still something in the internet archive, too.

2006-11-17 11:04

To the other three guys (or gals)....

... who own a HP Jornada 720 and are using Opie on it and they have the spanish/latin-american keyboard... here is your keymap.

I will write something about how to get Linux going right on it soon, but here's the status report, 48 hours in.

This baby (unnamed yet) has:

  • 32MB of RAM
  • 1 GB of Flash
  • Wifi (802.11b pcmcia) + IRDA + Ethernet (pcmcia) + Anything once I find a 16-bit pcmcia-USB card (anyone has a spare and wants to recycle it? ;-)
  • Decent battery life (6 hours use with wifi, 9 without)
  • A keyboard
  • A decent screen (640x240)
  • A decent Linux-based GUI (Opie)
  • A somewhat erratic touchscreen

So, what can I do with it:

  • Email
  • Web browsing ( With Konqueror goodness )
  • Programming (Python, even PyQt2!). They keyboard and screen are surprisingly decent.
  • eBook reading. This is the most important one. In my work, I spend a lot of time waiting. Waiting for the train to arrive, for the trip to end, for someone to come to a meeting, for the waiter to bring my meal, for stuff to compile, for stuff to download... maybe I wait 3 hours a day. So I read. And this screen (long and somewhat thin) is quite spectacular for reading. Opie-reader is pretty good.
  • MP3 and Video player (haven't used it yet). I have streaming TV at home, courtesy of CherryTV (check the links at the left). This should work great when Rosario wants to see Montecristo and I'd rather see Penn & Teller's show.
  • General PIM stuff. Although I tend to keep that stuff in my head and my phone.

The bad side:

  • The bizarre screen aspect ratio confuses many configuration dialogs.
  • Almost no game works unless you rotate the screen.
  • The keyboard configuration took a while, and is not perfect yet ( I can't make dead_acute work for some reason)
  • The extra buttons don't work (external audio recorder, and alarm light-button)
  • I can't find a way to bind the function keys to apps in Opie
  • The reset button doesn't work (it's now a hang button)
  • Suspend is not really suspend on Linux (for unavoidable hardware reasons), so it spends battery when suspended (may last 12 hours or so, I think).
  • The only way to really turn it off is to take out the battery (not as bad as it sounds).
  • If you do that, it takes about one minute to boot.

So, I am using it more as a laptop (although a really, really small one, with very, very good battery life :-) than as a PDA.

The small memory and CPU means I can't run very demanding stuff, but I never seem to do that, anyway.

And of course, the really bad thing: it's so much fun to hack with, I have trouble working!

All in all, a great toy, lots of fun, and rather useful.

2006-10-17 21:06

No, I don't get a dime from them

For a few months I have been using an unmanaged virtual private server from Tektonic, and I love it.

What's that? Let's take it one word at a time, and then some more.

  1. It's a server: which means it's a full-ish linux installation. So it is capable of doing lots of things. I can run all sorts of weird python thingies in it if I want. IMAPS and SSMTP? No problemo.
  2. It's private: which means I am root on it. I have the shell. I choose what to install.
  3. It's virtual: it's a Virtuozzo partition in a real server. That means no custom kernel modules, and that since almost everything is shared with other instances, 5GB of disk and 128MB of RAM go a long way.
  4. It's unmanaged: which means I manage it. Which is just the way I prefer it, since that's my job.
  5. It's cheap. I started on a 8 dollars a month plan (which doesn't seem to be there anymore, the current cheapest is a 15 dollars plan).
  6. It's a throwaway. I want to host some client as a favour? I just put it there. I could even rent another of these servers for a while, use it, then close it. Backups? Clicking on a webpage saves the image! Other than that... I back it.
  7. Fixed IPs. All you want (for extra coins).
  8. A home away from home. All my stuff is there. I need it, I get it. Without bothering about having my own server at home via no-ip or somesuch (which of course I still have too ;-)
  9. It works. It hardly ever breaks. And having survived expensive, managed servers, this baby is working just as well.
  10. It's a nice gift. Suppose you have a connection to a free software project/LUG/family/whatever, and they need a place on the internet. Why not sponsor them with something like this? I offered one to PyAr (which didn't take it, but it's the thought that counts ;-)
  11. The ultimate learning experience: you can restore the system in 2 minutes. Want to play/learn sysadmining? Do it on the real virtual thing! Much cheaper than hosing your own box ;-)
  12. They offer a good service. So, people should know about it. And of course... if you know a similar, but even better deal... I'm all ears!

2006-10-05 13:38

A different UNIX Part II: A better shell language

One of the things people study when they "learn unix" is shell scripting and usage. Because every system has a shell, and if you learn to use it interactively, you are half way there to automating system tasks!

Let's consider that for a moment... what are the odds that the same language can be good for interactive use and for programming? I say slim.

Not to mention that learning shell as a way to learn unix is like going to a school that teaches TV production, and studying the remote. While useful, not really the important tool (ok, that analogy doesn't work at all. But it sounds neat, doesn't it?).

The first thing is that today's Linux domination of the unixsphere has caused a serious monoculture in shell scripting: everyone uses bash. The more enlightened ones may check that their scripts work on some other Bourne-style shell.

There are no important distributions (or proprietary unixes) that use a csh or anything like it. Debian has a policy that things should work without bashisms. That's about as good as it gets.

Writing a dozen pages on how shell sucks would be trivial. But uninteresting.

So, let's think it over, and start from the top.

What should a shell scripting language be like?

What doesn't matter?

Let's tackle these things. I invite anyone to add extra ideas in the comments section.

What should a shell scripting language be like?

  • Interpreted (obvious)

  • Dynamic typing (you will be switching ints to strs and viceversa all the time).

  • Easy incorporation of other programs as functions/methods/whatever.

    That pretty much is what makes it a shell. ls should be indistinguishable from something written using the shell itself.

  • Pipes. This is a must. Unix has a bazillion tools meant to be used in command pipelines. You can implement a RDBMS using that kind of thing (look for nosql). Leverage that.

    But even here, on its strength, the shell is not perfect. Why can't I easily pipe stderr and stdout to different processes? Why can't I pipe the same thing to two processes at the same time (yes, I know how to do it with a neat trick ;-)

  • Globbing. *.txt should give you a list of files. This is one of the obvious things where sh is broken. *.txt may be a string or a list, depending on context... and a list is just a series of strings with blanks. That is one of the bazillion things that makes writing shell scripts (at least good ones) hard:

    [[email protected] ralsina]\$ echo *out
    a.out
    [[email protected] ralsina]\$ echo *outa
    *outa
    
  • A list data type. No, writing strings separated with spaces is not ok. Maybe a python-style dictionary as well?

  • Functions (obvious)

  • Libraries (and ok, the shell source mechanism seems good enough)

  • Standalone. It shouldn't spawn sh for any reason ;-)

What doesn't matter?

  • Performance. Ok, it matters that a five-liner doesn't take 50 minutes unless it has to. But 1 seconds or two seconds? not that important.
  • Object orientation. I don't see it being too useful. Shell scripts are old-fashioned :-)
  • Compatibility to current shells. Come on. Why be like something that sucks? ;-)

Now, the example

Let's consider a typical piece of shell script and a rewrite in a more reasonable syntax.

This is bash (no it doesn't work on any other shell, I think):

DAEMONS=( syslog network cron )

# Start daemons
for daemon in "\${DAEMONS[@]}"; do
      if [ "\$daemon" = "\${daemon#!}" ]; then
              if [ "\$daemon" = "\${daemon#@}" ]; then
                      /etc/rc.d/\$daemon start
              else
                      stat_bkgd "Starting \${daemon:1}"
                      (/etc/rc.d/\${daemon:1} start) &>/dev/null &
              fi
      fi
done

And since DAEMONS is something the admin writes, this script lets you shoot in the foot in half a dozen ways, too.

How about this:

DAEMONS=["syslog","network","cron"]

# Start daemons
for daemon in DAEMONS {
      if ( daemon[0] != "!" ) {
              if ( daemon[0] == "@" ) {
                      stat_bkgd ("Starting "+daemon[1:])
                      /etc/rc.d/+daemon[1:] ("start") &> /dev/null &
              } else {
                      /etc/rc.d/+daemon ("start")
              }
      }
}

Of couse the syntax is something I just made up as I was writing, but isn't it nicer already?

2006-10-02 09:52

A different UNIX Part I: Mail in not-mail-servers

I have been procrastinating about creating my own Linux distro for at least three years. Guess what? I will still procrastinate about it for a few more, but that doesn mean I can't write about how it's supposed to work ;-)

So, here is a first piece of the puzzle...

What do I mean by "Main in not-mail-servers"?

If by mail server we mean a box that has the responsability to handle sending mail for users, non-mail-servers are all the rest.

And what is it they do with mail? They generate it. Both the users and the processes of those boxes generate mail. They do it for cron jobs, they do it for maintenance processes, they do it for alerts, whatever.

And what is it they do with that email? They send it somewhere.

Usually, they send it to themselves. Which is a pretty useless thing.

Go now and check the root mailbox in your computers. I bet most of you have a bunch of mails in them you never checked. Either it's important, in which case you should have placed it in a mailbox you actually read, or it's not, in which case it's useless to store.

In any case, it shouldn't be there.

How does your box send those mails? Using either the sendmail binary, or the mail program (probably mailx), which uses the sendmail binary.

Just because it's called sendmail it doesn't mean it is sendmail, of course. Postfix and qmail provide a sendmail wrapper to inject mail into their queues.

But the main problem is that using those means you need to have a well configured mail server in every box, even if they are not mail servers! Yes, your distro gives you a decent configuration by default which makes things usually work... for local mail delivery at least. Which is probably not really what you want.

Enter nullmailer. A sort of heavily sedated, neutered qmail.

Configuration:

  • Default domain name of outgoing mail in /etc/nullmailer/me

  • List of SMTP servers in /etc/nullmailer/remotes:

    mx1.mydomain.com smtp --user=ralsina --pass=notmyrealpass
    

You can put several, it will try them in order.

And that's that. A tiny service, which uses no TCP ports. The whole thing is 59KB (or less if you use diet libc), has one SUID binary (but it is not SUID root), two config files (both one-liners), no need for aliasing the system users.... and you can remove postfix/sendmail/qmail from most of your servers.

Sounds like a good idea to me.

2006-10-01 13:53

Long update

I have not posted in a long time, not because nothing happened, but because too much happened.

So, here is an update...

Baby

The baby is doing great. The first ultrasound was on Sept. 15th, and hree he is:

ecografiaPoroto

Birthday

That was on Sept. 15th because Rosario wanted it to be my 35th birthday present. So happy birthday to me.

Work

The little company I am starting up is doing great

Hobby

I have decided that I have almost enough packaged for Arch that it's starting to make sense to master some ISOs. Basically: a somewhat-DJB-way-oriented linux distro.

  • Boots using runit
  • Maybe someday will use LUA instead of sh for startup scripts
  • All services should be managed
  • Will introduce genetic diversity to the ecosystem

That means: no sendmail, no postfix, no BIND, no Apache (at least for basic stuff), no many other "leading" programs. That is intentional. If everyone uses BIND, a BIND failure is catastrophic.

If I have learned anything from Outlook/IE it's that having everyone use the same thing is comfortable, but troublesome.

Contents © 2000-2018 Roberto Alsina