Hi,
I have a Sony Vaio SZ4 which contains 2 different graphic cards (one nvidia and one intel which is supposed to use less energy).
One classical method consists in creating two files xorg.conf and a script which detects which card is used at boot time and replaces xorg.conf by the correct one.
So I have created the script named xorg.switch. I have tested it and it works perfectly. The two xorg.conf files also work perfectly.
I did put the script in /etc/init.d/ and I made it runable by “chmod 755”.
Then I have added a symbolic link in /etc/rc.d/rc2.d/ named S12xorg.switch, pointing towards the script.
My problem: my script is NEVER run during boot time. If I run it by hand it works perfectly, but nothing happens during the boot. I really cannot figure out why.
Is there something special to do with openSUSE 11 to get that work ???
Thanks for your help !
Hi
Look at the file /etc/init.d/skeleton and use this as the
template/wrapper for your script. Remove the links you created and run
chkconfig <name of your script> on to activate.
–
Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.0 x86 Kernel 2.6.25.11-0.1-default
up 16:35, 2 users, load average: 0.13, 0.11, 0.15
GPU GeForce 6600 TE/6200 TE - Driver Version: 173.14.12
I have created the script using the template /etc/init.d/skeleton as you suggested. And this continues to make me really crazy.
It clearly still does not work. I see it easily because kdm cannot start at all with the bad xorg.conf file… So I get a usual logging console at the end of the boot.
Then I log in as root and I type
init 2
then
init 5
and… everything works fine, showing that the script has this time been run without any problem during “init 2”.
But the script does not work during the boot. Note I can see that the script was NOT executed AT ALL (because the xorg.conf file is the wrong one after the boot). So it is not only because it was run too late or so.
Can you understand why I get this very strange behaviour ???
“…Then I have added a symbolic link in /etc/rc.d/rc2.d/ named S12xorg.switch, pointing towards the script.”.
According to that, assumming everything is ok in the script and no boot runtime error is aborting it before time, I think your problem is likely caused by an inconsistency between your default runlevel and the one you have set the script to run at.
In other words, is 2 your default runlevel? If you have created a sim link to /etc/init.d/S12xorg.switch only in the /etc/rc2.d directory, that script will only be triggered when your system enters that runlevel.
I bet your default runlevel is 5:
grep initdefault /etc/inittab
id:5:initdefault:
If that’s your case, then you have to create the sim link in the /etc/rc5.d directory.
>
> Hi,
>
> At the very beginning you stated:
>
> “…Then I have added a symbolic link in /etc/rc.d/rc2.d/ named
> S12xorg.switch, pointing towards the script.”.
>
> According to that, assumming everything is ok in the script and no boot
> runtime error is aborting it before time, I think your problem is likely
> caused by an inconsistency between your default runlevel and the one you
> have set the script to run at.
>
> In other words, is 2 your default runlevel? If you have created a sim
> link to /etc/init.d/S12xorg.switch only in the /etc/rc2.d directory,
> that script will only be triggered when your system enters that
> runlevel.
>
> I bet your default runlevel is 5:
>
> # grep initdefault /etc/inittab
> id:5:initdefault:
> #
>
> If that’s your case, then you have to create the sim link in the
> /etc/rc5.d directory.
>
> This will do the trick.
>
> Regards.
>
>
You’re correct, the runlevel involved when the Xwindows is brought up is
runlevel 5. Runlevel 3 is the same as 5, but without the GUI.
Runlevel 2, is multiuser… NO NETWORK. (ha! not real useful there)
There are others (1,2,3,4,5), hey, I guess 4 is the only one I didn’t
mention… so here… “4: Not used”.
Yes, all you smart guys out there… there ARE two more… 0 & 6. You go
ahead and set your default runlevel to either one of those… I’ll wait here.
0: Initiate system HALT. (off!)
6: Initiate system reboot.
Humm, I always thought that during the boot the system was going from boot level 1 to 5, necessarily passing through 2… If I understand your reply correctly, this is simply wrong !
I will modify my script accordingly and keep you informed.
Thanks a lot for your help.
OK, it works now.
The only thing is that the script was executed a bit too late. I deduced that it has to be run before “earlyxdm” and I added a dependency in the earlyxdm script file, a solution which I don’t like very much. Is there a way to force it to be executed early in the boot process, without changing the system files ?
>
> OK, it works now.
> The only thing is that the script was executed a bit too late. I
> deduced that it has to be run before “earlyxdm” and I added a
> dependency in the earlyxdm script file, a solution which I don’t like
> very much. Is there a way to force it to be executed early in the boot
> process, without changing the system files ?
>
>
you gave it a name of S12xorg.switch…
to make it run earlier in the startup procedure, give it a lower number.
Since earlyxdm is run at S04earlyxdm, maybe name yours S03xorg.switch.
They’re sorted into alphabetical order, then executed in that order.
I indeed already tried that but it did not work, I don’t know why. It only worked when I included the dependency in the earlyxdm script.
But I have found another solution: it is also possible to add a line in MY script using
X-Start-Before: earlyxdm
which I prefer because then I don’t need to change the system files…
This is a bit after the meal, but your ideas about this are not that strange. There are Unix flavors who handle it like that: going from runlevel 0 to 5 all iintermediate starts are done and v.v. Others, including Linux do behave different as explained above.
This may make you less frustrated about your Unix/Linux knowledge
>
> I indeed already tried that but it did not work, I don’t know why. It
> only worked when I included the dependency in the earlyxdm script.
> But I have found another solution: it is also possible to add a line
> in MY script using
>
> # X-Start-Before: earlyxdm
>
> which I prefer because then I don’t need to change the system files…
>
>
That line only works if you’re controlling the script through the runlevels
module in yast and chkconfig from the command line. I was under the
impression you were inserting your script into the boot process by hand. No
worries.