Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/etc/init.d scripts segfaulting
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
sluggo
n00b
n00b


Joined: 30 Jan 2005
Posts: 9

PostPosted: Tue Mar 29, 2005 9:52 pm    Post subject: /etc/init.d scripts segfaulting Reply with quote

My /etc/init.d/ scripts are segfaulting. The services start fine
manually but not with the init.d scripts. This happened yesterday after
I re-emerged mysql due to the security alert. (It also emerged texinfo
as a dependancy.) The emerges went fine and mysql works fine, but all
hell broke loose at the next boot. Example:

# /etc/init.d/syslog-ng start
/sbin/runscript.sh: line 821: 297+_DEPEND_TREE[154+9]=
RC_DEPEND_TREE[154+10]=1093651821

RC_DEPEND_TREE[451]=syslog-ng
RC_DEPEND_TREE[451+2]=clock hostname
RC_DEPEND_TREE[451+3]=fcron
RC_DEPEND_TREE[451+4]=
RC_DEPEND_TREE[451+5]=apache2 gpm sshd xfs
RC_DEPEND_TREE[451+6]=cupsd local
RC_DEPEND_TREE[451+7]=bootmisc checkroot
RC_DEPEND_TREE[451+8]=
RC_DEPEND_TREE[451+9]=
RC_DEPEND_TREE[451+10]=1093514838

[deleted 600 lines worth of other stanzas]

RC_GOT_DEPTREE_INFO=yes

LOGGER_SERVICE=syslog-ng
7: syntax error in expression (error token is "RC_DEPEND_TREE[165]=xprint
RC_DEPEND_TREE[165+2]=
RC_DEPEND_TREE[165+3]=
RC_DEPEND_TREE[165+4]=cupsd
RC_DEPEND_TREE[165+5]=
RC_DEPEND_TREE[165+6]=local
RC_DEPEND_TREE[165+7]=checkroot
RC_DEPEND_TREE[165+8]=
RC_DEPEND_TREE[165+9]=
RC_DEPEND_TREE[165+10]=1104786320

[other stanzas deleted]

RC_GOT_DEPTREE_INFO=yes

LOGGER_SERVICE=syslog-ng
7")
Segmentation fault

/sbin/runlevel is a C program, and /sbin/runlevel.sh has only 535 lines,
so the "line 821" message must refer to something else.

I did "qkpg -f /sbin/runscript" which said it comes from package
sys-apps/baselayout. So with fingers crossed I did "emerge baselayout",
which worked fine but didn't solve the problem. I rebooted again and
unmerged xprint, which was mentioned in the syntax error above. The
error messages became more alarming:

# /etc/init.d/syslog-ng start
/sbin/runscript.sh: line 32: /var/lib/init.d/softlevel: No such file or directory
/sbin/runscript.sh: line 32: /var/lib/init.d/softlevel: No such file or directory
/sbin/runscript.sh: line 32: /var/lib/init.d/softlevel: No such file or directory
/sbin/runscript.sh: line 32: /var/lib/init.d/softlevel: No such file or directory
/sbin/runscript.sh: line 32: /var/lib/init.d/softlevel: No such file or directory
* Remounting root filesystem read-only (if necessary)...
/dev/hda5 is mounted.

WARNING!!! Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.

Do you really want to continue (y/n)? no

check aborted. [ ok ]
* Remounting root filesystem read/write... [ ok ]
/sbin/runscript.sh: line 32: /var/lib/init.d/softlevel: No such file or directory
/sbin/runscript.sh: line 32: /var/lib/init.d/softlevel: No such file or directory
* Setting hostname to tux... [ ok ]
* Calculating module dependencies...

The softlevel file didn't exist, so I looked at another computer and made it
the same:

# echo default >/var/lib/init.d/runlevel

That seemed to solve the problem with a few init scripts, but it happened again when I rebooted to verify all the init scripts work. Now the error message is different:

# /etc/init.d/syslog-ng start >| /tmp/syslog 2>&1
...
RC_DEPEND_TREE[154]=rsyncd
RC_DEPEND_TREE[154+2]=
RC_DEPEND_TREE[154+3]=
RC_DEPEND_TREE[154+4]=net
RC_DEPEND_TREE[154+5]=
RC_DEPEND_TREE[154+6]=local
RC_DEPEND_TREE[154+7]=checkroot
RC_DEPEND_TREE[154+8]=
RC7: syntax error in expression (error token is "rc_type_needsme=3
rc_type_iuse=4
rc_type_usesme=5
rc_type_ibefore=6
rc_type_iafter=7
rc_type_broken=8
rc_type_parallel=9
rc_type_mtime=10
rc_index_scale=11
...

RC_GOT_DEPTREE_INFO=yes

LOGGER_SERVICE=syslog-ng
7: syntax error in expression (error token is "RC_DEPEND_TREE[451]=syslog-ng
RC_DEPEND_TREE[451+2]=clock hostname
RC_DEPEND_TREE[451+3]=fcron
RC_DEPEND_TREE[451+4]=
RC_DEPEND_TREE[451+5]=apache2 gpm sshd xfs
RC_DEPEND_TREE[451+6]=cupsd local
RC_DEPEND_TREE[451+7]=bootmisc checkroot
RC_DEPEND_TREE[451+8]=
RC_DEPEND_TREE[451+9]=
RC_DEPEND_TREE[451+10]=1093514838

RC_GOT_DEPTREE_INFO=yes

LOGGER_SERVICE=syslog-ng
7")
Segmentation fault

So I guess I have a messed up dependency configuration? Is there a way to
regenerate it from scratch?
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Tue Mar 29, 2005 9:57 pm    Post subject: Reply with quote

Code:
emerge unmerge baselayout
rm -rf /etc/init.d/*
emerge baselayout

should do it.
EDIT: be warned that this will also delete all otehr startup files!
It may be safer to first run a backup of it:
Code:
tar cvzpf /etc/init.d.tgz /etc/init.d/*

But you're way off base with the /var/lib/init.d contents - these are not files, but directories.
So you probably succeeded in screwing it up further ;-)
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2508
Location: Silver City, NM

PostPosted: Tue Mar 29, 2005 10:49 pm    Post subject: Reply with quote

adaptr wrote:
Code:
emerge unmerge baselayout
rm -rf /etc/init.d/*
emerge baselayout

I disagree about doing "rm -rf /etc/init.d/*". Those are text files from a whole bunch of different packages. Some of them may have been modified by the user. There is no way that the seg faulting is due to all of those text files (which shouldn't have changed) being changed in the same way so as to cause a seg fault.

I do agree with reinstalling baselayout but for the love of all that is holy, first backup the entire /etc directory. It is never fun to have to figure out your fstab from scratch.
Code:
# mkdir /root/backup
# cp -a /etc /root/backup/etc-01
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Tue Mar 29, 2005 10:53 pm    Post subject: Reply with quote

I did say it would be safer to make a backup first...
I see no need to backup all of /etc, though.
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2508
Location: Silver City, NM

PostPosted: Tue Mar 29, 2005 11:57 pm    Post subject: Reply with quote

adaptr wrote:
I did say it would be safer to make a backup first...
I see no need to backup all of /etc, though.

Just do a:
Code:
 $ qpkg -l baselayout | grep /etc

I count 80 files under /etc/ that are contained in baselayout. If you accidently update just one of these then you can lose some settings that may take some time and effort to recreate. It seems to me that without backing up the entire /etc/ you can be one keystroke away from disaster.

Even if nine times out of ten or even 99 times out of 100, the backup isn't needed, wouldn't it be a good idea to have the backup just in case?
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Wed Mar 30, 2005 11:10 am    Post subject: Reply with quote

Of course - that is why I use dispatch-conf with rcs... like any sane person should ;-)
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2508
Location: Silver City, NM

PostPosted: Wed Mar 30, 2005 6:59 pm    Post subject: Reply with quote

Yes, I figured as much. But if the noobie sluggo knew as much as you then he wouldn't be asking questions that you can answer.
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Wed Mar 30, 2005 9:41 pm    Post subject: Reply with quote

Of course, of course... I'm not blaming him for anything.

I was talking to you, obviously ;-)
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2508
Location: Silver City, NM

PostPosted: Wed Mar 30, 2005 10:14 pm    Post subject: Reply with quote

We don't seem to be communicating.

My point is that if you are giving advice to a newbie that could easily cause him to wipe out vital config files under /etc that would be painful to recreate then you really should also give him instructions on how to avoid the catastrophic destruction of his configuration instead of just assuming that he is using the best practices that you as a veteran use as second nature.
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Wed Mar 30, 2005 11:40 pm    Post subject: Reply with quote

Well, we obviously are.
But you seem to be berating me now...

I cede your point completely - I have seen many people need to re-install because their configuration mysteriously "went away".

Still not quite sure why dispatch-conf isn't mentioned more often in the Handbook - it's standard in Portage, after all.
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
sluggo
n00b
n00b


Joined: 30 Jan 2005
Posts: 9

PostPosted: Mon Apr 04, 2005 6:12 pm    Post subject: Reply with quote

Thursday morning I turned my computer on and the segfault mysteriously disappeared. There was a non-fatal error on startup, again a new one:

Caching service dependencies
/sbin/rc: /var/lib/init.d/deptree: line 168: unexpected EOF while looking for matching ]
/sbin/rc: /var/lib/init.d/deptree: line 968: syntax error: unexpected end of file
Caching service dependencies

I looked around to see what's causing that, rebooted a couple times to make sure the segfault was gone, and decided to take the advice of unmerging/reemerging baselayout. (I had already reemerged it to no effect -- see my first message -- but figured maybe unmerging it would clean something up.) I did backup /etc, which was good since it killed my /etc/fstab. But the segfault came back!!!

(Aside about backing up /etc: yes, this is something I'm careful about. However, New Bees can't always predict how much of the filesystem will be clobbered by a package, so I'm not sure I would have done so if somebody hadn't mentioned /etc.)

I decided to reinstall Gentoo in a new partition. A last resort, but I didn't want the possibility of hard-to-trace dependency problems and segfaults reappearing at any moment. I was pleasantly surprised at how quickly the install went when running from an existing Gentoo system with a working kernel (skip half the install guide, don't need the bootdisk image). I used the 2005.0 stage 3 (Pentium 4) and the latest Portage snapshot.

No segfault, but again a syntax error after "Caching service dependencies". This is without any extra services installed, just the base system and a few packages like vim and links (without X). My first thought was to run from Gentoo and install Slackware. My second thought was, "It's only the service dependency system that's problematic, not everything." So I guess I'll look through the source and see how it builds those trees.

Is there a way to bypass the dependency system and hardcode which services I want to startup in which order? I don't mind losing flexibility if I can get more reliability.

As for dispatch-conf, I looked at the manpage and it seems like the same thing as etc-update. Is there a reason to use one instead of the other?
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2508
Location: Silver City, NM

PostPosted: Mon Apr 04, 2005 6:33 pm    Post subject: Reply with quote

Search the forums for "deptree". Others are having problems with this file and there may be some solutions posted.
Back to top
View user's profile Send private message
sluggo
n00b
n00b


Joined: 30 Jan 2005
Posts: 9

PostPosted: Mon Apr 04, 2005 9:08 pm    Post subject: Reply with quote

I looked through the deptree threads and found the gendepends.awk patch in bug 48383. I installed it using the 'patch' progam and it cleared up all my init problems, and I was able to go back to my old install.

The following thread was the most informative:
Subject: weird RC_DEPEND_TREE message at startup

Thanks everyone.
Back to top
View user's profile Send private message
sluggo
n00b
n00b


Joined: 30 Jan 2005
Posts: 9

PostPosted: Wed Apr 13, 2005 10:32 pm    Post subject: Reply with quote

Sorry, wrong bug number. It's 48303
https://bugs.gentoo.org/show_bug.cgi?id=48303

To use, download the diff and patch /lib/rcscripts/awk/gendepends.awk
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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