Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 368765 - sys-fs/multipath-tools-0.4.8-r1: addons/multipath-stop.sh logic error in dm_in_proc checking
Summary: sys-fs/multipath-tools-0.4.8-r1: addons/multipath-stop.sh logic error in dm_i...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-26 07:12 UTC by Samuel Bauer
Modified: 2011-06-05 23:30 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 Samuel Bauer 2011-05-26 07:12:05 UTC
In the script:
/lib/rcscript/addons/multipath-stop.sh

Line 13-14:
# Stop LVM2
if [ -x /sbin/multipath -a dm_in_proc ]; then

Reproducible: Always

Steps to Reproduce:
1. Compile a kernel without lvm support
2. Use openrc and baselayout2
Actual Results:  
 * Shutting down Multipath devices ...
/proc/misc: No entry for device-mapper found
Is device-mapper driver missing from kernel?
/proc/devices: No entry for device-mapper found
Failed to set up list of device-mapper major numbers
 * Failed to shut down Multipath devices
 [ !! ]
 * ERROR: multipath failed to stop

Expected Results:  
The if condition from line 14 should fail

Fix:

Line 13-14:
# Stop LVM2
if [ -x /sbin/multipath -a dm_in_proc -ne 2 ]; then

device-mapper should have been grepped in /proc/devices or /proc/misc

or
Line 13-14:
# Stop LVM2
if [ -x /sbin/multipath -a dm_in_proc -eq 0 ]; then

device-mapper should have been grepped in /proc/devices and /proc/misc
Comment 1 SpanKY gentoo-dev 2011-06-03 21:34:41 UTC
if you dont have support in your kernel, you shouldnt be adding the init.d script in the first place to a runlevel

there is a bug in the script, but not what you show.  the [ dm_in_proc ] is evaluating it as a string, not as a command.  it should be '...] || dm_in_proc ;'

multipath-tools-0.4.9-r2 installs an init.d script without this bug
Comment 2 Samuel Bauer 2011-06-05 22:02:08 UTC
(In reply to comment #1)
> if you dont have support in your kernel, you shouldnt be adding the init.d
> script in the first place to a runlevel
> 

Multipath-tools is installed by default as a dependency from openrc (baselayout2).
It adds itself to the boot level.
In this case grepping the content of the two /proc files in dm_in_proc should prevent to do something when no lvm ?

(In reply to comment #1)
> there is a bug in the script, but not what you show.  the [ dm_in_proc ] is
> evaluating it as a string, not as a command.  it should be '...] || dm_in_proc
> ;'
> 
> multipath-tools-0.4.9-r2 installs an init.d script without this bug

I assumed the dm_in_proc was correctly evaluated and focused only on the return value.
Thanks for fixing this.
Comment 3 SpanKY gentoo-dev 2011-06-05 22:44:41 UTC
i see no logic in openrc that auto-adds the multipath init.d script to any runlevel.  you'll need to provide examples.
Comment 4 Samuel Bauer 2011-06-05 23:03:23 UTC
I don't remember to add it myself to the boot runlevel (but it's rather long time I switched to openrc, so maybe I did)

At least if I did, I think I was intimed to do it

 * If you use baselayout2, you must add 'multipath' into
 * your boot runlevel!

by reading only the last lines of the install messages.
Comment 5 SpanKY gentoo-dev 2011-06-05 23:30:58 UTC
yes, that message used to exist, but the point there was "if you use multipath, you must install the init.d script".  otherwise, there wouldnt be much point to installing the multipath package in the first place.