Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 24933 - RC-Scripts fail to properly honor "need" dependancy
Summary: RC-Scripts fail to properly honor "need" dependancy
Status: RESOLVED DUPLICATE of bug 24064
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: PPC Linux
: High critical (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-20 18:35 UTC by Stuart Bouyer
Modified: 2005-07-17 13:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Bouyer 2003-07-20 18:35:27 UTC
After updating my system to the new evms version, I need to activate evms proir 
to mounting any local partitions other than /. I noticed that there was a evms 
script in /etc/init.d to do this - great I thought and happily added evms to 
boot level with rc-update add evms boot, reboot the machine and was horrified 
to see that localmount is running before evms, therefore the system won't boot 
properly.

Rebooted with rescue image and edit localmount to include "need evms checkfs", 
run depscan.sh and reboot.

Still no luck, localmount is running before evms, reboot with rescue image, 
check that I got the syntax correct and check with /etc/init.d/localmount 
ineed, which shows checkroot, hostname, checkfs and evms.

Hmm maybe checkfs is the problem - add "need evms" to /etc/init.d/checkfs, 
reboot - nope still broken.

Reread the relevant documents on http://www.gentoo.org/doc/en/rc-scripts.xml
<qoute>
The NEED dependency type 

This is used if a service is critical for the startup of the current service. 

Code listing 4.1: adding logger and net as a NEED dependency
 
depend() {
    need net logger
}

Note: The services mentioned after NEED are critical in order for the current 
service to start. The current service will thus fail to start if any of the 
dependencies fail to start.
 
Important: Any service in a NEED line will get started even if it is NOT added 
to the current or "boot" runlevel.
 
NEED is thus a "strong" dependency. 
</quote>

Everything seems fine there same info is printed in rc-help.sh.

After several hours of rebooting, digging around in the filesystem, rebooting 
again, and again, and again (with much hair pulling and rude words) finally in 
desperation starting reading through /sbin/rc to automatically activate evms on 
boot - I come across this

<qoute from /sbin/rc from rc-scripts-1.4.3.9.tar.bz2>
	# We do not want to break compadibility, so we do not fully integrate
	# these into /sbin/rc, but rather start them by hand ...
	for x in checkroot hostname modules checkfs localmount
	do
		if ! start_critical_service "${x}"
		then
			echo
			eerror "One of more critical startup scripts failed to 
start!"
			eerror "Please correct this, and reboot ..."
			echo; echo
			/sbin/sulogin ${CONSOLE}
			einfo "Unmounting filesystems"
			/bin/mount -a -o remount,ro & >/dev/null
			einfo "Rebooting"
			/sbin/reboot -f
		fi
	done
</quote>
"compadibility" (sic) with what!, definetly not my system or the any 
documentation available on my machine or on gentoo's web site.


Reproducible: Always
Steps to Reproduce:
1. add need dependancy to localmount
2. reboot
3. your system fails to boot cause localmount doesn't honor need dependancy



Expected Results:  
scripts/services needed for localmount to successfull mount local partitions 
SHOULD run before local mount!

To get around this I have had to hack /sbin/rc to include evms as a "critical 
service".

Now at least my system boots!
Comment 1 Zhen Lin 2003-07-20 22:48:14 UTC
Does evms "need" localmount?

Post your /var/lib/init.d/deptree

        start_critical_service() {
                local retval=
                         
                source "/etc/init.d/${x}" || error "Failed to source /etc/init.d/${x}"
                retval=$?
                [ "${retval}" -ne 0 ] && return "${retval}"
                         
                start || eerror "Failed to start /etc/init.d/${x}"
                retval=$?
 
                return "${retval}"
        }

Also, critical services, as shown above, don't honour dependencies or ordering -- They don't pass through /sbin/runscript.sh:svc_start()

Comment 2 Stuart Bouyer 2003-07-21 00:03:24 UTC
No evms has no dependancies, I'm at work now so I'll post my /var/lib/init.d/deptree later if you want.

<quote>
Also, critical services, as shown above, don't honour dependencies or ordering --
They don't pass through /sbin/runscript.sh:svc_start()
</quote>

That IS the problem! I need services run before localmount, but it doesn't honor dependancies so I have to edit /sbin/rc. This goes against everything that the documentation/help screen states.
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2003-07-21 03:13:52 UTC
Chip, isnt there a better way of doing it (kernel side) ?  Else maybe
checkfs support for evms will be needed ...

Thanks.
Comment 4 Donny Davies (RETIRED) gentoo-dev 2003-07-21 08:36:38 UTC
Az -- I dont actually have any EVSM stuff.  Only played with it a bit
during when i wrote the ebuild and initscript.  

It'd be nice to see the poster contribute a patch instead of crying his
eyes out and complaining to the people that donate hundreds of hours
of free, volunteer service to the community.  What did this poster
contribute to Gentoo Linux I wonder, hmm?

Irritatedly Yours.
Comment 5 Stuart Bouyer 2003-07-21 15:35:56 UTC
There is no problem with evms, the ebuild works perfectly. The problem arises because localmount doesn't use it's "need" deps.

If I was able to patch the init scripts properly I would, but my knowledge awk and init system of Gentoo is inadequate.

P.S. For those wondering what I've done for Gentoo may want to look in app-i18n, I used to be a CJK developer!
Comment 6 Stuart Bouyer 2003-07-21 15:42:14 UTC
Martin,

As far as I can tell from the install docs for evms and all info available on the net, evms no longer uses kernel space to activate itself, from the evms INSTALL guide

<quote>
4. Activating EVMS Volumes

In the previous EVMS design (releases 1.2.1 and earlier), volume discovery was performed in the kernel, and all volumes were immediately activated at boot time. With the new EVMS design, volume discovery is performed in user-space, and volumes are activated by communicating with the kernel. Thus, in order to activate your volumes, you must open one of the EVMS user-interfaces and perform a save, which will activate all inactive volumes.

For instance, start the GUI by running "evmsgui". You should see all empty checkboxes in the "Active" column. Press the "Save" button, which will activate all of the volumes, and each of those checkboxes should then be filled in.

In addition to manually starting one of the EVMS UIs, there is a new utility called "evms_activate". This utility simply opens the EVMS engine and issues a commit command. You may want to add a call to "evms_activate" to your boot scripts in order to automatically activate your volumes at boot time. If
you have volumes listed in your /etc/fstab file, you will need to call evms_activate before the fstab file is processed.

   NOTE: EVMS requires /proc to be mounted in order to find the Device-Mapper driver. If you run evms_activate before processing the fstab file, you may need to manually mount and unmount /proc around the call to evms_activate.

Once the volumes are activated, you may mount them in the normal fashion, using the dev-nodes in the /dev/evms/ directory.
</quote>
Comment 7 Seemant Kulleen (RETIRED) gentoo-dev 2003-07-21 17:39:38 UTC
honestly, this does not look like StuBear was crying his eyes out.  Where do you get that impression, donny?
Comment 8 Zhen Lin 2003-07-21 21:48:10 UTC
Simple enough solution(s).

Either resolve dependencies for critical system services or 

Make evms a critical system service or

Allow rc-scripts to make themselves critical system service...

Or any combination of the above. The easiest is a conditional change to the list of system services.

Change 

for x in checkroot hostname modules checkfs localmount
	
To

if [ -f /etc/runlevels/boot/evms" ] ; then
  CRITICAL_SERVICES="checkroot hostname modules evms checkfs localmount"
else 
  CRITICAL_SERVICES="checkroot hostname modules checkfs localmount"
fi

for x in ${CRITICAL_SERVICES}
	do
Comment 9 Stuart Bouyer 2003-07-21 23:49:49 UTC
This would work, but what about other services that may need to be run prior to localmount or checkfs?

When I get home tonight I'll try removing checkfs and localmount from the critical services list and see if they work as normal services.

Another option may be to dynamically create the list of critical services during depscan and use the need flag to order them. I'd try that but my awk skills are really lacking.
Comment 10 Martin Schlemmer (RETIRED) gentoo-dev 2003-07-22 08:28:05 UTC
Patch to checkfs that fixes this.


*** This bug has been marked as a duplicate of 24064 ***