I know that we're supposed to treat the VIO server like an appliance. We're supposed to set it up and let it run. But in this instance, we were still in the middle of setup. We were mapping LUNs to different vhost adapters for different clients, and we were going into oem_setup_env to install additional drivers.
Often I see customers set up their .profile with things like set –o vi, or customize their prompts with things like the user ID they're logged in with, their current working directory, their hostname, etc.
While you can certainly make changes to the /home/padmin/.profile file, they will usually go away whenever you upgrade your VIO server. That's fine; since we're supposed to treat it like an appliance, I understand that we shouldn't change things. In reality though, I continually find customers who alter the padmin .profile.
Even when customers change the .profile, those changes don't carry over when running the oem_setup_env command. For the sake of usability, something had to give in this case. Whenever we ran the oem_setup_env command, we had to run manually run /.profile. This customer was getting fed up.
After asking around for a more elegant solution, someone reminded me to just use a .kshrc file.
I was told to create a /home/padmin/.kshrc file. I put set –o vi and my other desired prompt settings into that file. Then at the end of the /home/padmin/.profile, I added:
export ENV=/home/padmin/.kshrc
This allowed the customer's desired environment to be set up automatically when he logged in as padmin. Then when he switched over to root by running the oem_setup_env command, that was set up as he wanted it.
Yes, I realize that .profile and .kshrc will have to be revisited when this customer upgrades his VIO server. But in the meantime, this technique allowed us to customize the environment to his liking. It helped me keep a customer happy. Maybe it will make you happy as well.





It did!!... it made me very happy!!!... since I spent a lot of time deploying solutions using many VIOS for many IBM customers...
Thanks a lot!
Posted by: Alfonso Jara | October 13, 2009 at 10:05 AM
Maybe I am a naughty admin but I enabled root login and augmented the root .profile with the contents of the padmin .profile and my preferred customizations (PS1 and set -o vi). I can now ssh to root run ioscli commands as root and never login as padmin. I hope the VIO Police don't get me.
Posted by: Caleb | October 27, 2009 at 01:29 PM
I also like to add an alias called 'aix' for the lengthy command oem_setup_env - I run the command 'aix' and it's much faster to type.
I add this line to /home/padmin/.profile
alias aix="oem_setup_env"
I suppose you could add it in .kshrc instead.
Posted by: Anthony English | November 03, 2009 at 04:04 AM
If it is just 'set -o vi', then another option is to add EDITOR=vi to /etc/environment.
Posted by: Dave | November 16, 2009 at 02:07 PM
Nice!
I put oem_setup_env in the profile also:
.profile:
export ENV=/home/padmin/.kshrc
oem_setup_env
and in .kshrc:
PS1="VIO3 # "
set -o vi
export PATH=$PATH:/usr/ios/cli
alias psef='ps -ef | grep -i $1'
alias backup="ioscli backup"
alias restore="ioscli restore"
alias chbdsp="ioscli chbdsp"
Now after logging in as padmin, I'm placed into oem_setup_env and can run everything as root.
Posted by: Paul Clifton | December 08, 2009 at 10:53 AM
I am happy with the following settings for user padmin. root will inherit the setting so nothing has to be configured for root. Of course you can extend the "id" logic to create special parts for the user root.
Steps:
switch to root and extend the padmin .profile
oem_setup_env
echo '. $HOME/.profile.padmin' >> /home/padmin/.profile
exit
#Create padmin profile. Survives updates ??
cat ./profile.padmin
#### root/padmin base settings on VIO servers
## EXPORTS ##
# PATH
export PATH=$PATH
export ENV=$HOME/.kshrc
# get the machine for the prompt
export NODE=$(hostname )
# ignore CRTL-D when in login shell
set -o ignoreeof
set -o emacs
**** Create .kshrc for padmin
cat .kshrc
# Prompt
# set a prompt that shows the return code of the last command,
# the machine name, the current directory and the command history count
if id >/dev/null 2>&1 ; then
export USER=root
else
export USER=$LOGNAME
fi
export PS1='($?)$USER@$NODE:$PWD
!$ '
# Extend alias list
alias aix="oem_setup_env"
Logout and login again and you should see something like:
(0)padmin@vios010:/home/padmin
cheers and thx to the former poster
Hajo
Posted by: Hajo Ehlers | January 28, 2010 at 03:47 AM
It's good to know whether you're logged in in the padmin restricted shell or the full root access via oem_setup_env.
Mark Chandler from Sydney has a post on this in his new AIXplode blog.
http://bit.ly/d7WpQU
Posted by: Anthony English | August 27, 2010 at 09:05 PM
I have been working with this as well and what I have done is to just setup PS1, PS2 and PS3 varibles in padmin's .kshrc file (although) you could probably also set it up in /etc/profile so that it is the default ones used, ( VIOS updates will overwrite the .profile used by padmin, question is will it also over write /etc/profile. I also add EDITOR=vi to /etc/environment file so that I don't have to run set -o vi or place it in the .kshrc file. Another note at least with VIOS 2.2 having variables that are set by running a command need to have full path set or it will return errors.
Posted by: Joe Ryals | July 27, 2011 at 12:53 PM
Hello Friends,
I am Amey working on AIX technology,
I am working on VIO Server restoration.
I have setup like,
VIO server running 1.5.2.1 managed by HMC.
I want to restore VIO server with VIO Clients on another P series frame which is also managed by another HMC.
I have gone through the Redbook, but did not get clear process.
Could any one help me on this, Plsssss
Thank You in advcance :)
Posted by: Amey | September 24, 2011 at 02:04 PM
A quick way to access oem_setup_env is to type :
r o
as padmin, which will recall the last command beginning by a o
Of course, will not work if the command is not oem_setup_env, but this is usually the case :)
Posted by: Johann | April 25, 2012 at 03:09 AM
Hi Rob,
Need information regarding APAR implementation on VIOS .
when i use oem_setup_env
i will get the root prompt and my AIX level would be aix 6100-04 TL. It has a sendmail apar which needs to be fixed and ftp vulnerability , if a run LSSECFIX on it . My question is 6100-04 TL is already support scope stoped . How we can get the apar fixed for this vios , is their any work around , or do we have to update the AIX version to the latest TL on the VIOS , even if we upgrade the VIOS to the latest LEVEL . Still the UNDERLYING AIX version won't get update to the latest AIX version. So how to UPDATE the PENDING APARS for those VIOS server in which AIX level not supported by IBM
$ioslevel
2.2.0.10-FP-24
But AIX level is 6100-04 (IBM stopped supporting this version)
Kindly advice APAR update on the mentioned level . (Best practice to implement APAR , since we need to become root to implement the APAR . And we are facing this issue like AIX level is out of support ) Kindly ADVICE.
Posted by: srininvasa | December 16, 2012 at 12:08 AM