Subject: Re: bash problem
To: None <netbsd-users@netbsd.org>
From: Wenchi Liao <wliao@midway.uchicago.edu>
List: netbsd-users
Date: 01/13/2000 11:17:25
Eric Schnoebelen wrote:
>
>George Sollish writes:
>- On Thu, 13 Jan 2000, Chris Pinnock wrote:
>- > I would personally not use bash for a root shell. This is because it
>- > usually sits in the /usr partition. I want root to be able to run a shell
>- > even if the /usr partition gets corrupted - so I stick with /bin/csh. 
>- > (Actually, the first thing I do as root is usually type exec 
>- > /usr/pkg/bin/bash, but that's another story...)
>- 
>- Good point about the package system installing bash in /usr, but couldn't
>- we bash-users have the best of all possible worlds by moving bash to /bin
>- and, if we're paranoid about space on /, moving one or more of the
>- (unused) default shells back to /usr/pkg?
>	
>	The other half of the problem is that bash is dynamically
>linked, and you don't have the shared libraries when /usr isn't
>mounted.

On the other hand, it isn't too difficult to build various
shells statically linked (ok, tcsh is hard...but bash isn't:
it's a ./configure option).

Another alternative is to jack up the size of the / partition a
little, and start the machine in single user mode. Mount the
partition that holds dynamically linked binary, and run ldd on
it. Note the libraries needed and copy them to /tmp. Making sure
/usr is unmounted, create /usr/lib on the / partition and copy
the libraries in. During normal operation, the /usr partition
gets mounted on top of the /usr mount-point and hides the extra
libs.  During single user mode, the libs in /usr on the /
partition are exposed so all is good.

On a more-or-less stock i386 1.4.1 machine, the biggest commonly
used lib is libc weighing in at less than 500K (it's the so
version). For ssh to work in single user mode w/o mounting /usr
(when I want to securely dump partitions over the network), I
just need an extra 600k on the / partition. Not a bad trade off
for the convenience and security.

>	Good Grief!  I just checked the sizes of the statically
>linked shells, and /bin/sh is _not_ the smallest!  Time to go
>read the sh manpage and see what `features' have been added to

An easier way may be to see what features ksh has but sh
doesn't....

WL

>the NetBSD edition of sh.. (quite a surprise to someone who grew
>up expecting /bin/sh to be pretty much the v7 version..)
>
>--
>Eric Schnoebelen		eric@cirr.com		http://www.cirr.com
>        Friendships are fragile things, and require as much handling as
>	any other fragile and precious thing.  -Randolph S. Bourne
>