Bug#795278: /etc/init.d/multipath-tools: 75: [: /sys/block/dm-1: unexpected operator

Benjamin Drung benjamin.drung at profitbricks.com
Wed Aug 12 14:42:30 UTC 2015

Source: multipath-tools
Version: 0.5.0-7
Severity: normal
Tags: patch


The init script of multipath-tools throws this error message on wheezy
(same for jessie and unstable) when stopping the daemon:

    /etc/init.d/multipath-tools: 75: [: /sys/block/dm-1: unexpected operator
    [ ok ] Stopping multipath daemon: multipathd.

The problem start with

    root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $1 ~ /\// && $2 == "/") { print $1; }}' /etc/mtab)

This command evalutes to an empty string on my system. In consequence,
the next command

    dm_num=$(dmsetup info -c --noheadings -o minor $root_dev 2>/dev/null)

queries dmsetup for all devices instead of the root device. Then
root_dm_device contains new lines and let the directory test stumble.

Thus only query dmsetup if a root device is found. Do nothing when no
DM number can determined (instead of using the echo command as no-op).

The patch to fix the init script is attached.

Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.drung at profitbricks.com
URL:  http://www.profitbricks.com

Sitz der Gesellschaft: Berlin.
Registergericht: Amtsgericht Charlottenburg, HRB 125506B.
Geschäftsführer: Andreas Gauger, Achim Weiss.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-init-Fix-stop-failure-when-no-root-device-is-found.patch
Type: text/x-diff
Size: 2307 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-lvm-maintainers/attachments/20150812/175fe934/attachment-0001.patch>

More information about the pkg-lvm-maintainers mailing list