Discussion:
Init single and Serial console : How to ?
Paul Rolland
2004-07-04 05:09:39 UTC
Permalink
Hello,

I'm trying to activate a serial console on a Linux 2.4.20 (OK, this is not
the
most recent one, but this is the one I'm running).

Configuration is quite simple : at the LILO prompt, I key in :
LILO: linux console=ttyS0 -s

This is supposed to start Linux, and have the console on ttyS0.

The problem is that the bash prompt ends on the monitor, not on the serial
port.

I've read about the :

ioctlsave is a small utility to create the Linux SysV init file
/etc/ioctl.save from a multiple user run level rather than from single
user mode. /etc/ioctl.save contains the terminal settings to be used in
single user mode. Users of terminals or modems which cannot be
configured to operate at 9600bps (and thus set ioctl.save using the
standard mechanism) will find this utility useful.

but, the problem is that this operation is only possible if you can have
access to the machine (to run the ioctlsave utility).

When you have a remote machine, for which you have a serial access at boot
time, but which is not completed its "go to runlevel 3" boot to give you
a serial console, how is it possible to force it to give you a prompt on
the serial port in single mode ?

Regards,
Paul
Milton Miller
2004-07-04 06:07:22 UTC
Permalink
Post by Paul Rolland
LILO: linux console=ttyS0 -s
...
Post by Paul Rolland
The problem is that the bash prompt ends on the monitor, not on the
serial
port.
...
Post by Paul Rolland
When you have a remote machine, for which you have a serial access at
boot
time, but which is not completed its "go to runlevel 3" boot to give
you
a serial console, how is it possible to force it to give you a prompt
on
the serial port in single mode ?
Not quite single mode, but what I have done in similar situations is
boot with
console=ttyS0 init=/bin/sh

which will give a shell on /dev/console before any init scripts have
run. At
this point mount -o remount,rw / and edit the inittab (you might need
to mount
/usr depending on your configuration). To get back, unmount the
filesystems,
remount root read-only, and either reboot or (from the first shell)
exec /sbin/init -s to follow the normal bootup to single mode (Be sure
you
remounted root ro in this case or your init scripts will likely fail).
Paul Rolland
2004-07-04 08:44:12 UTC
Permalink
Hi Milton,
Post by Milton Miller
Not quite single mode, but what I have done in similar situations is
boot with
console=ttyS0 init=/bin/sh
Should do the trick. Single mode was good because it was not running
rl 3 init-scripts.
Not running any of them is good too :-)
The trick was to have the serial console/shell without having to
go thru the ioctlsave stuff.


Regards,
Paul
Bernd Eckenfels
2004-07-04 10:09:04 UTC
Permalink
Post by Paul Rolland
ioctlsave is a small utility to create the Linux SysV init file
/etc/ioctl.save from a multiple user run level rather than from single
user mode. /etc/ioctl.save contains the terminal settings to be used in
single user mode.
this is only about terminal settings like flags and line speed, it is not
related to presenting the login on the serial console. It is a good idea to
remove this file and set the baud rate on the boot command line.

You must configure /sbin/sulogin which is called from init to run on
/dev/console, then you will be fine. Also you should start a getty on
/dev/ttySx for multi user modes (see the serial console howto)

Greetings
Bernd
--
eckes privat - http://www.eckes.org/
Project Freefire - http://www.freefire.org/
Paul Rolland
2004-07-04 10:32:24 UTC
Permalink
Hello,
Post by Bernd Eckenfels
this is only about terminal settings like flags and line
speed, it is not
related to presenting the login on the serial console. It is
a good idea to
remove this file and set the baud rate on the boot command line.
OK.
Post by Bernd Eckenfels
You must configure /sbin/sulogin which is called from init to run on
/dev/console, then you will be fine. Also you should start a getty on
OK, but remember that my problem is to find a way to access the machine
when I only have a serial console and it doesn't complete the "classical"
boot process because some init script at runlevel 3 is blocking...

This means that I can't go up to the "configure /sbin/sulogin", and need
a way to be given a serial prompt only by giving parameter at the LILO
prompt, considering that the kernel has already been configured for serial
console.
Post by Bernd Eckenfels
/dev/ttySx for multi user modes (see the serial console howto)
This is already done.

Regards,
Paul
Paul Rolland
2004-07-08 05:32:45 UTC
Permalink
Hello,

Got this one working :

LILO: linux init=3D/sbin/sulogin /dev/ttyS0

It finally asked me to enter root password, I did my maintenance,=20
and then...
/sbin/reboot did nothing
leaving the shell (exit) said :
Attempting to kill init
Panic, will reboot in 30 seconds.
(or something like that), but it didn't restart, and I had to reboot
the machine...
Is this the expected behaviour ?

Regards,
Paul

Paul Rolland, rol(at)as2917.net
ex-AS2917 Network administrator and Peering Coordinator

--

Please no HTML, I'm not a browser - Pas d'HTML, je ne suis pas un navig=
ateur

"Some people dream of success... while others wake up and work hard at =
it"=20

=20
-----Message d'origine-----
d
Envoy=E9 : dimanche 4 juillet 2004 12:32
Objet : Re: Init single and Serial console : How to ?
=20
Hello,
=20
this is only about terminal settings like flags and line=20
speed, it is not
related to presenting the login on the serial console. It is=20
a good idea to
remove this file and set the baud rate on the boot command line.
OK.
=20
You must configure /sbin/sulogin which is called from init to run o=
n
/dev/console, then you will be fine. Also you should start=20
a getty on
OK, but remember that my problem is to find a way to access=20
the machine
when I only have a serial console and it doesn't complete the=20
"classical"
boot process because some init script at runlevel 3 is blocking...
=20
This means that I can't go up to the "configure=20
/sbin/sulogin", and need
a way to be given a serial prompt only by giving parameter at the LIL=
O
prompt, considering that the kernel has already been=20
configured for serial
console.
=20
/dev/ttySx for multi user modes (see the serial console howto)
This is already done.
=20
Regards,
Paul
=20
-
To unsubscribe from this list: send the line "unsubscribe=20
linux-kernel" in
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
=20
=20
Russell King
2004-07-08 07:44:19 UTC
Permalink
LILO: linux init=/sbin/sulogin /dev/ttyS0
It finally asked me to enter root password, I did my maintenance,
and then...
/sbin/reboot did nothing
Attempting to kill init
Panic, will reboot in 30 seconds.
(or something like that), but it didn't restart, and I had to reboot
the machine...
Is this the expected behaviour ?
Yes, since you exited the process which was pretending to be the init
program. Basically, whatever program is pretending to be init must
never exit or be killed off - it's special.

You probably wanted to do /sbin/reboot -f
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
Paul Rolland
2004-07-09 06:28:29 UTC
Permalink
Hello,
Post by Russell King
Yes, since you exited the process which was pretending to be the init
program. Basically, whatever program is pretending to be init must
never exit or be killed off - it's special.
You probably wanted to do /sbin/reboot -f
Should have turn my tongue in my mouth, and removes my gloves before
touching the keyboard :)

Yes, that's exactly what was happening, and reboot -f is the way to
restart correctly the machine.

Thanks for fixing me,
Regards,
Paul

Continue reading on narkive:
Loading...