Category Archives: Crux Linux

My dumbest trick yet

This is one of those things that I will probably be looking for again in the future, no matter how lame it seems right now.

I like to keep local copies of the source code for the software I have on Crux systems, just because if something breaks and I am not online, then it helps to get things going again. It’s also useful if network speeds are slow or if there’s a problem getting a particular source package with the proper checksum.

On the other hand, that tends to take up a lot of space, particularly if there’s a large library or compile-time dependency involved. ocaml, for example, is a gargantuan beast that’s only really necessary to compile wyrd. Once it’s been built, I don’t need ocaml ever again.

So to save space I sometimes have to remove source packages (which can be neatly done with prt-utils’ prtwash -a -s command), but it makes me itchy.

So I decided today to get all the source packages back from the applications I’d installed and then cleared out, as a precautionary measure. pkgmk has a -do flag, which just gets the package but doesn’t do anything with it.

But I don’t think you can give pkgmk the name of a program to build; it has to be executed from the port directory, where it reads the Pkgfile and goes to work.

Now prt-get has a path command, which spits out the full path of a package, and that means I can cd into a path‘d directory and issue the pkgmk -do command.

If I can get a proper list of all the packages on the system, that is. prt-get to the rescue again, with the wonderfully sparse listinst command. Ergo:

for i in `prt-get listinst` ; do cd `prt-get path $i` ; pkgmk -do ; done

Not much in the way of error checking. Definitely not idiot-proof. And it could, I suppose, stand to save a little bandwidth if the package is already on hand and passes an md5sum check.

But those are embellishments. Flair! Bloat! πŸ‘Ώ

Anyway, that’s probably the dumbest thing I’ve come up with for a while. Watch: This’ll be the most frequent page I hit over the next year or so. This and the page for setting locales. … πŸ™„


Memory’s in the corners of my mind

Memory seems to be on my mind more than usual these days. That probably started with the myth about more memory arbitrarily improving system speed, and continued with the purchase of a gargantuan chunk of memory around the same time. And then the issue resurfaced yesterday, with an entire Openbox desktop riding on a speck no bigger than 12Mb.

I know the whole “free memory is wasted memory” argument, and in principle I agree.

But there’s a side of me that says large chunks of available memory are not an excuse for overweight software. I’m not a coder so I probably shouldn’t complain, but just because your pants are a little loose doesn’t mean you can overeat.

And really, the logic of that statement doesn’t suggest you should make an effort to use that space. It suggests you should take the extra memory out of your computer and give it to a friend. If you bought it and don’t use it, then your money went to nothing.

So … “free memory is wasted money?” 😯 You heard it here first. πŸ™„

I mean no offense. If you’re not using that memory, take heart: I’m not using mine either. Even this, an Arch system chrooted into a Crux system on USB and compiling mesa3d, is only using about 7-8 percent of the total memory available to the system.

And unless I’m mistaken, most of the results written in the build process will probably held in memory before they’re dumped to the USB disk en masse. So it might be safe to say usage is a wee bit higher there because of cached changes that will need flushed. I might be wrong though; htop might not make that distinction.

But it’s all hairsplitting really. Either you have enough memory or you don’t, or you have too much or you don’t. You’re the one who gets to decide which is true and what’s best for you. You are free to stack memory chips in your machine like so many slices of bread, and complain that it’s just not enough.

On the other hand, if anyone feels crazy and wants to yank a stick of PC66 from a laptop, I’d be happy to put it to work. … πŸ˜€

One small Crux bug

I ran into a bug the yesterday, while I was building the Crux machine with Openbox on it.

Since I have been compiling everything off that machine and then syncing the ports tree over USB, I discovered a little quirk with prt-get and/or pkgadd regarding prebuilt packages. The easiest way to explain it is to show it.

bash-4.1# prt-get depinst alpine
prt-get: installing /usr/ports/local/alpine
=======> Package '/usr/ports/local/alpine/alpine#2.00-1.pkg.tar.gz' is up to date.
prt-get: installing alpine 2.00-1
pkgadd: could not install usr/bin/rpload: Write failed
pkgadd: could not install usr/man/man1/pilot.1.gz: Write failed
pkgadd: could not install usr/man/man1/rpdump.1.gz: Write failed
pkgadd: could not install usr/man/man1/rpload.1.gz: Write failed
pkgadd: could not install usr/man/man1/alpine.1.gz: Write failed
pkgadd: could not install usr/man/man1/pico.1.gz: Write failed
/sbin/ldconfig: Writing of cache data failed: No space left on device

-- Packages installed

Obviously alpine isn’t installed. pkgadd ran out of space on the drive, and in spite of displaying errors, it’s either returning a “success” code or prt-get is displaying the “success” message. If memory serves, this really only happens with precompiled packages.

I posted a bug here, and then Johannes Winkelmann suggested mentioning it in connection with pkgadd, since prt-get really just reports what pkgadd tells it. πŸ˜‰

X and Openbox in 12Mb

I have not been lax in testing distros with the Mebius, but it is becoming rare to find a system that will start up effectively on 32Mb of memory, let alone install to the disk.

But I do have another miracle of modern science to show: an i586-flavor Crux system running Openbox and Xorg 7.4’s server 1.8.2 on a measly 12Mb of memory, no swap, after a cold boot.

The python memory script I mentioned a year ago confirms that, although it does put usage closer to 14Mb. I never know if I should be mentally subtracting for the space taken up to run it under python.

No matter. That’s not what is important; what’s important is that I thought only Debian could pull off this stunt, but now there are two contenders.

Memory usage is definitely lower in this rendition than in Debian, and start times from Grub to the desktop are under 16 seconds for a 150Mhz machine … with a somewhat quicker hard drive in it, so don’t tout that. Not bad at all, considering some of the speediest Arch machines I have are doing the same.

But it’s also important to note that I build Crux systems with kernels so sparse you can drive a car through them, and without an initramfs, etc., to wait on, things are considerably faster on the startup.

The standard Xorg trident driver was a loss, as was the kernel’s tridentfb module in the kernel. With both the Xorg xvesa and fbdev drivers installed I get an acceptable 16-bit 800×600 graphical desktop.

And it’s not as much of a memory hog as I usually make it out to be. In both screenshots you can see X squished into less than 6Mb of space, which isn’t as good as this was, but it’s still considerable.

Perhaps that is another bonus to using older computers — considerably smaller demands on X. 😈

Openbox is running the desktop in those screenshots too, and while that’s no miracle, it is amazing to me that GTK2 applications like Leafpad or gcolor2 or even obconf run without undue hassle. Yes, everything is still ugly slow, just because 150Mhz is ugly slow. But at least it’s not as bad as GTK2 was at 16Mb.

And because someone is going to ask, here it is:

Yeah, it took me almost half an hour to get that screenshot, so enjoy it. And the screen artifacts are there because it takes 20-25 seconds for a redraw for Firefox, with continuous swapping to the disk. I’d have to time-delay scrot by about two minutes to get rid of that.

For practical use though, I think the standard array of console programs inside rxvt-unicode’s daemon would be an improvement. And maybe dmenu and Musca.

Regardless, this is quite remarkable in its current form. I will continue to sift through some of the other “lightweight” distros and see what I can find, but sometimes it’s just a better idea to build it yourself. :mrgreen:

P.S.: Sound is still screwy though. … 😦

How to use teapot like a pro

I like to make a big deal out of console applications that really are applications — that actually have a workable “GUI” beyond just a command and a few switches. It’s part of my quest in life: To dispel the irrational repulsion many people brag (yes, brag) about when they discuss using the console with Linux. πŸ™„

It’s been a while since I really walked neatly through a program though, and I feel I should do that with teapot. teapot is a very useful, very lightweight spreadsheet that I like a lot. I don’t need it very often though, and so each time I pick it up I have to relearn it again.

But on top of that, I have mentioned Oleo in the past, which is a very good console spreadsheet. But it’s not the only one out there, isn’t really to my liking, and there are things about teapot that are worth looking at.

The first trick might be getting it installed, since it isn’t in every distro — Ubuntu, for example, draws a blank if you ask the package search pages about it. AUR has it, with the caveat that it’s for “mathy” people, which I don’t dispute. It’s a spreadsheet, so you can expect to see some numbers. I know some people for whom that would be enough to be called “mathy.” πŸ˜‰

If you decide to build it from scratch, you can take comfort in the thought that teapot only needs ncurses to get going. So I’m guessing with 99 percent certainty that (a), you can build it without too much hassle, and (b), it’s as light as a feather when in action. And that last part is a fact confirmed by htop.

Getting started is easy enough. Enter teapot at the prompt, and you should get something that looks like this.

Fair enough, it looks like a spreadsheet. We were expecting that much.

Except … hold on: The columns aren’t labeled with letters. We have numbers across and numbers down. That’s a little unusual.

Yes, that alone is probably enough to either intrigue you or dismay you — teapot breaks convention by using numbers in both directions. Now the un-“mathy” people in the crowd are probably already considering panicking, but the “mathy” ones might suddenly be interested.

Because it means that there is an x-y coordinate for each cell — and in fact, most of teapot’s instructions and formulas rely on that to work. And best of all for the “mathy” types, there is an unseen z dimension at work here, so the layers beneath this page are also addressable.

You know, maybe that “mathy” label was right.

No matter. Let’s get started. I’m going to make a spreadsheet for this example that shows how much of my lowly paycheck went into my X60s, in the form of memory and a new hard drive. First, I’m going to put the make and model of my hard drive in the upper left block. Type “SATA3G hard drive”, starting and finishing with quotes.


My god, it’s full of stars. … Well, we’ve already run into our first problem. It seems that the title is too long for the width of the cell. teapot tells us that by showing those stars, and signaling to us that we should probably widen that column a little.

No problem. Press F10.

teapot has a menu system — I wasn’t kidding when I mentioned GUIs in console programs. Select W)idth, and set the column width to 24.

That’s better. You can see in the bottom line there that the coordinates for the cell — 0,0,0 — contain the quote-enclosed text we entered. Now a little navigation: Use the cursor keys to skip through the spreadsheet, and move down a row. Then enter the next item, “PC2-5300 memory”.

If you make a mistake after you enter data, just press return on that cell again to edit it. If you make a mistake and need to back out of the menu, press CTRL+c.

I bought two sticks of memory in different sizes, so it would be nice to just copy that text into the row below. teapot uses block marking, a lot like old-style pre-graphical word processors. You mark a block and then tell teapot what you want done with it.

In this case, press the period (“dot” or .) key twice. This marks the cell as the first corner of the block and the last corner of the block. If you move the selection highlight after that, you can see that the block (or cell, in this case) remains lit.

Now that we have a selection, we can tell teapot to copy it to a new location. Put the selector on the row beneath the memory text, and press F10. Choose B)lock, then C)opy, and confirm it.

That did the trick. One small problem though: We still have the original cell marked. How do we un-mark it? Press period (“dot” or .) again, and it will disappear.

Next, add the text for the last thing on the list, the “SATA enclosure”. At this point, the spreadsheet should look like this.

The problem at this point is that I forgot a header row. It’s not really necessary, but as long as I am going to make this, I might as well make it clear what I am talking about. Let’s insert a row above the whole business.

Navigate back to the top of the page, or just press the less-than key (<). Press F10, then B)lock, I)nsert, R)ow, and then W)hole line.

We used the block menu even though we didn’t have a block defined, and it worked fine this time. And notice that after you’ve inserted the row, you’re still in the menu dialog; press CTRL+c to leave that. I’ll add some headers to this table.

I like a quantity, cost each and total cost for each line. Nothing fancy, just the kind of things you’d expect on an invoice or an order form.

For the quantity column, I can enter 1 for each, since I only bought one each. For the currency I can use the cost in yen for each one, so the table ends up looking something like this.

And I see I made one mistake again: I bought memory of two different sizes but didn’t leave a column for the size. I can insert a column for “Gb” quickly, and add the information where it’s appropriate.

Of course, those headers are skewed off to the left while their information is on the right. Let’s align the headers to the right so they look nice. Mark a block with only the numeric headers highlighted: Press period at the “Gb” column, then skip to the right with the cursor keys until the “Total cost” column is highlighted as well, and then press period again.

If you move away from the marked block, you can see that the entire area is now inverted. Press F10, then A)ttributes, R)epresentation, and R)ight.

So long as you have a block marked, the attributes and representations will be applied to the block. Press CTRL+c to leave the menu dialog, then press period again to unselect the marked block.

Let’s get some totals in here. Obviously, the quantity times the cost will give me the total cost for each line. teapot is flexible enough that there are several different ways to do that, but to avoid being too “mathy,” I’ll take the easiest way.

Go to the first item in the list, to the total cost cell, and we’ll give it a formula to calculate. Enter @(2,1,0)*@(3,1,0) in that box, and the total is shown for that line.

One small problem though, created mostly because human beings are innately lazy: I’d rather not retype that three times over. I can fill the contents of that cell through the cells below it, but then the formula always points back to that first row of numbers.

So instead of specifying the exact x-y-z location for the formula, I’m just going to give it the x location. If teapot doesn’t find a y or z in the location of the cell, it takes the one where it is at the moment. So instead of the multiplication operation above, edit the cell to show @(3)*@(2) — the x locations only of the data I want to multiply.

Then mark the block for that one cell, move down one cell and use F10, B)lock, F)ill. For the number of column-wise repetitions say 1 — the column we’re in. For row-wise, say 3 — the current cell plus the two below it. For depth-wise say 1 — the layer we’re in.

And voila.

Adjusting the quantity or the price will change the values across the sheet, like all good spreadsheets should.

Just for fun, let’s sort a few columns. Select all of the data rows (but not the grand total), and then hit F10, B)lock, S)ort, R)ow. For the “X position of key vector,” and “Z position of key vector,” enter 0. The A)scending and S)ort region.

We sorted the list alphabetically, by the name of the item (X key vector 0) over one level of “sheets” (Z key vector 0). This could be useful if you need to keep day-to-day spreadsheets of the same information, since it means you can sort vertically over a “date” cell.

Changing it back is simply reversing the same process, but using the X key vector for the “Cost each” column — 3. And don’t forget to use “descending.” πŸ™‚

There’s one more thing that teapot will do that is worth looking at, because it changes how you can use the entire spreadsheet — or the entire idea behind a spreadsheet, really. Try this: Go to the top of the total cost column, press F10 then A)ttributes then L)abel. Now call this “first”.

The status line near the bottom changed, with the label included. Now go to the last in that column, and give that the label “last”.

Now skip down one more line and enter this for the grand total of that column: sum(first,last).

“Okay, great,” you say. “It knows how to sum things, and it can use those labels to do it. So what?”

Well the “so what” part is principle, not action this time. It essentially means you can label, refer to and connect from any cell over the three dimensions of the spreadsheet, and not need coordinates to do it.

You can skew a column of numbers, sum them over a series of cells, insert wide gaping holes in pages, but the labels are what determines how numbers are calculated. teapot takes its labels seriously and allows you to do some cool things with them, and the results are about what you need.

It also means that those text labels we put on the left, or the column headers on the right are completely superfluous now. They’re only there for uninitiated humans to find there way around the page. We could just as easily label cells as “quantity1”, “quantity2” and so forth. Then call the cost cells “cost1”, “cost2” and so on, and just sum the opposite corners of a range.

It’s not a mind-blowing or life-altering idea, but it does mean that formulas and number-crunching become easier to think about, and don’t require you to second-guess because a cell shifted to allow for more data. So long as the labels stay the same, the calculations work the same.

The next obvious question is, “Where can I go with my spreadsheet?” To which, I can say that teapot saves in XDR natively for mathematical precision, and exports to at least four or maybe five others. I see that two of those — CSV and HTML — are something Google documents can open, albeit as word processor pages.

Beyond that, I am not up-to-snuff on what is the file format du jour for spreadsheet programs. I am guessing a modern one can probably handle something teapot exports to.

teapot does a lot of other things; the list of formulas available to you, and the way you can access cells or run counts is very impressive. The source package includes a teapot-driven variation on Conway’s game of life too, so it’s not all serious stuff.

Of course there are quite a lot of things teapot doesn’t do, like export in Excel format or draw exploding pie charts in three dimensions and 64,000 colors. For things like that you will probably want to investigate, bigger, bulkier and slower spreadsheets, built by other people.

But if you want something that will run in a slice of memory thinner than a piece of paper, this is a good choice. It’s fast, light, sensible and flexible and comes with a very good documentation file (check the source package for the doc folder). And while there’s a degree of “mathy-ness” that you can’t get away from, it’s certainly nothing to be afraid of. πŸ˜‰

Still crawling. …

Just a quick note today, and really only to mention that I’ve been absorbed again by Crawl, in its 0.7.1 rendition.

I know it’s not a game for everyone, even if it is a game for everything (meaning, just about anything with a console should be able to run it). Thieves are gone now, along with Death Knights, and there are a lot of other changes afoot as well. (As I understand it, the rationale for both of those subtractions was that there wasn’t any strong delineation between those classes and other, similar professions.)

Save yourself the trouble of installing it by using telnet to play; your games are saved automatically and you don’t have to worry about software updates. This might be as close as I get to the cloud. … 😈

Your lightbox effect still sucks

Why? I’m glad you asked.

Silly me. What was I thinking? That I might be able to read the labels on the diagram? πŸ™„

It isn’t bad enough that I have to put up with that crap just to upload a picture to this site. Add to that the fact that it’s overdone, clichΓ© and a waste of bandwidth.

It was passΓ© four years ago, and it’s definitely not new or innovative. It slows things down, gets in the way, makes it difficult to maneuver and as you can see, defeats its own purpose if the screen dimensions don’t accomodate it.

Oh, and if you trap a login in that lightbox effect, I will officially never use your site, your service or your product, ever ever again, for as long as I live. πŸ‘Ώ