1836867 Members
2995 Online
110110 Solutions
New Discussion

Re: Bash on HPUX 11i

 
SOLVED
Go to solution
Jorgen Lassen
Occasional Advisor

Bash on HPUX 11i

Hello there,

I have a small problem.

I have installed the Bash 2.04 depot on my hpux 11i, and the installation went fine with no errors, but I can't seem to "chsh" to the new shell.

The reply from ux11i is, that the shell is invalid.

Anyone have an idea what's wrong ?

Sorry to say, but i'm new to UX11i.

Thanks in advance

J??nne
Failure is not an option, it comes standard with all Microsoft products.
20 REPLIES 20
harry d brown jr
Honored Contributor

Re: Bash on HPUX 11i

Check your /etc/shells file.

live free or die
harry
Live Free or Die
David Burgess
Esteemed Contributor

Re: Bash on HPUX 11i

Add it to /etc/shells

Dave.
Jorgen Lassen
Occasional Advisor

Re: Bash on HPUX 11i

Hi again !

There is no /etc/shells file !!

Can I make one myself or.....??
And what path ?
Failure is not an option, it comes standard with all Microsoft products.
harry d brown jr
Honored Contributor

Re: Bash on HPUX 11i

Sure, you can create it. Do a man on shells. Here is a sample:

#------------------------------------------------------------------------
/bin/sh
/bin/csh
/bin/ksh
/bin/rksh
/bin/rsh
/bin/pam
/bin/false
/sbin/sh
/usr/bin/ksh
/usr/bin/sh
/usr/local/bin/bash
#------------------------------- End shells -----------------------------


live free or die
harry
Live Free or Die
David Burgess
Esteemed Contributor

Re: Bash on HPUX 11i

Create it and add entries to it for all valid shells on your system. Make sure you include the full path to each.

See man shells :-

/etc/shells is an ASCII file containing a list of legal shells on the system. Each shell is listed in the file by its absolute path name.

Lines or portions of lines beginning with # are assumed to be comments and are ignored. Blank lines are also ignored.

HTH

Dave.
Wodisch
Honored Contributor

Re: Bash on HPUX 11i

Hi,

just be careful NOT to use that shell for user "root"!
The reason is that it needs to be stored in the root-filesystem AND to be linked *statically* to be permitted for "root"!
Usually shells are linked dynamically and stored below "/usr" or "/opt" and hence NOT available at boot-time!

Just a reminder,
Wodisch
Jorgen Lassen
Occasional Advisor

Re: Bash on HPUX 11i

Hi !


Thanks to you all, your replies did help me, and I will be given you point this day !

Unfortunately the reply from Wodisch came about 1 hour too late, I had already changed the shell for Root.

Now - How do I get back ? I can't login neither on console or anything anymore !

I have tried to boot in single mode, that won't help either !

Failure is not an option, it comes standard with all Microsoft products.
Niraj Kumar Verma
Trusted Contributor

Re: Bash on HPUX 11i

Hi,

DO you have remsh access from any of other servers in your network. I mean if you have setup .rhosts and hosts.equiv.

then logon as root to the other server from where you have access and type

# remsh server_name "cp /etc/passwd /etc/passwd.back"


# remsh server "echo "root::0:3::/users/root:/usr/bin/ksh" >/etc/passwd"

now you can try login in.

(::) Another guess

Try ftping the /etc/passwd file.

--Niraj
Niraj.Verma@philips.com
David Burgess
Esteemed Contributor

Re: Bash on HPUX 11i

You can't use /usr/bin/ksh as roots shell. /usr is again a separate file system and is not mounted in sungle user mode.
You need to use /sbin/sh as it's part of root!

HTH

Dave.
Marc Dijkstra
Trusted Contributor

Re: Bash on HPUX 11i

do not use the echo "*line to be added*" > /etc/passwd as it will wipe the contents! Use a >> to append, not redirect. However, I think that root has to be first in the /etc/passwd file.

If you do not have remsh access:

You can boot off the support CD (if you have it) and use ed -- although ed is a bit confusing to a newbie.

Otherwise (on support CD), as stated above, copy /etc/passwd to /etc/passwd.bak. more the /etc/passwd file and count how many lines there are under root, then do the echo "root::0:3::/:/sbin/sh" >/etc/passwd, which will OVERWRITE the contents with just that line.
After you have done this, then tail -n (number of lines under roots entry in /etc/passwd.bak)/etc/passwd.bak >> /etc/passwd, for example if your /etc/passwd file is 23 lines long, and there are 22 entries OTHER THAN root, then the command would be:

tail -n 22 /etc/passwd.bak >>/etc/passwd

Please make sure you use /sbin/sh for the shell.

MND
"A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila"
Niraj Kumar Verma
Trusted Contributor

Re: Bash on HPUX 11i

Hi Marc,

I thingk there is no problem in using ">" as my first
cp command will make a copy of the password file.

Now if you use ">>" append then there will be two entres of root login. Instead of that
you can have any other login name with UID=0,

I hope that will do.

-Niraj
Niraj.Verma@philips.com
Bill Hassell
Honored Contributor

Re: Bash on HPUX 11i

As mentioned, do *NOT* use any other shell for root in the password file except /sbin/sh. This is *NOT* the Bourne shell--HP used the sh name but it is really a POSIX shell, just like ksh and bash. The 'real' Bourne shell is found in /usr/old/bin/sh.

As with all flavors of Unix, root should be left in it's default state and never used as a general login, just used for system maintenance. If you really want ksh or bash, you can type that command after you login. However, most users that want bash are looking for the command recall capability found in POSIX shells. So rather than change shells, just enable it in /etc/profile:

export HISTFILE=$HOME/.sh_history

This sets up the shell history for all users running POSIX shells like ksh, bash and HP's /usr/bin/sh.


Bill Hassell, sysadmin
Jorgen Lassen
Occasional Advisor

Re: Bash on HPUX 11i

Hello again !

I am sorry to keep bothering all you masters, but as I implied in my first message, i'm new to HPUX.

I can't seem to get the bash working, regardless of which user I assign the new shell to. I have tried to edit /etc/passwd with SAM and vi, but nothing works.

When I do a su to a user where I have assigned bash as shell, the system replies with: # no shell
If I switch back to /sbin/sh (POSIX) and then do a su I can login, and I can change the shell without any error, but a echo $SHELL
still tells me that the shell is /sbin/sh.

My /etc/shells file contains 2 shells:

*--------------------------
/sbin/sh
/usr/local/bin/bash
*--------------------------
Which group should default user be a member of ? Or does this not make any difference ?
The bash file looks like this with command
ls -l:

-rwxr-xr-x 1 bin bin 4235780 May 23 2001 bash


I have tried to use Bills reply about history, that won't work either.

By now I don't now what to do anymore !!!

thanks,

J??nne
Failure is not an option, it comes standard with all Microsoft products.
James R. Ferguson
Acclaimed Contributor

Re: Bash on HPUX 11i

Hi:

Make sure of several things:

First, /etc/shells should not only contain the full name to the 'bash' shell, but all of the standard shells:

/sbin/sh
/usr/bin/sh
/usr/bin/rsh
/usr/bin/ksh
/usr/bin/rksh
/usr/bin/csh
/usr/bin/keysh
/usr/local/bin/bash # <--- your addition

Next, make sure that you have provided read and execute permissions to the directory and subdirectories in the path '/usr/local/bin'.

BTW, remove the write permission from the 'bash' executable -- you don't need it!

Make sure that you specify the absolute name of the shell in '/etc/passwd'. If you have used '/usr/local/bin/bash', make sure that that is specified in /etc/passwd for the appropriate user (but, NEVER root, as you have learned).

Regards!

...JRF...
Bill Hassell
Honored Contributor
Solution

Re: Bash on HPUX 11i

It sounds like you are running on a workstation, or worse, running on a PC and by using an Xwindow emulator, managing your desktop with CDE and your login is actually a dtterm window and not telnet. (this is implied by the fact that HISTFILE=... does not work.

The reason (lost in the strangeness of Xwindows) is that dtterm (and Xterm and HPTERM windows do not login normally--they bypass *all* of the startup profiles. To get 'normal' Unix behavior, create a file in your $HOME directory called: $HOME/Xdefaults
and put these lines in it:

echo "*loginShell: true" >> $HOME/.Xdefaults

I specifically used >> to append to your current .Xdefaults file (but likely there isn't one). This file is sort of like .profile only for Xwindows. What it does is to set certain Xwindow default values. For example, the contents might look like this:

*loginShell: true
HPterm*scrollBar: true
HPterm*saveLines: 10s
HPterm*background: navy
HPterm*foreground: white
Xterm*background: darkslateblue
Xterm*foreground: white
Xterm*saveLines: 10s
Xterm*scrollBar: true
Dtterm*saveLines: 10s
Dtterm*scrollBar: true

and after adding these lines to .Xdefaults, all hpterm, xterm and dtterm windows will have a scroll bar plus 10 screens (800 lines) of history. hpterm will have a dark blue with white letter color scheme while xterm will have a more gray-blue background with white letters. dtterm will match the overall CDE color scheme. Be sure you logout completely from CDE and login again. Now, when you start a terminal window, it should show the copyright message and other things in /etc/profile.

Use the command:

echo $HISTFILE

to see that /etc/profile was executed.

Another check:

find /usr/local -type d -exec ls -l {} \;

This should show all directories as 755 or drwxr-xr-x (and not 777 or drwxrwxrwx). If the directories are wrong, fix them immediately as the /usr/local directories can be corrupted or removed by any user.

Also check that the command:

/usr/local/bin/bash

actually starts bash. Verify that bash is in your $PATH with the command:

type bash

(/etc/PATH usually has /usr/local/bin left out of $PATH because of the bad permissions found in standard installs)

Once HISTFILE gets set when you login, the command line history will start working for /sbin/sh (and bash too).


Bill Hassell, sysadmin
Jorgen Lassen
Occasional Advisor

Re: Bash on HPUX 11i

Hi:

So I got the history working (If only with ESC h,j,k,l keys), but it works - thanks Bill.

But my bash is still not working. It is in the $PATH, where it should be.
When I run /usr/local/bin/bash, it replies with "execute permission denied". WHY ??
An ll on /usr/local/bin looks like this:

-r-xr-xr-x 1 bin bin 4235780 May 23 2001 bash
-r-xr-xr-x 1 bin bin 4907 May 23 2001 bashbug

so what can be wrong ?

I can assign it to a user,but when I do a su it replies : no shell.

ps. I am running on a HP9000 server but using Exceed to communicate.
Failure is not an option, it comes standard with all Microsoft products.
Ron D.
Frequent Advisor

Re: Bash on HPUX 11i

I am having the same problems and have searched extensively for a solution both here and through Google.

I have the bash shell installed and /etc/shells is correct. The bash shell was installed to '/usr/local/bin'. When I attempt to execute the shell directly (/usr/local/bin/bash) I get the error "/sbin/sh: /usr/local/bin/bash: Execute permission denied." permissions on bash have been changed to 777 with no luck. Permissions on the directory path to, and including, bin, are all set to 777

After changing a test user to utilize /usr/local/bin/bash as it's shell, issuing 'su ' gives the error "su: no shell".

I checked all previous recommendations in this thread including permissions, as mentioned above, with no luck.

I have tested this using Reflection X and the default windows 2000 "telnet" character-based utility with the same results.

Any help or additional recommendations would be greatly appreciated.
Ron D.
Frequent Advisor

Re: Bash on HPUX 11i

I was able to get the issue resolved with bash by installing the dependency modules gettext,libiconv, and readline.

Unfortunately, I was only able to find refernece to these in messages here on ITRC and in the install readme files that are part of the source download.
Joe Oaks
New Member

Re: Bash on HPUX 11i

I recently had to install 11i, when I was on 11.0 I had no problems running bash.

I have HPUXBase64 B.11.11 with BUNDLE11i B.11.11.0102.2
I have read the entire thread and still have not been able to get bash to work.
I have it added to my /etc/shells file, and working with the current versions of
bash 2.05b
libiconv 1.8
gettext 0.11.5
readline 4.1.2001-06-12

I still get the following error "sh: bash: Execute permission denied. "

Please help me with this.

Joe
Michael Szymanski
New Member

Re: Bash on HPUX 11i

I am experiencing the same problem (execute permission denied for bash). I just ran the "file" command on /usr/local/bin/bash and here is the output: "bash: ELF-32 exectuable object file - IA64". I am assuming this means it has been compiled for an Itanium system, and not PA-RISC. This is probably your (our) issue.

Mike