From Joydeep Bakshi
Answered By: Thomas Adam, Heather Stern, Kapil Hari Paranjape, Jason Creighton
Hi all, I can enter into the interactive mode of Redhat by pressing key i at the time of booting. but this technique doesn't work in Debian . how to get the same thing in Debian ?
Please let me know.
thanks in advanced.
Permit me to make an observation if I may, but this is not the first time that you have tried to emulate RH functionality within Debain. I am all too familiar with RH's "i" startup, and to try and do this in Debian would require a complete re-write of the /etc/init.d/* run-level files, not to mention /etc/iniitab and a complete re-write of "update-rc.d". In short, YOU CAN'T!
Actually, you do it in Debian in a way that works in every single distro that has a sysV-like init sequence (in fact, this would work fro RH, as well) --
Go into runlevel 1 (single user mode)
'sulogin' if needed, but anyways you are at a root prompt.
Walk one at a time through the sequence of commands that would be run on the way to the normal runlevel. This is the number next to "initdefault" in /etc/inittab. In Debian this is, curiously, runlevel 2. Most others use 3 if they mean text mode, 5 if they mean GUI, which are mostly holdovers from Solaris, where runlevels are travelled through, not jumped into. In an untweaked Debian 2 through 5 are all little clones anyway, 2 is just the earilest "normal" runlevel.
Essentially a human traversal of the autoexec sequence. This is much more throough about being interactive than RH's "I" mode, which I suspect skips a few things.
Anyways, I could easily imagine you having hacked the fairly ignored "runlevel 4" to point at a "debug" copy of the /etc/init.d directory, where every script asks if it's okay before running its partner in /etc/init.d. This would not entail hacking inittab (except if you want that the default, annoying behavior) nor update-rc.d (though you would have to USE it once per script flavor to establish that it's not in control of the links in runlevel 4), but whenever a truly new app added something to init.d, you'd need to tweak runlevel 4 to be its proper companion. Hmm, if the "ask if ok" script is generic enough to check its own linkname, it could in fact be only one script. So that's your contribution to the thread, Joydeep, I'd love to see it, and maybe it can be added to the debian system's ordinary utilities.
You could also use runlevel 7, 8, or 9, which are not in the spec for init, but work because it was easier to simply accept numerics than fuss over this minor detail. I believe but would have to test, I don't think update-rc.d gratuitously adds anything to these extra runlevels. BUT BEWARE since they are not normal they also aren't listed among the runlevels that have getty access in /etc/inittab. I'd recommend adding at least one getty console.
[Thomas] My advice is that you cannot have the best of both worlds in this instance. Either you go back to using RH (with apt4rpm) installed or you switch to using Debain and do things the Debain way!
Debian does not require you to do things the debian way, it's just a bunch of planned structure...
Lots of otherwise fanatic debsters use their own kernels, not "the debian way" which is make-kpkg to cook up .deb files, then install those, and let debconf handle lilo. Me, I do way too much dev work on kernels intended for others to allow it to manage my boot sequence. I keep one debian stock kernel as a failsafe and that satisfies "lilo needs kernel-image".
Certainly, one could install any useful distro, then wipe its packaging system out (cleans a lot of space from var) and thereafter ONLY use source from known projects. But this ruins the provided means to get at sources and binary packs optimized for your setup.
[Thomas] Debian handles rc.d files better than any disrto I have used. I'm going to stop with plugging Debian now, in risk of starting a war...
[Jason] Couldn't you just drop a script in /etc/rc4.d (or whatever the right directory is), name it "S00askifok", and have it loop over scripts in /etc/rc2.d/, asking if it's okay to run each one? Or am I missing something?
[Kapil] I am not sure what RH's "interactive" mode does but if it just asks you whether or not to run a script before running it then it is not really all that complicated to do in Debian. All the start-stop scripts are run from /etc/inittab by a master script /etc/init.d/rc which is what you need to edit.
The actual running of the commands is done at the very end of the script after creating a "command-list" called CMDLIST. This list is run by calling "sh -c $CMDLIST". You could either:
1. Modify /etc/init.d/rc to run the CMDLIST differently (and
interactively). (Allows you to see what each script has done before deciding on the next step). or
2. Modify /etc/init.d/rc to create the CMDLIST interactively. (This way you only need "minor" hacking of the script).
Save the changed script as /etc/init.d/rc.RH and change /etc/inittab to use this script instead of /etc/init.d/rc.
You could even make this fancier and make it save the answers as a runlevel of your choosing.
Hope this helps. If you really insist I could try to hack up versions of these scripts.
|Meet the Gang 1 2 3 4 5 6|