[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ash vs. bash



On Mon, Jul 26, 1999 at 01:37:05AM +0200, Fabien Tassin wrote:
> According to Marco d'Itri:
> > 
> >  >(*) with /bin/sh -> bash, there's no way to obtain a shell if you lose /lib.
> > You will need at least /bin/login too.
> 
> not in single user mode where you only need /sbin/sulogin.

Well, with this method, you need init too, but see below.

> $ file /sbin/sulogin
> /sbin/sulogin: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked (uses shared libs), stripped
> $ ldd /sbin/sulogin
>         libcrypt.so.1 => /lib/libcrypt.so.1 (0x40006000)
>         libc.so.6 => /lib/libc.so.6 (0x40033000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)
> 

Actually, all you need is sash; all other programs are unnecessary if sash
works.  In desperate situations, all you have to do is give init=/(s?)bin/sash
on the kernel bootup parameters.  This tells the kernel to start up sash
as the initial program, instead of init as it would usually do.  It's lousy,
of course, but functional enough to get you out of a jam.

> my /sbin/sh is a static shell (extracted from FreeBSD). I don't like sash
> because a) it's a melange of sh and csh and b) it has only a 1 line prompt.

But the most important thing about sash is not just that it's statically
linked, but that it has builtins for all the basic tools; /bin/sh being
statically linked doesn't help much of ls, cp, mv, ... are all dynamically
linked.

> 
> -- 
> Fabien Tassin -+- fta@oleane.net

-- Nathaniel


Reply to: