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

Booting into single user mode on 11iV1 and 11iV2 (PA-RISC)

 
SOLVED
Go to solution

Booting into single user mode on 11iV1 and 11iV2 (PA-RISC)

Hi,

I want to boot into single user mode on both 11iV1 and 11iV2 (PA). I interrupted the boot process to enter ISL prompt and issued this command:

ISL> hpux -is

The system seems to boot up in single user mode and shows the following msgs:

\----------
| INIT: Overriding default level with level 's'
|
| INIT: SINGLE USER MODE
|
| INIT: Running /sbin/sh
| #
/----------

But at this point if I check the run level using 'who -r', it shows 3.

\----------
| # who -r
| sh: who: not found
| # mount /usr
| # who -r
| . run-level 3 Jun 4 08:43 3 0 S
/----------

Am I missing something here? Shouldn't 'who -r' show run level as 's' or 'S'?

Thanks,
Vivek Srivastava
10 REPLIES 10
Mustafa Gulercan
Respected Contributor

Re: Booting into single user mode on 11iV1 and 11iV2 (PA-RISC)

hi;

after booting you must do
#bcheckrc

regards,
mustafa

Re: Booting into single user mode on 11iV1 and 11iV2 (PA-RISC)

It was a clean shutdown and reboot so bcheckrc would not run any fsck, etc. I anyway did as you suggested but it gave the same result:

\----------
| INIT: Overriding default level with level 's'
|
| INIT: SINGLE USER MODE
|
| INIT: Running /sbin/sh
| # bcheckrc
| /sbin/bcheckrc:
| Checking for LVM volume groups and Activating (if any exist)
| Volume group "/dev/vg00" has been successfully changed.
| vxfs fsck: sanity check: root file system OK (mounted read/write)
| Checking hfs file systems
| /sbin/fsclean: /dev/vg00/lvol1 (mounted) ok
| HFS file systems are OK, not running fsck
| Checking vxfs file systems
| /dev/vg00/lvol8 :
| vxfs fsck: sanity check: /dev/vg00/lvol8 OK
| /dev/vg00/lvol3 :
| vxfs fsck: sanity check: root file system OK (mounted read/write)
| /dev/vg00/lvol4 :
| vxfs fsck: sanity check: /dev/vg00/lvol4 OK
| /dev/vg00/lvol5 :
| vxfs fsck: sanity check: /dev/vg00/lvol5 OK
| /dev/vg00/lvol6 :
| vxfs fsck: sanity check: /dev/vg00/lvol6 OK
| /dev/vg00/lvol7 :
| vxfs fsck: sanity check: /dev/vg00/lvol7 OK
|
| Cleaning /etc/ptmp...
| # who -r
| sh: who: not found
| # mount /usr
| # who -r
| . run-level 3 Jun 5 09:17 3 0 S
/----------

Vivek
Torsten.
Acclaimed Contributor
Solution

Re: Booting into single user mode on 11iV1 and 11iV2 (PA-RISC)

Some testing:

(first in single user mode)

# who -r
. run-level 3 May 30 15:44 3 0 S
# strings /etc/utmp
system boot
run-level 3
...

# init 1

INIT: New run level: 1
...


# who -r
. run-level 1 Jun 6 11:41 1 0 S

# strings /etc/utmp
system boot
run-level 1
...

# ps -ef
...
/usr/sbin/utmpd
...


Some more:

INIT: Overriding default level with level 's'

INIT: SINGLE USER MODE

INIT: Running /sbin/sh
# set
...
INIT_STATE=s <===
...


I would guess the reason is that "who" cannot get the current status when just booted into single user mode.

Anyway, I think you will know if you are in su mode.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Dennis Handly
Acclaimed Contributor

Re: Booting into single user mode on 11iV1 and 11iV2 (PA-RISC)

>Shouldn't 'who -r' show run level as 's' or 'S'?

One would think so but perhaps the entry isn't there in single use mode?

In any case, can you copy the /var/adm/wtmps in case it gets changed later.
In single user mode you could try:
/usr/sbin/acct/fwtmp -X < /var/adm/wtmps

And look at the end for:
system boot 0 2 0000 0000 1203631070 0 DATE 0
run-level 3 0 1 0063 0123 1203631070 0 DATE 0

Or you can get to user mode and do this on the copy.

I guess I should have used google first:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=217851
/sbin/getrunlvl

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=50401
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1179305
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=95011
Avinash20
Honored Contributor

Re: Booting into single user mode on 11iV1 and 11iV2 (PA-RISC)

I believe you have to rely on the following message

----------
| INIT: Overriding default level with level 's'
|
| INIT: SINGLE USER MODE <<<===
|
| INIT: Running /sbin/sh
| #
/----------


http://docs.hp.com/en/A5201-96044/apas02.html#aes-npar-329
"Light travels faster than sound. That's why some people appear bright until you hear them speak."

Re: Booting into single user mode on 11iV1 and 11iV2 (PA-RISC)

Thanks for those links, Dennis. Yup, I think I should've googled a little more to become aware of the getrunlvl command and the behavior of 'who -r' in single user mode. Bill Hassell has posted some good comments about it. (In one of the posts, he mentions that shutdown 0 is not the same as booting into single user mode using hpux -is, and this was a good thing to know because I had myself seen a few differences between the two. Especially, /stand is mounted when using 'hpux -is' but it is not mounted when using 'shutdown'.)

Coming back to my question. Even the getrunlvl command shows the run level as 3 in single user mode (on 11iV1, didn't try on V2):

\----------
| INIT: Overriding default level with level 's'
|
| INIT: SINGLE USER MODE
|
| INIT: Running /sbin/sh
| # getrunlvl
| New_level 3 Old_level S
/----------

The underlying issue that brought me to this 'who -r' question was that I was using getutid() from a C program to figure out the run level and it was returning 3 in single user mode. I then decided to check out what 'who -r' was doing to get the run level which is when I got stuck.

About the suggestion of using fwtmp:

\----------
| In any case, can you copy the /var/adm/wtmps in case it gets changed later.
| In single user mode you could try:
| /usr/sbin/acct/fwtmp -X < /var/adm/wtmps
|
| And look at the end for:
| system boot 0 2 0000 0000 1203631070 0 DATE 0
| run-level 3 0 1 0063 0123 1203631070 0 DATE 0
/----------

I haven't tried it out, but even if it were to work, it'll need /usr to be mounted in single user mode.

Any more tricks to figure this thing out, especially from a C program?

Thanks,
Vivek
Torsten.
Acclaimed Contributor

Re: Booting into single user mode on 11iV1 and 11iV2 (PA-RISC)

Did you see my comment and the status of the

INIT_STATE

variable?

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Dennis Handly
Acclaimed Contributor

Re: Booting into single user mode on 11iV1 and 11iV2 (PA-RISC)

>it'll need /usr to be mounted in single user mode.

Ah, you just copy /etc/utmp instead. Then check it when in user mode.
/usr/sbin/acct/fwtmp < utmp_copy

>I then decided to check out what 'who -r' was doing to get the run level

It probably just calls getutent(3).

Re: Booting into single user mode on 11iV1 and 11iV2 (PA-RISC)

> @Torsten:
> Did you see my comment and the status of
> the INIT_STATE variable?

I did that now and yes, INIT_STATE is indeed set to 's' (checked on 11.23PA) in single user mode. The good thing is that it is set both when using 'hpux -is' as well as 'shutdown'. Looks like this could solve my problem. I just hope if works fine on all the platforms that we work on (11.00, 11.11, 11.23 PA/IA).

> @Dennis Handly:
> Ah, you just copy /etc/utmp instead. Then
> check it when in user mode.
> /usr/sbin/acct/fwtmp < utmp_copy

Uhh, I still didn't get you. In single user mode /usr won't be mounted (assuming it's a separate partition). So how would I run /usr/sbin/acct/fwtmp? Since I want to check for single user mode from inside a C program, fsck/mount are out of question.

Thanks,
Vivek
Dennis Handly
Acclaimed Contributor

Re: Booting into single user mode on 11iV1 and 11iV2 (PA-RISC)

>> you just copy /etc/utmp instead. Then check it when in user mode.

>In single user mode /usr won't be mounted (assuming it's a separate partition). So how would I run /usr/sbin/acct/fwtmp?

You copy /etc/utmp while in single user mode. Then when you have the system up, you use fwtmp to see if the info is even in utmp. If not there, no need to pursue this.

>Since I want to check for single user mode from inside a C program

You won't be able to do this on IPF. No user C programs will work in single user mode since libc.a no longer exists.