View previous topic :: View next topic |
Author |
Message |
frog-o n00b
Joined: 25 Feb 2006 Posts: 41
|
Posted: Sun Oct 28, 2007 6:32 pm Post subject: Solving problems with services on boot only(/etc/init.d) |
|
|
Intruduction and why i writing this
One of the most common problem (I had with Gentoo base distrobutions and Gentoo itself) is some time the services did not start and it left me pull out my hair trying to find out why? The purpose of this tip is to give you an idea in how to solve them. I browsed a bunch of different Linux book and done a bunch of Google searching to find out what i know now many years later.
Note: I'm not an expert i all self taught and these institution might not be real secure or proper way of doing thing even thou i try to be as secure and proper as possible. If you and expert or even a beginner for that matter and see a security flaw or better way of doing thing i encourage you to post bellow on how and what it is a how to improve on it.
Thank in advance for any info on the matter.
Please also Note:
This topic only cover what i believe to be the default way of service startup on gentoo and dose not tell you how to deal with thing that uses initng (init next generation). there are probably also more way to go about halding failed services but I tryed to list all that i know.
How to procced with fix
Step 1 decide on which failed service your are trying to fix and take note
The first step is to reboot your computer and choice a services that is failing and take note of all output on the command line that show after the failed service starts. (you can of course make mantel notes) but i would try to rember one service output at a time.
in other word log everything between
* bla (service name) bla
[failed]
this information I will call "service output"
note:
This step can be change a little so you don't need to reboot by following the direction in step 2
Step 2 Find the script that was use to run your service that failed
It is import when troubleshoot to be able to reproduce the error that is show on boot to do that we need to find the script that is responsible for the error to do that.
a1.)
open a console and gain root permission this is done with the command
'su' or 'sudo' command then by typing in the root password.
a2.)
while still in the console type in at the bash prompt
rc-update show
this show all script name of the service that are to be start followed buy a "|" and what run leave that the service run on (the runlevel is select by grub,lilo or what ever you boot load is.)
c2.)
in the output above look for the script name that is must likely deal with the service that you chose to fix then test it to make sure it the right one buy typing in the console
/etc/init.d/(the service name) start
minus the () it should then match the "service output"
if it dose not match the "service output" then you probably chose the wrong one try a different one from the output of rc-update.
if you goofed and got the wrong one and want to stop it type in
etc/init.d/(the service name) stop
minus the ()
Note: do not chose a different one if it is close to what you think it should be but sayes [ok]. Some times it just a permission problem and running as root solve the problem until reboot. if it work
see
Step 7 See if a permission problem.
Step 3 Find the script ebuild that was use to run your service that failed
after you found the script that failed you should find the ebuild that was used to create the service you can do this buy using equery comand with is part of the gentoolkit.
You do this buy first installing the app-portage/gentoolkit if you don't have it installed.
As before at the console as root user type in
emerge --sync
emerge -av app-portage/gentoolkit
if the ouput is
[ebuild R ] app-portage/gentoolkit- (bla)
whit the capital R you already have install say n other wise say yes to install all need files.
Now that you have the equery command type in the console
equery belongs (/etc/init.d/(scipt name))
again don't put int the ()
this will give you the name of the ebuild that was used to install the scipt.
Step 4 Try older or new ebuild
Note: you may want to skip this next 2 step it dosn't normilly work but can.
One thing you can do is try to upgrade or down grade the ebuild you use this is, if your lucky, an easy fix.
you can do this buy installing eix
as root type in the console
emerge -av eix
say yes if it not installed
update-eix
no need to run emerge --sync (it should only be run once a day or less aways)
Note: eix dose a lot of difernt thing i would check it out on the homepage that you can git buy running the command
eix eix
at the console ,after it is installed.
still at the console type in
eix (script name)
again do not put in the ()
this will return a list of all ebuild version you can install plus the version you have installed . Type in the console
emerge -av ( =script name-version)
Note: do not use the ones with the ~ in there name or in deep red there mask to find more info on it type in
man emerge
on the console.
Step 5 Try to run service again
like we did in step 2 we should try to see if upgrading or down grading the ebuild helped. we should try start the service again typeing in at the console as root.
/etc/init.d/(scipt name) start
if it work your done if not keep reading.
Step 6 collect error info
there are many places to git info here are some to look
1.)
in the dir /var/log/(deaomn name)
see
man ch
chdir comand
man ls
list dir comand
man nano
a text editor.
2.)
in the text file /var/log/messages
3.)
if this dose not produce the result you are looking for try looking at the script with nano
nano /etc/init.d/(service name)
and see if you can start the progam it is try to lauch and failing as root
and read the man pages of that program as well as looking at the error info.
if this work as root but not in the ini file it probably a permision problem
see Step 7 See if it a permission problem
Step 7 See if it a permission problem
If you suspect it a permission problem from what i told you above you should trying running the program as the users the script is running as. wich you would determine buy look at the script as described in
Step 6 section 3
i would the use the kde program
kuser
or other program allow modify users info
and change the login shell to /bin/bash or other shell and give the user a password.
and then at the terminal type in
su username
where username is the user name.
Step 8 if it a permission problem
if you determine it is a permision problem you have 2 choices
Choice 1
change the file the error complaining about so it can access the file
see
man chown
man chmod
Choice 2
change the ower permision see
man chgrp or the
kde kuser help manual.
Step 9 if not a permission problem
if it not a permission problem i would take all the info above i gave you and use google.
The info being the ebuild version the script run as. The demon out-put you got above and what user you ran it as ect.
Conclusion
Buy use all the above step i have been able to solve most of my problem I wish you the best of luck and hope that you found this useful. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|