Bug 499044 - chkconfig bug in kickstart scripts
chkconfig bug in kickstart scripts
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: spin-kickstarts (Show other bugs)
11
All Linux
low Severity low
: ---
: ---
Assigned To: Jeroen van Meeuwen
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-04 18:54 EDT by areharta
Modified: 2009-08-12 19:21 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-08-12 19:21:02 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description areharta 2009-05-04 18:54:26 EDT
Description of problem:
I've been spinning my own Fedora versions based on fedora-live-base.ks, but have run into a subtle problem.
In /usr/share/spin-kickstarts/fedora-live-base.ks, there are several references to chkconfig in the livesys script that is generated.  While the system is booting with an image made with this script, the system reads the files in /etc/rc*.d/ then starts running the necessary startup scripts.  The first script run is livesys, which runs a whole bunch of chkconfig's.  But, it is too late to change what starts up because all the files in the rc*.d directory have already been read.  This results in scripts running that are not expected and vice versa.  When you look in the rc*.d directory, all the files are there, but it didn't run them.  It doesn't make sense until you realize the startup scripts reconfigure the files in these directories.  Hence, what really controls the startup behavior of the system is the "services" line at the beginning of the kickstart config file.

I moved the chkconfig commands before the "cat /etc/rc.d/init.d/livesys << EOF" line.  That didn't work, but it does if written:
/sbin/chkconfig --level 2345 crond off

This configures the startup/kill scripts during the build process and not on bootup.  Hopefully that helps.
Comment 1 Bug Zapper 2009-06-09 11:08:45 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 2 Mads Kiilerich 2009-06-16 15:08:09 EDT
areharta, do I understand the report right: You created your own livesys, and then chkconfig didn't work, and you concluded that that was because the configuration symlinks already had been read and couldn't be changed from livesys? But then you conclude that it works anyway if /sbin/chkconfig is used, and thus that the first conclusion was wrong?

Perhaps the explanation is that your livesys doesn't have ". /etc/init.d/functions
" and thus have a PATH with /sbin ?

Do you see the problem with the kickstarts provided by spin-kickstarts?
Comment 3 areharta 2009-06-21 13:20:58 EDT
I think what happens is the startup symlinks (e.g. S00livesys and the other SXX symlinks) are determined via a directory listing before any script runs.  Afterward, livesys runs with its chkconfig lines.  However, because the directory listing to determine what scripts to run has already taken place, any newly added SXX symlinks will not be run.  The removed SXXsomescript symlinks will not run because the symlinks are gone causing a file not found.  The default kickstarts ONLY remove sysmlinks (i.e. "chkconfig --level 345 crond off 2>/dev/null") so this technically works.  Had there been any 'chkconfig --level 345 somescript on' commands, these would fail (i.e they add the SXXsomescript symlink but the symlink is not in the list of scripts to run).  The confusing part is the SXXsomescript symlink is in the rc.X directory after the system starts up but the script did not run.  That is the problem I ran into.  I spun the default kickstart and wanted my own script to run on startup.  For the life of me, I could not figure out why everything looked fine in the rc.d directory but the script had not run.

The moral in my mind is that the 'chkconfig off' vs. 'chkconfig on' is subtle and a redhat developer or custom spinner might not realize this at some point.

I guess this is my question, why configure the startup scripts on startup and not directly on the DVD?  It seems to offer no advantages and doesn't appear to be good practice.

My suggestion in the first post was to move the chkconfigs out of the livesys script and put them somewhere where they run during the build process.


---------------------
I think the comment:
> I moved the chkconfig commands before the "cat /etc/rc.d/init.d/livesys << 
> EOF" line.  That didn't work, but it does if written:
> /sbin/chkconfig --level 2345 crond off

was to say that 
"/sbin/chkconfig --level 2345 crond off 2>/dev/null"
didn't work but removing the last bit fixed things.
Comment 4 Mads Kiilerich 2009-06-21 13:48:34 EDT
Ok, yes, you are right, one rc script can't enable another, but it can disable. That is a limitation and might be annoying, but it isn't a bug.

One reason to do it livesys is to get it done when running as a livecd but get the default when the image is installed to a hard drive. If it wass done at build-time then it would have to be undone at install-time. It could had been done that way instead, but that is not how it is.

As far as I can see the provided kickstarts works fine, and you haven't claimed otherwise, right?

To put it very simple: It seems like your problem is that your custom spins/kickstarts doesn't work. I'm afraid the only answer to that is that you have to make your customizations in such a way that it works. Perhaps you can get help in a forum or mailing list, but I don't think this tracker is the right place.

ps:
Are you _really_ sure that chkconfig didn't run successful but silent with "2>/dev/null"?
Comment 5 areharta 2009-06-21 23:08:00 EDT
Yes, I was not claiming the kickstarts as they are did not work.  My thought was that a better solution was available, but I hadn't considered installing the LiveCD to a hard drive.  I've had a working solution for quite awhile now.  It was easy to fix once I found the problem.  It was long enough ago that I don't exactly remember why I said

> I moved the chkconfig commands before the "cat /etc/rc.d/init.d/livesys << 
> EOF" line.  That didn't work, but it does if written:
> /sbin/chkconfig --level 2345 crond off

My guess was the "2>/dev/null" part because that is the only difference, but I cannot remember for sure what any issue with this exact part was.

Thanks.
Comment 6 Jeroen van Meeuwen 2009-08-12 19:21:02 EDT
If the kickstarts as they are do work then this is not a bug.

Note You need to log in before you can comment on or make changes to this bug.