#946045 e2fsprogs: Cron job sends mail every time if an SD card reader is connected: /dev/sde: open failed: No medium found

Package:
e2fsprogs
Source:
e2fsprogs
Description:
ext2/ext3/ext4 file system utilities
Submitter:
Axel Beckert
Date:
2019-12-03 11:18:06 UTC
Severity:
normal
#946045#5
Date:
2019-12-03 11:15:56 UTC
From:
To:
Dear e2fsprogs maintainers,

the second cron job inside /etc/cron.d/e2scrub_all ("test -e
/run/systemd/system || SERVICE_MODE=1 /sbin/e2scrub_all -A -r") always
sends mail on devices which have a (in my case permanently mounted) SD
card reader connected:

  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  /dev/sdg: open failed: No medium found
  /dev/sdh: open failed: No medium found
  /dev/sdi: open failed: No medium found
------------------------------------------------------------------------

Another requirement to trigger these mails might be to not have systemd
as init system.

I see potentially two variants to fix this:

* Quick and dirty: Replace "/sbin/e2scrub_all -A -r" with
  "/sbin/e2scrub_all -A -r |& fgrep -v 'open failed: No medium
  found'". This might though cause issues because then the exit code
  cron will look at is the one from fgrep and no more the one from
  e2scrub_all. There are surely ways to work around that like capturing
  the exit code in a variable and calling "exit $that_variable" at the
  end, but that's already no more "KISS".

* Implement a new option in /sbin/e2scrub_all to suppress the warning
  about the "No medium found" condition. Would be clean, useful also for
  other use cases and IMHO the correct way to fix this. It though
  likely needs more effort to implement.