Mingetty and dash

I spend a lot of time poking around after lightweight applications and even more time trimming down custom kernels, so I suppose it makes sense that I should be seeking out other core utilities to make this machine more usable.

bash and agetty are the first two in the crosshairs this time; I suspected one or both could be supplanted and shave a little more memory from the total I incur through day-to-day use.

I was both right and wrong, in a manner of speaking. For substitutes I tried both dash and mingetty, as a shell replacement and as a getty, respectively.

Since it was the python memory script that started this little adventure, here’s what it looks like with dash and mingetty running in Crux.

 Private  +   Shared  =  RAM used	Program 

  0.0 KiB +  10.0 KiB =  10.0 KiB	dhcpcd
  0.0 KiB +  11.0 KiB =  11.0 KiB	startx
  0.0 KiB +  11.0 KiB =  11.0 KiB	mingetty
  0.0 KiB +  12.0 KiB =  12.0 KiB	udevd
  0.0 KiB +  17.5 KiB =  17.5 KiB	xinit
  0.0 KiB +  27.5 KiB =  27.5 KiB	vim
  0.0 KiB +  30.0 KiB =  30.0 KiB	hnb
 40.0 KiB +  11.5 KiB =  51.5 KiB	init
  0.0 KiB +  57.5 KiB =  57.5 KiB	musca
  0.0 KiB +  63.0 KiB =  63.0 KiB	mc
112.0 KiB +  94.0 KiB = 206.0 KiB	centerim
124.0 KiB +  90.0 KiB = 214.0 KiB	dash (5)
288.0 KiB +  69.5 KiB = 357.5 KiB	htop
328.0 KiB +  48.0 KiB = 376.0 KiB	alpine
516.0 KiB + 133.0 KiB = 649.0 KiB	calcurse
  1.0 MiB +  68.0 KiB =   1.1 MiB	Xorg
  1.0 MiB + 109.0 KiB =   1.1 MiB	urxvtd
---------------------------------
                          4.3 MiB
=================================

 Private  +   Shared  =  RAM used	Program

Gasp! Xorg is taking up 1.1MiB this time! I must be doing somthing wrong. … :mrgreen:

mingetty, if you compare it with agetty from last time, is only a teeny improvement in terms of memory footprint. Eleven kilobytes versus 11.5 is nothing to crow about. On the other hand, it was fairly easy to put into place, with only an adjustment to the /etc/inittab file to trigger it instead of agetty.

And since it technically evaporates when the user logs in, I suppose it’s not really getting in the way. On the plus side, it seems a little quicker on the draw; I can’t measure or quantify that though, so I probably shouldn’t even say it.

dash, however, is both a blessing and a curse. As you can see above, it’s considerably smaller than bash, with about 43KiB per instance (roughly calculated) against 185KiB for bash. On a machine with only 16MiB to spare, that’s a considerable sum. And all the more important when 99 percent of the applications are terminal based.

On the other hand, dash is somehow … eccentric, to pick a word that doesn’t sound too loaded. It’s easy enough to install, and I selected it as a shell of choice for both root and the user accounts by way of the usermod -s /bin/dash command. Maybe that was overkill, but it worked right. (I also edited a few scripts to pick dash over bash, just because.)

But there is one feature that I am used to in bash that catches me every time in dash — autocompletion. I smack the tab key as a matter of course almost any time I move a file or start a script, and dash can’t do that (I don’t think :???: ).

So I find that a little grating. dash also has trouble interpreting escape characters and some of the PS1 codes that bash uses, which means my terminal prompt became a messy string. And there’s no history, which is kind of a good thing to me.

Most of all, I found I couldn’t use dash alone, with bash uninstalled. I kept my path variables in place and removed bash, but dash claimed it couldn’t find anything — startx, certain commands, and so forth — even when the prompt was sitting in the same directory. Replacing bash corrected that problem; perhaps there was another way.

I am still only into the first day or so of using either dash or mingetty, and these things take time to figure out. I’ll probably keep them around so long as they don’t become encumbrances or prove somehow less functional.

After all, saving only half of a kilobyte on one, while suffering without autocompletion plus the need to keep around bash on the other … might not warrant keeping them around. :|

About these ads

9 Responses to “Mingetty and dash”


  1. 1 mulenmar 2009/09/03 at 10:04 AM

    Dang, you beat me to it! :mrgreen: I was going to suggest that myself, and blog about it!

    Eh, great minds think alike and all that, I guess. ;)

    Btw, since you’ve mentioned before that you don’t like being forced to use HAL with the newer Xorgs, I thought I’d point out this (long and thorough) discussion by folk who know about 1,000,000x more about it than I do:

    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515214

    I still don’t like how packaging forces me to use HAL by default, but maybe it’s helpful overall. Hmm…well, food for thought for everyone.

  2. 2 juandiego 2009/09/03 at 1:14 PM

    have you tried zsh as shell replacement?

  3. 3 Greg 2009/09/03 at 2:17 PM

    I’m prett sure zsh is heavier than bash, not lighter.

  4. 5 saniette 2009/09/03 at 4:48 PM

    Some of your problems with dash could be solved using rlwrap[1].
    Would cost some extra memory, though.
    Another very minimal shell is heirloom sh[2].
    pdksh, mksh and the like should also be slightly lighter than
    bash while having most of its features.

    [1] http://utopia.knoware.nl/~hlub/uck/rlwrap/
    [2] http://heirloom.sourceforge.net/sh.html

  5. 6 yasen 2009/09/03 at 9:12 PM

    For a _very_ lightweight getty, try ngetty:
    http://riemann.fmi.uni-sofia.bg/ngetty/
    It can run all 6 (or however many you prefer) getty-s in one process, and when built against dietlibc its memory footprint is almost nonexistent :)

    dash is primarily intended as a shell for running shell scripts and not daily usage as far as I know. Living without all of bash’s goodness is going to be a chore. Minimalism is great, but you shouldn’t sacrifice (needed, useful, i-almost-can’t-imagine-how-i-would-live-without-that) functionality in order to obtain it.

  6. 7 damaged justice 2009/09/04 at 9:13 AM

    X has officially jumped the shark, and I’ve jumped ship, at least on my oldest monitor. I won’t bore you with the details, but I spent all day being buggered by the technofetishists who develop that piece of crap. I’m not bending over any more for it. If it won’t work properly with a minimum of fuss, it’s no use to me.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Welcome!



Visit the Wiki!

Some recent desktops


May 6, 2011
Musca 0.9.24 on Crux Linux
150Mhz Pentium 96Mb 8Gb CF
 


May 14, 2011
IceWM 1.2.37 and Arch Linux
L2300 core duo 3Gb 320Gb

Some recent games


Apr. 21, 2011
Oolite on Xubuntu 11.04
L2300 core duo 3Gb 320Gb

Enter your email address to subscribe to this blog and receive notifications of new posts.

Join 405 other followers

License

This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Blog Stats

  • 3,963,317 hits

Archives


Follow

Get every new post delivered to your Inbox.

Join 405 other followers

%d bloggers like this: