Re: Boot hangs in single-user mode

2013-06-24 Thread Andrew Hamilton-Wright

I have tracked down the issue.  Not sure whether this is a PR issue or not...

On 2013-06-06, at 11:18 AM, Polytropon wrote:

 On Thu, 6 Jun 2013 10:24:52 -0300, Andrew Hamilton-Wright wrote:
 
 Strangely, it seems that I cannot boot single user, either
 using boot -s from the boot loader, or using the boot menu. 
 When I get to the point where the root filesystem is mounted,
 it hangs right after printing the message:
 Trying to mount root from ufs:/dev/ada0s1a
 
 Have you tried hitting the RETURN key several times? 

   [ ... ]

 It's important to identify if the system is _really_ hanging,
 or if the message just isn't visible...

This is indeed the crux of the issue.  While hammering on the RETURN key did 
not produce a prompt, it turns out that there was a prompt...

At some time in the relatively distant past, I had configured this machine to 
allow display to a serial console (long since disconnected) by adding these 
lines to /boot/loader.conf 

boot_multicons=YES
boot_serial=YES
comconsole_speed=19200
console=comconsole,vidconsole

My notes say These came from the serial console setup page, and do work for 
vt100, however I did not note exactly which man page they came from, 
unfortunately.  I do not see these lines on syscons(4), sio(4) or dcons(4).

Similar lines are mentioned in the handbook regarding setting up a serial 
console (there is no mention of single-user mode here):
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/serialconsole-setup.html



The issue, as it relates to single-user mode, is essentially this:  if the 
system is configured to boot with multi-console options, then when the single 
user prompt is printed, it is only printed on the second console (which is 
also the only valid source of keyboard input) -- in this case, the configured 
but unattached serial port.


I'm not sure what the best strategy is here.  Having only one console that is 
accepting input for the single-user shell certainly makes sense.  The question 
is, which of potentially several consoles should it be?

IMO, it would be better/clearer if (for i386/amd64 anyway) the console was the 
one associated with the motherboard-based keyboard and video card.  An argument 
here would be that the [CTRL]-[ALT]-[DEL] sequence is still valid when 
associated with this keyboard, so it does seem odd that other input on that 
device is ignored.

I can see arguments for other setups, also, mostly revolving around the why 
would you _have_ another console configured if you didn't need it, so the 
configured console must therefore be the important one -- though the FreeBSD 
user base is certainly willing enough to experiment that I am sure I am not the 
only person who set up multi-console for a fun project.

Perhaps the best strategy would be to add a message printed on all consoles (as 
the rest of the boot information is) just before the prompt is printed (singly) 
to let people know that this is happening?  I'm not sure if a way to 100% 
predict the desired console is possible.


Thoughts?  If figure I will put a PR in, so that at least this is tracked, even 
if we don't change anything.  I will reference this thread in the PR, but if 
anyone has input as to what to suggest, I would appreciate it.  At the very 
least, the handbook should get updated to indicate that this may happen.

Andrew.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Boot hangs in single-user mode

2013-06-19 Thread Andrew Hamilton-Wright

Hi Everyone,

On Thu, 6 Jun 2013 10:24:52 -0300, Andrew Hamilton-Wright wrote:
 
 Strangely, it seems that I cannot boot single user, either
 using boot -s from the boot loader, or using the boot menu. 
 When I get to the point where the root filesystem is mounted,
 it hangs right after printing the message:
 Trying to mount root from ufs:/dev/ada0s1a


There was a bit of a delay getting back to this, as I needed to move the 
internals over to a replacement server in a planned upgrade.

I have left the boot disk in the machine demonstrating this problem with the 
intention of coming back to determine what is going on (mount points to 
now-missing data disks have been removed from /etc/fstab).

In the resulting stripped down system, I have the same behaviour as before -- I 
cannot get to single-user mode, but multi-user is fine.

If in multi-user mode, if I issue kill -TERM 1 to go to single-user mode, I 
would get a single console message:  pflog0:  promiscuous mode disabled, then 
nothing.  While I would expect pflog to shut down in this case, I have now 
disabled everything pf related (I cannot imagine that it would interfere with 
console operation), and now have the situation where kill -TERM 1 simply locks 
the console.

Plugging in a USB device while the console is locked does produce the expected 
dmesg updates, and the system does respond to [CTRL]-[ALT]-[DEL]


I will also add that I can boot to a single-user prompt when booting off of the 
9.1 media via DVD and mounting the root filesystem from the disk.  (This 
motherboard+kernel have never gotten along particularly well with the DVD 
reader/writer in the machine, so mounting the filesystem from the DVD usually 
fails with various atapi based timeouts).

Does anyone have any thoughts on how to further explore this?  As the situation 
was more than mildly annoying, and could certainly have been worse, if this is 
likely to occur for anyone else, I would like to file a PR.

Thanks,
Andrew.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Boot hangs in single-user mode

2013-06-06 Thread Andrew Hamilton-Wright

Strangely, it seems that I cannot boot single user, either using boot -s from 
the boot loader, or using the boot menu.  When I get to the point where the 
root filesystem is mounted, it hangs right after printing the message:
Trying to mount root from ufs:/dev/ada0s1a

Interestingly, there seems to be a bit of a sequence issue, as I have also seen 
the mount message appear before the audio system comes up, so occasionally, the 
last item printed is:
pcm0:  USB audio on uaudio0

If I boot normally, however, I can consistently reach a login prompt.

I suspect that this may be a race condition of some kind, as yesterday I am 
sure I successfully booted to single-user while trying to solve a separate 
problem.


In case the separate problem (failed disk) is relevant, the general situation 
is this:
- four disk machine:  ada0 (/, /usr, /tmp, /var); ada1 (/research -- data 
only), ada2 (/home), ada3 (/data -- also data only)
- the disk ada2 has failed
- in preparing to replace ada2, I have commented out all references to it from 
/etc/fstab

I am rebooting the machine at the moment as I wish to ensure that I know which 
physical disk is ada2, so want to boot the machine without it plugged in.  I 
seem to have trouble booting at all with ada2 missing and ada3 still attached, 
but can boot to multiuser with no problems in either of these two configuration:

- all disks (including the faulty one) plugged in, with ada2 references removed 
from /etc/fstab
- ada2 and ada3 not physically plugged in, and all references to either removed 
from /etc/fstab

Neither combination allows me to boot single-user.


While I can clearly go ahead with my disk replacement, this is not only strange 
and annoying, but potentially problematic.

Has anyone else seen anything like this?  I notice that there are several 
messages (dating back to 2004) in the list indicating 'hang after Trying to 
mount root' or 'hang after sbin_init' (which is the message that will be seen 
when booting single-user in verbose mode).

Thoughts?  Ideas?

Thanks,
Andrew.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Boot hangs in single-user mode

2013-06-06 Thread Polytropon
On Thu, 6 Jun 2013 10:24:52 -0300, Andrew Hamilton-Wright wrote:
 
 Strangely, it seems that I cannot boot single user, either
 using boot -s from the boot loader, or using the boot menu. 
 When I get to the point where the root filesystem is mounted,
 it hangs right after printing the message:
 Trying to mount root from ufs:/dev/ada0s1a

Have you tried hitting the RETURN key several times? I've
seen what you've described once (I think on a FreeBSD 5
system): The prompt

Enter full pathname of shell or RETURN for /bin/sh: _

would not appear, but the system was still responding.
Hitting RETURN made that prompt visible and the SUM shell
prompt was properly displayed.

It's important to identify if the system is _really_ hanging,
or if the message just isn't visible...



 Interestingly, there seems to be a bit of a sequence issue,
 as I have also seen the mount message appear before the audio
 system comes up, so occasionally, the last item printed is:
 pcm0:  USB audio on uaudio0

This seems to indicate that the system is still responding,
i. e., the kernel is up and running. Whenever new hardware
is detected, the kernel will issue a console message.

For example, on my home system the detection of the built-in
USB is sometimes a bit slow, so its messages appear later on
in the booting sequence, _after_ the initial kernel messages
(e. g., during firewall initialisation).



 I suspect that this may be a race condition of some kind, as
 yesterday I am sure I successfully booted to single-user while
 trying to solve a separate problem.

Try some more. :-)



 I am rebooting the machine at the moment as I wish to ensure
 that I know which physical disk is ada2, so want to boot the
 machine without it plugged in.

A suggestion: I tend to keep a tendency to use labels instead
of device names to identify disks. This is handy in case you're
running some kind of RAID configuration or use striping and
mirroring. Mark the disks with numbers and colors, as you prefer
(for example this nomenclature: color = stripe, number = mirror),
to reflect being element of a stripe and being one of the
mirrors of N properties both by the label (software) and the
physical disk (hardware). So you can _directly_ deduct from
a label (for example of a disk that is reported as failing)
like red 2 that the disk is the 2nd mirror disk in the red
stripe, and _which_ physical disk is it? The one with a red 2
on it. :-)





-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Boot hangs in single-user mode

2013-06-06 Thread Andrew Hamilton-Wright

[ Condensation of earlier comments below ]

On 2013-06-06, at 11:18 AM, Polytropon wrote:

 On Thu, 6 Jun 2013 10:24:52 -0300, Andrew Hamilton-Wright wrote:
 
 When I get to the point where the root filesystem is mounted,
 it hangs right after printing the message:
 Trying to mount root from ufs:/dev/ada0s1a
 
 Have you tried hitting the RETURN key several times?
...
 It's important to identify if the system is _really_ hanging,
 or if the message just isn't visible...

I did try that -- I have seen that behaviour before too.  I tried hitting return
a half-dozen times, and have additionally tried waiting (up to 20 min) to
see if it would come back, to no avail.


 Interestingly, there seems to be a bit of a sequence issue,
 as I have also seen the mount message appear before the audio
 system comes up, so occasionally, the last item printed is:
 pcm0:  USB audio on uaudio0
 
 This seems to indicate that the system is still responding,
 i. e., the kernel is up and running. Whenever new hardware
 is detected, the kernel will issue a console message.

That is a good point -- I will try plugging in an external USB device
at this point, and see what happens then.  It certainly appears that
the system is generally running to me, as well.  I should also mention
that the system does respond nicely to [CTRL]-[ALT]-[DEL], which
triggers the expected reboot process.


 I am rebooting the machine at the moment as I wish to ensure
 that I know which physical disk is ada2, so want to boot the
 machine without it plugged in.
 
 A suggestion: I tend to keep a tendency to use labels instead
 of device names to identify disks. This is handy in case you're

This is an excellent idea.  I do follow some variant of this (however
work at a high enough level of paranoia that I want to be able to
perform the did the right drive disappear when I unplugged it
check just to ensure that I wasn't asleep when making up the labels.
;-)


Thanks for the suggestions -- I will keep looking at it, and will try
adding a USB device once this restore eventually completes.

Thanks,
Andrew.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org