checkarray doesn't work

Bug #1599428 reported by Simon Déziel
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
mdadm (Debian)
Fix Released
Unknown
mdadm (Ubuntu)
Fix Released
High
Dimitri John Ledkov

Bug Description

Problem description:

The script /usr/share/mdadm/checkarray exits before checking any array.

Steps to reproduce:

1) Check the status of every arrays
  /usr/share/mdadm/checkarray --all --status
2) Expected output
    md0: idle
3) Problematic output: nothing

Additional information:

When I tried to manually check my RAID1 array with "/usr/share/mdadm/checkarray --all --status" I noticed it produced no output. When I invoked it with "sh -x" and the same parameters as the monthly checking cron job I noticed it was exiting early, before performing any real check.

# sh -x /usr/share/mdadm/checkarray --cron --all --idle --quiet
...
+ [ 1 = 1 ]
+ + ls -d1 /sys/block/md0
cut -d/ -f4
+ arrays=md0
+ MDBASE=/sys/block/md0/md
+ [ ! -e /sys/block/md0/md/sync_action ]
+ read cur_status
#

Under Xenial, dash doesn't seem to like this instruction:

 read cur_status < $MDBASE/sync_action

Oddly enough, it works just fine with Trusty's dash.

Software versions:

# lsb_release -rd
Description: Ubuntu 16.04 LTS
Release: 16.04
# apt-cache policy mdadm dash
mdadm:
  Installed: 3.3-2ubuntu7.1
  Candidate: 3.3-2ubuntu7.1
  Version table:
 *** 3.3-2ubuntu7.1 500
        500 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     3.3-2ubuntu7 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
dash:
  Installed: 0.5.8-2.1ubuntu2
  Candidate: 0.5.8-2.1ubuntu2
  Version table:
 *** 0.5.8-2.1ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: mdadm 3.3-2ubuntu7.1
ProcVersionSignature: Ubuntu 4.4.0-28.47-generic 4.4.13
Uname: Linux 4.4.0-28-generic x86_64
NonfreeKernelModules: zfs zunicode zcommon znvpair zavl
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: amd64
CurrentDesktop: Unity
CurrentDmesg: Error: command ['dmesg'] failed with exit code 1: dmesg: read kernel buffer failed: Operation not permitted
Date: Wed Jul 6 04:36:29 2016
MDadmExamine.dev.sda: Error: command ['/sbin/mdadm', '-E', '/dev/sda'] failed with exit code 1: mdadm: cannot open /dev/sda: Permission denied
MDadmExamine.dev.sda1: Error: command ['/sbin/mdadm', '-E', '/dev/sda1'] failed with exit code 1: mdadm: cannot open /dev/sda1: Permission denied
MDadmExamine.dev.sda2: Error: command ['/sbin/mdadm', '-E', '/dev/sda2'] failed with exit code 1: mdadm: cannot open /dev/sda2: Permission denied
MachineType: LENOVO 2516CTO
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.4.0-28-generic root=/dev/mapper/crypt-xroot ro quiet splash cryptopts=target=crypt,source=/dev/sda1,lvm=crypt-xroot possible_cpus=4 nmi_watchdog=0 kaslr vt.handoff=7
ProcMDstat:
 Personalities :
 unused devices: <none>
SourcePackage: mdadm
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 02/14/2013
dmi.bios.vendor: LENOVO
dmi.bios.version: 6IET85WW (1.45 )
dmi.board.name: 2516CTO
dmi.board.vendor: LENOVO
dmi.board.version: Not Available
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Not Available
dmi.modalias: dmi:bvnLENOVO:bvr6IET85WW(1.45):bd02/14/2013:svnLENOVO:pn2516CTO:pvrThinkPadT410:rvnLENOVO:rn2516CTO:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable:
dmi.product.name: 2516CTO
dmi.product.version: ThinkPad T410
dmi.sys.vendor: LENOVO
etc.blkid.tab: Error: [Errno 2] No such file or directory: '/etc/blkid.tab'
modified.conffile..etc.logcheck.ignore.d.server.mdadm: [deleted]
modified.conffile..etc.logcheck.violations.d.mdadm: [deleted]

Revision history for this message
Simon Déziel (sdeziel) wrote :
Revision history for this message
Simon Déziel (sdeziel) wrote :

After some more debugging, it seems to be a behavior change in dash between Xenial:

# /bin/sh -c 'read cur_status < /sys/block/md0/md/sync_action; echo $cur_status'
i
# /bin/bash -c 'read cur_status < /sys/block/md0/md/sync_action; echo $cur_status'
idle

And Trusty:

# /bin/sh -c 'read cur_status < /sys/block/md0/md/sync_action; echo $cur_status'
idle
# /bin/bash -c 'read cur_status < /sys/block/md0/md/sync_action; echo $cur_status'
idle

Revision history for this message
Simon Déziel (sdeziel) wrote :
Revision history for this message
Simon Déziel (sdeziel) wrote :

According to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787950#10, this is a combination of how dash reads files and the kernel version (4.0+).

If that's true, even Trusty machines could be affected when running the HWE kernels.

Revision history for this message
Simon Déziel (sdeziel) wrote :

A kernel side fix was proposed (https://lkml.org/lkml/2016/6/22/682) but remains to be merged upstream.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Workaround for Xenial's dash" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Changed in mdadm (Debian):
status: Unknown → New
Changed in mdadm (Ubuntu):
assignee: nobody → Mathieu Trudel-Lapierre (cyphermox)
Changed in mdadm (Ubuntu):
status: New → Triaged
importance: Undecided → High
Changed in mdadm (Ubuntu):
assignee: Mathieu Trudel-Lapierre (cyphermox) → Dimitri John Ledkov (xnox)
Changed in mdadm (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mdadm - 4.0-1

---------------
mdadm (4.0-1) unstable; urgency=medium

  * New upstream release. LP: #1668128
  * Drop warnings that raid arrays are missing from the initramfs
    configuration. Instead have a positive message as to which arrays are
    included in the initramfs.
  * Add a warning to mkconf generated file that mdadm.conf is copied into
    initrafms.
  * Fix checkarray script bugs. LP: #1599428 Closes: #787950 Closes: #843665

 -- Dimitri John Ledkov <email address hidden> Thu, 22 Jun 2017 13:23:10 +0100

Changed in mdadm (Ubuntu):
status: Fix Committed → Fix Released
Changed in mdadm (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.