Linux Boot Process


Recommended Posts

I was reading this post on an other forum

I need to create a shell script that controls the users runlevel at every startup/logon of the linux system. the user should be prompted with a menu screen taht asks for their desired runlevel. The user should be presented with the following 3 choices:

¤ Single User Mode

¤ Full/Extended Multi-User Mode

¤ Graphical/XII Mode

The user should be "started up" in any one of these modes based on their "numerical" reponse. In addition there are certain runlevels that shouldn't be used. the script should also provide for the condition that the user might "erroneously" respond with these unsafe runlevels. In such cases the script should prevent the system from entering these runlevels & instead give a message like "Invalid Choice, Try Again!"

here is my understaning of the boot process. The first program ran is init. Init first reads /etc/inittab to determine what runlevel to use.

To make this script he wants to work, wouldn't you have to change the whole way the system boots, this seems like a tough thing to do. Wouldn't init have to ignore /etc/inittab, then instaed follow this "shell script" to tell it what runlevel to start. For this to work, would you have to rewrite the init program?

Edited by shanenin
Link to post
Share on other sites

Seems kinda pointless. It's easy to switch runlevels and difficult to imagine why you would want to at every login. But I'm sure you could fiddle with inittab &c and make it work.

Edited by jcl
Link to post
Share on other sites

well, the first program ran is the boot loader.. the person does not need a script.. Grub and LILO can pass init levels to the systems. on Gentoo you can do this with RC http://gentoo-wiki.com/Rc. I have mine with 4 choices.. boot with X11 normal ethernet, boot no ethernet with GUI, boot wireless with GUI, boot no GUI no ethernet (command line)

these all become options in side of GRUB..

here is a good PDF on protecting your linux system from access in single user mode (no user should ever..ever..ever be given single user mode access. )

http://www.elxlinux.com/images/PDFS/grub_thesis-3.pdf

a script would also be easy and ran from your bash.rc file. it would give them a choice of level and then sudo int $.

but that would need work to keep you from being in a endless loop of asking what to do..

add------------------------

or if you start at say init level 4 and put the call to the script in int 4 section of the inittab you would eleminate the possability of looping scripts..

Edited by iccaros
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...