Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Try htop

Ev­er need­ed a process mon­i­tor that runs in a ter­mi­nal? Have you been us­ing top? Use Htop in­stead. Much, much, much nicer!

Getting in trouble is interesting. Getting out is educational.

I re­or­ga­nized the par­ti­tions in my note­book. Since it has two dif­fer­ent Lin­ux­es, and I did­n't touch any­thing in one of those, I thought I was pret­ty safe.

Well... I was­n't, be­cause I moved my /boot, and for­got to change my GRUB con­fig­u­ra­tion, so I end­ed with a non-­bootable box.

And not just reg­u­lar non-­bootable:

  • GRUB gave er­ror 17 be­­fore the menu

  • The DVD read­­er is bro­ken

  • My ex­ter­­nal USB HD is on loan on a client

  • My Sony-dis­­c­­man/PCM­­CI­A-SC­SI-ex­ter­­nal-CD-read­­er needs 110v pow­er (and I have no tran­s­­former around)

  • My orig­i­­nal Li­bret­­to PCM­­CIA FD work­s, at least to boot... but I have no oth­­er flop­py drive to mas­ter a diskette.

Yes, I get in­to this kind of thing more of­ten than most. I buy sec­ond hand hard­ware. I am not a first-­worlder, guys.

So... what do you do in such sit­u­a­tion? You go with PXE boot­ing.

First I tried the on­ly thing I knew that worked with PX­E, LT­SP (Lin­ux Ter­mi­nal Serv­er Pro­jec­t).

So, two hours, a DHCP/TFT­P/N­FS con­fig lat­er, it's work­ing.

It worked well enough (although it's quite a bit of work) but... I got no way to ac­cess the HD, be­cause the on­ly screen is a re­mote X dis­play!

I am sure with a lit­tle el­bow grease I could make it give me a lo­cal lo­gin with de­cent res­cue tool­s, but it's not re­al­ly ob­vi­ous.

Then I googled for "lin­ux PXE dis­tri­bu­tion" and found RIP. Specif­i­cal­ly the RIP-PXE ver­sion.

It is meant for re­cov­ery, so it's not sur­pris­ing that it does a bet­ter job than LT­SP, which is­n't.

One nice thing is that it loads its root FS in­to RAM from TFT­P, so no need for NF­S­ROOT (or NFS at al­l, re­al­ly). It works with on­ly DHCP and TFT­P. Quite triv­ial to do... but not doc­u­ment­ed. How­ev­er, start­ing with the LT­SP docs about PXE boot­ing, it was pret­ty ob­vi­ous :-)

This is what you need to put in your DHCP con­fig (in the sub­net chunk):

if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
    filename "/pxelinux.0";
}
else{
    filename "/kernel";
}

And then dump RIP-PXE in­to your /tftp­boot (or /var/tf­pt­boot, or what­ev­er).

As long as you can do this with no er­rors, you are gold­en:

bash-3.1$ tftp localhost
tftp> get /pxelinux.0
tftp> get /kernel
tftp>

On some tftp server­s, you need to do "get /tf­p­t­root/px­elin­ux.0" or sim­i­lar. Ad­just paths ac­cord­ing­ly.

So, it boot­s. You lo­gin. You fix your menu.l­st/­grub.­con­f/f­stab/what­ev­er, and you are out.

Beau­ti­ful!

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

I have been pro­cras­ti­nat­ing about cre­at­ing my own Lin­ux dis­tro for at least three years. Guess what? I will still pro­cras­ti­nate about it for a few more, but that doesn mean I can't write about how it's sup­posed to work ;-)

So, here is a first piece of the puz­zle...

What do I mean by "Main in not-­mail-server­s"?

If by mail serv­er we mean a box that has the re­spon­s­abil­i­ty to han­dle send­ing mail for user­s, non-­mail-servers are all the rest.

And what is it they do with mail? They gen­er­ate it. Both the users and the pro­cess­es of those box­es gen­er­ate mail. They do it for cron job­s, they do it for main­te­nance pro­cess­es, they do it for alert­s, what­ev­er.

And what is it they do with that email? They send it some­where.

Usu­al­ly, they send it to them­selves. Which is a pret­ty use­less thing.

Go now and check the root mail­box in your com­put­er­s. I bet most of you have a bunch of mails in them you nev­er checked. Ei­ther it's im­por­tan­t, in which case you should have placed it in a mail­box you ac­tu­al­ly read, or it's not, in which case it's use­less to store.

In any case, it should­n't be there.

How does your box send those mail­s? Us­ing ei­ther the send­mail bi­na­ry, or the mail pro­gram (prob­a­bly mailx), which us­es the send­mail bi­na­ry.

Just be­cause it's called send­mail it does­n't mean it is send­mail, of course. Post­fix and qmail pro­vide a send­mail wrap­per to in­ject mail in­to their queues.

But the main prob­lem is that us­ing those means you need to have a well con­fig­ured mail serv­er in ev­ery box, even if they are not mail servers! Yes, your dis­tro gives you a de­cent con­fig­u­ra­tion by de­fault which makes things usu­al­ly work... for lo­cal mail de­liv­ery at least. Which is prob­a­bly not re­al­ly what you wan­t.

En­ter null­mail­er. A sort of heav­i­ly se­dat­ed, neutered qmail.

Con­fig­u­ra­tion:

  • De­­fault do­­main name of out­­­go­ing mail in /etc/nul­l­­mail­er/me

  • List of SMTP servers in /etc/null­mail­er/re­motes:

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

You can put sev­er­al, it will try them in or­der.

And that's that. A tiny ser­vice, which us­es no TCP port­s. The whole thing is 59KB (or less if you use di­et libc), has one SUID bi­na­ry (but it is not SUID root), two con­fig files (both one-­lin­er­s), no need for alias­ing the sys­tem user­s.... and you can re­move post­fix/send­mail/q­mail from most of your server­s.

Sounds like a good idea to me.

Long update

I have not post­ed in a long time, not be­cause noth­ing hap­pened, but be­cause too much hap­pened.

So, here is an up­date...

Ba­by

The ba­by is do­ing great. The first ul­tra­sound was on Sep­t. 15th, and hree he is:

ecografiaPoroto

Birth­day

That was on Sep­t. 15th be­cause Rosario want­ed it to be my 35th birth­day presen­t. So hap­py birth­day to me.

Work

The lit­tle com­pa­ny I am start­ing up is do­ing great

Hob­by

I have de­cid­ed that I have al­most enough pack­aged for Arch that it's start­ing to make sense to mas­ter some ISOs. Ba­si­cal­ly: a some­what-D­JB-way-ori­ent­ed lin­ux dis­tro.

  • Boots us­ing runit

  • Maybe some­­day will use LUA in­­stead of sh for start­up scripts

  • All ser­vices should be man­aged

  • Will in­­tro­­duce ge­net­ic di­ver­si­­ty to the ecosys­tem

That mean­s: no send­mail, no post­fix, no BIND, no Apache (at least for ba­sic stuff), no many oth­er "lead­ing" pro­gram­s. That is in­ten­tion­al. If ev­ery­one us­es BIND, a BIND fail­ure is cat­a­stroph­ic.

If I have learned any­thing from Out­look/IE it's that hav­ing ev­ery­one use the same thing is com­fort­able, but trou­ble­some.

Going Higher Level, Leaving the Shell (Part I)

What hap­pens if you try not to use a shell in Lin­ux?

And no, I don't mean for in­ter­ac­tive use. Many do that.

No... what hap­pens if you try not to use a shel­l... to boot your sys­tem?

Read more to find out.


Contents © 2000-2020 Roberto Alsina