[CentOS] Xen, Amazon, and /proc/cmdline

Kurt Newman knewman at globaldataguard.com
Tue Jan 26 23:35:37 UTC 2010


Stephen Harris wrote:
> On Tue, Jan 26, 2010 at 03:48:45PM -0600, Kurt Newman wrote:
>> What I'm trying to figure out is at what point in the booting process is
>> something looking at /proc/cmdline INSTEAD of /etc/inittab for the
>> default run level.
> 
> Aren't these passed by the kernel to init as cmdline arguments and environment
> variables?  Check out the kernel sources for init/main.c
> 
>> I've already looked at modifying /etc/rc.d/rc (since it's the one that
>> uses /sbin/runlevel to execute various /etc/rcX.d scripts.  I was hoping
>> to have a more elegant way so that I don't have to maintain
>> CentOS-specific bootstrap code.
> 
> Well, it's not CentOS specific; it's Amazon specifc.

I meant /etc/rc.d/rc being CentOS-specific (technically, RHEL-specific).

> 
> But, anyway, what differences are there between rc3 and rc4 ?  On my
> machine they're minimal:
> % diff -r rc3.d rc4.d
> Only in rc4.d: K95firstboot
> Only in rc3.d: S99firstboot
> 
> If you build your rc files correctly so that they're chkconfig compatible
> then you just make your script get added to rc3 and rc4
> eg
>   # chkconfig: 2345 09 91
>   # description: my startup script
> 
> 
> Alternatively, how about this inittab entry:
>  4:4:once:/sbin/init 3
> 
> May work.  I've never tested!
> 

The difference for a stock CentOS machine, is not much.  However, I
don't use a typical run-level system for my servers.  I did try
modifying /etc/inittab like you pointed out, so that it would use run
level X start-up at run level Y, but when executing /sbin/runlevel, it
still said '4'.  Which, unfortunately, breaks my code (and there's a
lot, so I don't want to change it).

In any event, it appears the easiest bet for me is to simply patch
/etc/rc.d/rc and simply have it call some custom bootstrap code to
ensure that it's in the correct run level when starting.  Sucks, but
probably the easiest way for what I need.

Thanks for the responses.
Kurt



More information about the CentOS mailing list