Hello everyone,
Thanks for all your responses. I think we found the problem. /etc/profile had had these lines added at the bottom:
if [ $LOGNAME = "root" ]
then
export PS1=$LOGNAME@$(hostname -s)':$PWD:# '
else
export PS1=$LOGNAME@$(hostname -s)':$PWD:$ '
fi
...which uses print:
root@crilnim1 ~]# echo $PS1
$(print -n "[${USER}@${HOST%%.*} ";[[ "$HOME" == "$PWD" ]] && print -n "~" ||([[ "${PWD##*/}" == "" ]] && print -n "/" || print -n "${PWD##*/}");print "]# ")
And, since bash and ksh both read /etc/environment and then /etc/profile there you are. In our case, the prompt was also being set in ~/.kshrc so we just commented these lines out and the print error when starting bash went away.
This does bring up an important point for us which that we have one or two AIX machines which actually have regular shell users (not the machine under discussion above). They use these machines just like Linux. I think the vast majority of them don't even know that it's AIX. They have bash as their default login shell. On one of those machines, we recently put this at the bottom of /etc/profile to effect the right mixed behavior:
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
if [ -f /opt/freeware/etc/bash.bashrc ]; then
. /opt/freeware/etc/bash.bashrc
fi
fi
/opt/freeware/etc/bash.bashrc contains a lot of steps but one of the first things it does is move /opt/freeware/bin and /opt/freeware/sbin to the front of PATH because - if it's bash - then the user is non-root and non-admin in our organization so we're trying to give the most Linux/GNU shell we can. If anyone has ideas on best practices around this topic, I'd love to hear them.
Best,
Mike
------------------------------
Michael Metts
------------------------------
Original Message:
Sent: Fri November 04, 2022 08:55 AM
From: Jan Harris
Subject: bash won't start gives print error and hangs
You can check the sourced files as follows
as root:
# truss -rALL -feado truss.out
Look at the kopen files to see what files are source.
Look for "p r i n t"
for example:
7799008: 23527563: 0.3338: kopen("//.bashrc", O_RDONLY) = 3
7799008: 23527563: 0.3341: fstatx(3, 0x0FFFFFFFFFFFF7B8, 176, 0) = 0
7799008: 23527563: 0.3345: kread(3, 0x000000011008FA30, 24) = 24
7799008: e c h o T E S T\n p r i n t " h e l l o "\n
7799008: 23527563: 0.3348: close(3) = 0
------------------------------
Jan Harris
AIX Development Support (Liaison to the AIX Toolbox for Open Source)
IBM (Contract)
Austin TX
Original Message:
Sent: Thu November 03, 2022 02:41 PM
From: Michael Metts
Subject: bash won't start gives print error and hangs
Hi,
We have an AIX 7.3 NIM server that has the toolkit installed and up to date w/ no errors from `dnf check` and no noteworthy errors from `rpm -Va` ... but as root (this machine only has root), when I try to start bash from root's ksh login shell I get this:
[root@crilnim1 ~]# bash
bash: print: command not found
bash: print: command not found
bash: print: command not found
bash: print: command not found
bash: print: command not found
...and it hangs pretty good. I can't break it with Ctrl-C. I looked trough ~/.profile and /etc/profile for things that might offend and can't find anything. Has anyone ever seen this or has a thought on what might be going on? We have similar AIX 7.3 LPARs that don't exhibit this problem. The thing is that I just then updated openssh and Python3 from MRS, then ran `updtvpkg` etc. Then, clean updates with `dnf update` etc.
So I don't know for sure whether this LPAR was always like this or I just broke it somehow. In any case, any insights would really be appreciated. Thanks.
Mike
------------------------------
Michael Metts
------------------------------