Tiny Core Linux
Tiny Core Base => TCB Talk => Topic started by: maro on August 21, 2011, 08:26:39 PM
-
Due to taking a bit closer interest in the use of serial interfaces (http://forum.tinycorelinux.net/index.php/topic,11218.msg58783.html#msg58783) I had the opportunity to read through BusyBox sources (e.g. related to 'inittab', and 'getty') and some more (e.g. this article (http://www.linuxjournal.com/article/3121)).
As a consequence I'd like to suggest to remove '/sbin/rungetty' from the initrd and replace it with a considerably smaller script (e.g. '/sbin/autologin'):
#!/bin/sh
cat /etc/issue
if [ -f /var/log/autologin ] ; then
exec login
else
touch /var/log/autologin
exec login -f root
fi
This would then require a further change in '/etc/inittab' to replace:
tty1::respawn:/sbin/rungetty tty1 --autologin root
with:
tty1::respawn:/sbin/getty -nl /sbin/autologin 38400 tty1
I believe this replicates what 'rungetty' does, i.e. to automatically execute an automated login of user 'root' (which itself continues to execute a login of the default user unless the 'noautologin' boot code was used), and to run a "standard" login process as soon as this initial session is terminated.
One IMHO minor difference is that the hard coded reference of the respective autologin user (i.e. 'root') needed to be moved from the '/etc/inittab' entry into the script (due to limitation of 'getty' to accept more complex arguments for the '-l' option).
I've done some testing (including for the 'ttyS0' case, where both occurrences of 'tty1' in the 'inittab' entry would have to be replaced with 'ttyS0') but obviously I can't promise that this proposal covers absolutely all possible cases, but I'm sure any limitations would become obvious with more exposure.
EDIT: Simplified the script even further by removing the apparently unnecessary assignments of the standard file descriptors.
-
I haven't tested it, but it looks very good.
-
maro, Thanks for sharing. I will look to implement.
-
When I wrote in the OP that I've tested the 'ttyS0' case, I should have been more specific insofar that this involved just an emulated serial interface. I've now managed to set up a proper test with "real" hardware (after creating a null-modem cable with the help of two DE-9 to PS/2 (mouse) adapters).
As it turns out the "real" world is a little bit more fickle: One (rather obvious) lesson learned was that it is quite crucial to use the correct speed parameter from the receiving terminal for the '/etc/inittab' parameter (e.g. '38400 ttyS0'), as well as the boot code (e.g. 'console=ttyS0,38400'). In my case I used as terminal a TC system where I ran (after installation of the 'screen.tcz' extension):
screen -L /dev/ttyS0 38400
The other (more important) finding was that the "real" hardware did not "like" the assignment of the standard file descriptors. As it appears now those are not required, I had it just taken from some code snippets I've come across and accepted the "storyline" which claimed that it would be required.
I've now updated the OP and of course retested the simplified version of the script (via emulation as well as "real" hardware), and I'd like to think that it now "Just Works" for the 'tty1' as well as the 'ttyS0' case.
-
With the assignments removed, would that cause the session to be opened on /dev/console instead of tty1?
If it's still on tty1, ctrl-z (shell job control) will work (and tty should say so).
edit: Tested, and it's not on console.
-
As far as I can tell the session is is not opened on '/dev/console'. At least the output of 'tty' is what one would expect (e.g. '/dev/tty1' or '/dev/ttyS0' respectively). Likewise 'Ctrl-Z' seems to work as well as expected.
EDIT: I only now spotted your addition that you knew that already.
-
you will want to apt-get remove gdm, kdm, xdm, wdm
and apt-get install rungetty afterwards open /etc/inittab and modify this line 1:2345:respawn:/sbin/getty 38400 tty1 to
1:2345:respawn:/sbin/rungetty tty1 --autologin $user
...
That kicks so much ass it's not even funny.
Which OS are you talking about?
-
I'd guess a spambot, with a post copied off U forums or similar...
-
Post looks bogus, removed.