mikshaw
Group: Members
Posts: 4856
Joined: July 2004 |
|
Posted: Aug. 03 2005,18:47 |
|
Anything put in this thread (by me anyway) will assume that you have an understanding of the backup/restore process. You may also find that some (or many) posts will not be kept updated anywhere near as well as the DSL distro itself. Some posts may in fact be useless by the time you read them =o) ----------
Set up Multiple Virtual Terminals With Login Prompt
files used in this lesson: /etc/inittab /etc/shadow /opt/bootlocal.sh /.bash_profile /home/dsl/.bash_profile
The default behavior in DSL is to automatically log in user dsl in runlevel 5 and automatically start X. This is something I try to change immediately when setting up a new Linux system. In runlevel 2 you have multiple terminals, but all are already logged in as root. This is also something I care for not at all.
The ideal situation, in my opinion, is what is found by default in many distros: When the boot process completes, you are presented with a login prompt. Press Alt+F# and you're taken to another virtual terminal with another login prompt.
Here's what I did to get this in DSL...
First thing, if you want a login prompt to work, the system will first need to know what password to accept. There are two ways I can think of to do this. One is to set up your passwords before doing anything else, and then backup /etc/shadow. The other is to boot with the "secure" boot option, setting up passwords when prompted each time you boot. The former will give you a quicker boot time, since the passwords will automatically be set up next time you boot. It also may be a bit more secure, as it can't be overridden by the "secure" boot option (unless the restore is disabled at the same time).../etc/shadow is restored *after* the passwords are set manually.
/etc/inittab: change this
Code Sample | 1:12345:respawn:/bin/bash -login >/dev/tty1 2>&1 </dev/tty1 2:234:respawn:/bin/bash -login >/dev/tty2 2>&1 </dev/tty2 3:234:respawn:/bin/bash -login >/dev/tty3 2>&1 </dev/tty3 4:234:respawn:/bin/bash -login >/dev/tty4 2>&1 </dev/tty4 |
to this
Code Sample | 1:12345:respawn:/sbin/getty 38400 tty1 2:2345:respawn:/sbin/getty 38400 tty2 3:2345:respawn:/sbin/getty 38400 tty3 4:2345:respawn:/sbin/getty 38400 tty4 |
The first one respawns only once in runlevel 5 and uses bash, which basically just opens a new shell for the same user (root). The second one adds runlevel 5 to the other lines, and uses getty, so you get a "real" virtual terminal set up to accept an interactive login. Since /etc/inittab is already read during the init process, before myDSL apps and backups are restored, The file will need to be read again before the user logs in. This can be done in /opt/bootlocal.sh:
This rereads the /etc/inittab file so your restored file will work.
/home/dsl/.bash_profile automatically starts X when dsl logs in. You probably won't want this or you will have a new X session started on every terminal you login to (or you'll get errors...not sure which will happen). To fix this, remove the startx command from this file. You will then need to type "startx" in order to start an X session.
/.bash_profile will automatically log in user dsl in runlevel 5 when you log in as root. You probably don't want that either. Remove the lines concerning "su dsl", or simply backup an empty version of this file.
Now you should be presented with 4 virtual terminals when you start DSL. If you want more than 4, simply add more lines to /etc/inittab:
Code Sample | 5:2345:respawn:/sbin/getty 38400 tty5 6:2345:respawn:/sbin/getty 38400 tty6 | If you want fewer, remove lines starting with the last one.
-------------- http://www.tldp.org/LDP/intro-linux/html/index.html
|