checkarray doesn't work with sh = dash

Bug #1550823 reported by Peter Cordes on 2016-02-27
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
mdadm (Debian)
Fix Released
Unknown
mdadm (Ubuntu)
High
Dimitri John Ledkov
Xenial
High
Dimitri John Ledkov

Bug Description

As per https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787950, /usr/share/mdadm/checkarray fails when it tries to read /sys/block/mdX/md/sync_action, if running under dash (or apparently most shells other than bash), with a 4.x kernel.

Present in Ubuntu 15.10, where a default install does use /bin/sh -> dash, and runs Linux 4.2.

A simple workaround is to make it a #!/bin/bash script. Another alternative would be to read sync_action with cat, instead of the read built-in, since (as a reply on the Debian bug report says), the problem is char-at-a-time reading of the file in /sys.

tags: added: wily xenial
Changed in mdadm (Ubuntu):
importance: Undecided → High
Changed in mdadm (Ubuntu Xenial):
status: New → Triaged
Changed in mdadm (Ubuntu Xenial):
assignee: nobody → Dimitri John Ledkov (xnox)
Changed in mdadm (Debian):
status: Unknown → New
Rodman (rodman-c) wrote :

Shouldn't this be changed upstream in the Debian package? Checkarray is not part of the mdadm program whatsoever. It appears it was added into the Debian package several years ago by an outside source.

James Johnston (mail-codenest) wrote :

I can confirm that checkarray is broken out-of-the-box on Ubuntu 16.04 due to this issue. So, periodic checks of the RAID array don't happen unless I do my own scheduling and avoid checkarray, or else repair checkarray itself using one of the workarounds here...

I changed my checkarray script to explicitly use bash, but next time I upgrade this package, the changes will be lost unless this gets fixed... My change to use bash instead made checkarray start doing something useful...

The suggest at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787950 to use cat instead of read is a good one, and only a one-line change. (Preferably without waiting for Debian upstream to fix it?)

swmike (ubuntu-s-plass) wrote :

Hi,

I just ran into this. I am active on both the linux-raid mailing list, and on the #linux-raid IRC channel. We frequently get people in both places who have problems with their arrays, some of them is because of lack of frequent "scrubbing" to find read errors on the drives.

This issue needs to be fixed before it turns into a huge disaster. The current default behaviour of checkarray cron is that it's run first sunday every month. This is a sensible default, but it's now broken in Ubuntu.

Please fix this, before people start to lose data because checkarray isn't currently working.

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

Other bug subscribers

Remote bug watches

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