Thu 02 Dec 2010 03:25:09 PM UTC, original submission:
Description of problem:
We are using runlevel and who -r in single user mode.
runlevel returns unknown.
How reproducible:
Every time a RHEL5 system boots into single user mode.
Steps to Reproduce:
boot RHEL5 into single user mode and run runlevel or who -r
Actual results:
runlevel returns unknown
who -r returns nothing.
Expected results:
runlevel returns N S
on investigation runlevel (part of sysV initscripts) relies on
a RUN_LVL (1) entry in /var/run/utmp.
When booting into single user mode using kernel parameters: single at grub boot prompt. /var/run/utmp is not updated with current runlevel. In all other contexts it appears to be.
/etc/rc.sysinit checks and truncates /var/run/utmp.
So to conclude, /var/run/utmp exists but init fails to populate it with RUN_LVL when runlevel == 'S':
void write_utmp_wtmp
( char * user,
char * id,
int pid,
int type,
char * line
)
write_utmp_wtmp("runlevel", "~~", foo + 256*runlevel, RUN_LVL, "~");
|