Operating System - HP-UX
1833016 Members
2209 Online
110048 Solutions
New Discussion

Checking kernel paramaters

 
SOLVED
Go to solution
Soren Morton
Advisor

Checking kernel paramaters

It looks like changes were made to kmtune on XSWGR54 that don't allow a regular user to view the kernel paramaters. I need to be able to get a list of kernel paramaters and settings using a standard user.

Is anyone familiar with a library or command that can be used as a standard user to get a list of ALL kernel paramaters. I noticed the kc.sl library used by SAM, but have not been able to find information on it's use.
No Egos, No Politics, No Games
12 REPLIES 12
Darrell Allen
Honored Contributor

Re: Checking kernel paramaters

Hi Soren,

Will /usr/sbin/sysdef give you what you need?

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
A. Clay Stephenson
Acclaimed Contributor

Re: Checking kernel paramaters

Hi,

I haven't applied that patch set but is it simply a case of /usr/sbin not being in a regular user's path. i.e. does /usr/sbin/kmtune work?
If it ain't broke, I can fix that.
Soren Morton
Advisor

Re: Checking kernel paramaters

Unfortunately sysdef only gives some paramaters (the ones that have been modified from the default I think).

The problem stems from the fact that kmtune tries to create a lock file in a root owned directory making it impossible for a regular user to run the command successfully.

No Egos, No Politics, No Games
A. Clay Stephenson
Acclaimed Contributor

Re: Checking kernel paramaters

Hi Soren:

I find that if all I want to do is query the kernel, the kmtune runs fine for both 11.0 and 11.11 as a regular user - but I haven't installed your particular patchset. That having been said, a very simple setuid C program which can be compiled with the bundled c compiler will do the trick:

Create a text file sukmtune.c

int main()
{
int cc = 0;

cc = setuid(0);
if (cc == 0)
{
cc = system("/usr/sbin/kmtune");
}
return(cc);
}

Compile it as root: cc sukmtune.c -o sukmtune
chmod 4755 sukmtune

Now a regular user can execute this as root.
If it ain't broke, I can fix that.
Soren Morton
Advisor

Re: Checking kernel paramaters

Due to security policies I can not do a suid program.

I figure since kmtune can get the info without being root (until they implemented this lock mechanism on XSWGR54) there must be a library that will work, I just don't know what it is.
No Egos, No Politics, No Games
Michael Tully
Honored Contributor

Re: Checking kernel paramaters

Hi,

Have a look at the following files. They give
all the information on all the kernel
parameters in the system including the defaults
minimums and maximums. Both of these files
are world-readable.

/var/sam/boot.config
/usr/conf/master.d/core-hpux

HTH
-Michael
Anyone for a Mutiny ?
Soren Morton
Advisor

Re: Checking kernel paramaters

Is the /var/sam/boot.config file updated even if someone uses kmtune and builds the kernel using the command line utilities?
No Egos, No Politics, No Games
Wodisch
Honored Contributor

Re: Checking kernel paramaters

Hello Soren,

in the process of creating/building a new
kernel a file "conf.c" is created and compiled
to be linked into the new kernel.
Hence is DOES contain ALL parameters...

So, all you would need is read-permission
for that file (below "/stand/build").

HTH,
Wodisch
Soren Morton
Advisor

Re: Checking kernel paramaters

For anyone who runs across this I have found a workaround.

echo "?D" | adb -k /stand/vmunix

You have to specify the paramaters you want, but the nice part is that it converts formulas and hex values.
No Egos, No Politics, No Games
linuxfan
Honored Contributor
Solution

Re: Checking kernel paramaters

Hi Soren,

This feature(known as bug) was introduced by the patch PHCO_24112. Installing the superceeding patch PHCO_25342 fixes tthe kmtune problem.

-HTH
Ramesh
They think they know but don't. At least I know I don't know - Socrates
Soren Morton
Advisor

Re: Checking kernel paramaters

Ramesh,

Thanks for the update. I figured it was implemented on purpose (like the change to the sticky bit functionality).
No Egos, No Politics, No Games
Kevin_31
Regular Advisor

Re: Checking kernel paramaters

I checked my sam logfile (/var/sam/log/samlog)
and found the command it uses to build its list of configurable kernel parameters.

I tested this and it doesn't require a root user to run it. Also, it displayed maxusers, which technically isn't a kernel parameter (a variable used to calculate them tho).

the suggestions above which I tried left out maxusers.

Anyway, the command is:

/usr/lbin/sysadm/get_sysfile /stand/vmunix

(send the output of this to a file or grep what you need from it)