Salvatore Bonaccorso <car...@debian.org> writes:

> On Tue, Oct 15, 2013 at 05:34:09PM +0200, Ferenc Wágner wrote:
>
>> The Debian 7.1 -> 7.2 upgrade includes a multipath-tools upgrade,
>> which fails on a multipath-rooted system:
>> 
>> Preparing to replace multipath-tools 0.4.9+git0.4dfdaf2b-6 (using 
>> .../multipath-tools_0.4.9+git0.4dfdaf2b-7~deb7u1_amd64.deb) ...
>> [....] Root is on a multipathed device, multipathd can not be 
>> stopped:invoke-rc.d: initscript multipath-tools, action "stop" failed.
>> dpkg: warning: subprocess old pre-removal script returned error exit status 1
>> dpkg: trying script from the new package instead ...
>> [....] Root is on a multipathed device, multipathd can not be 
>> stopped:invoke-rc.d: initscript multipath-tools, action "stop" failed.
>> dpkg: error processing 
>> /var/cache/apt/archives/multipath-tools_0.4.9+git0.4dfdaf2b-7~deb7u1_amd64.deb
>>  (--unpack):
>>  subprocess new pre-removal script returned error exit status 1
>> 
>> Ignoring the stop failure in the prerm script fixes the problem.
>
> Only a follow-up on this bugreport: This looks similar to #704073.

Absolutely.  I did not read through that report before reporting this,
because its title described another bug.  Sorry.

So, the current version behaves sanely, because the init script won't
error out anymore, but the upgrades are still broken, because that could
only be fixed by ignoring the error of the old init script in the new
prerm script.

By the way, that teardown_slaves() function in the init script still has
its problems.  Apart from its name being rather misleading, the
recursive call changes the current directory under the for loop, so it
emits error messages if a devices has multiple slaves:

Preparing to replace multipath-tools 0.4.9+git0.4dfdaf2b-7~deb7u1 (using 
.../multipath-tools_0.4.9+git0.4dfdaf2b-7~deb7u2_amd64.deb) ...
[....] Root is on a multipathed device, multipathd can not be 
stopped:/etc/init.d/multipath-tools: 30: cd: can't cd to 
/sys/devices/platform/host7/session1/target7:0:0/7:0:0:2/block/sdc/slaves/sdj
/etc/init.d/multipath-tools: 35: /etc/init.d/multipath-tools: cannot open 
/sys/devices/platform/host7/session1/target7:0:0/7:0:0:2/block/sdc/slaves/sdj/dev:
 No such file
[....] Root is on a multipathed device, multipathd can not be 
stopped:/etc/init.d/multipath-tools: 30: cd: can't cd to 
/sys/devices/platform/host7/session1/target7:0:0/7:0:0:2/block/sdc/slaves/sdq
/etc/init.d/multipath-tools: 35: /etc/init.d/multipath-tools: cannot open 
/sys/devices/platform/host7/session1/target7:0:0/7:0:0:2/block/sdc/slaves/sdq/dev:
 No such file
[....] Root is on a multipathed device, multipathd can not be 
stopped:/etc/init.d/multipath-tools: 30: cd: can't cd to 
/sys/devices/platform/host7/session1/target7:0:0/7:0:0:2/block/sdc/slaves/sdx
/etc/init.d/multipath-tools: 35: /etc/init.d/multipath-tools: cannot open 
/sys/devices/platform/host7/session1/target7:0:0/7:0:0:2/block/sdc/slaves/sdx/dev:
 No such file
[....] Root is on a multipathed device, multipathd can not be stopped:Unpacking 
replacement multipath-tools ...

Here's how I would do it instead.  Also much shorter:

is_mpath () {
    read name 2>/dev/null <"$1"/dm/name && [ "$(dmsetup table --target 
multipath "$name")" ] && return 0
    for slave in "$1"/slaves/*; do
        [ -L "$slave" ] && is_mpath "$slave" && return 0
    done
    return 1
}

rdev=$(stat --format %d /)
is_mpath /sys/dev/block/$((rdev/256)):$((rdev%256)) && echo "multipath root"

> @Ferenc, anyway please wait to update multipath-tools, there were
> detected a regression #726296 and #726311 which should be available
> via wheezy-updates tonight.

Thanks for the notice, much appreciated.
-- 
Feri.


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to