Mdadm mdmonitor-oneshot.service daily DeviceDisappeared/NewArray alerts

Ubuntu Version:
Ubuntu 24.04.2 LTS (server)

Desktop Environment (if applicable):
(none, server install)

Problem Description:
I removed the udisks2 package recently as it was preventing my spinning hard disks from going to sleep (various people with the same issue since upgrading to 24.02) and it resolved that problem.

However since doing that my two md arrays (they are on flash not spinning disks) send an alert every day from mdmonitor-oneshot.service.
I can trigger the same alert manually running: mdadm --monitor --oneshot --scan

mdadm: DeviceDisappeared event detected on md device /dev/md/md1
mdadm: DeviceDisappeared event detected on md device /dev/md/md0
mdadm: NewArray event detected on md device /dev/md0
mdadm: NewArray event detected on md device /dev/md1

Relevant System Information:
My mdadm.conf:

ARRAY /dev/md0 metadata=1.2 name=ubuntu-server:0 UUID=5669dc05:ca33be7b:c7a3e8e0:9f55d7c7
ARRAY /dev/md1 metadata=1.2 name=ubuntu-server:1 UUID=f57c44db:c088bed1:a3602b1c:86ef3094
MAILADDR <redacted>
PROGRAM /usr/local/bin/mdadm_notify

I’m not sure why mdadm monitor is expecting to find the devices at /dev/md/mdX? I assume udisks2 added /dev/md/mdX symlinks? As the devices don’t exist under the /dev/md/ path.

Any ideas how I can stop mdadm monitor trying to look for the arrays in the wrong place and not just using the definition in mdadm.conf

/proc/mdstat looks like:

Personalities : [raid1] [raid0] [raid6] [raid5] [raid4] [raid10] 
md1 : active raid1 sdd3[1] sdc3[0]
      466095104 blocks super 1.2 [2/2] [UU]
      bitmap: 2/4 pages [8KB], 65536KB chunk

md0 : active raid1 sdd2[1] sdc2[0]
      2094080 blocks super 1.2 [2/2] [UU]
      
unused devices: <none>

So I think there is no problem with the arrays?

I’m no mdadm expert but I ran into what sounds like the same issue when I started using mdadm. To get rid of the errors I edited the file:

/etc/udev/rules.d/md0.rules

and added the following:

# Work around an array detection bug in mdmonitor
SUBSYSTEM=="block", ACTION=="add|change", ENV{MD_UUID}=="69417cfe:cf48c135:fc0c8e8c:eef42c56", SYMLINK+="md/md0"

Your UUID will be different. Then I ran:

sudo udevadm trigger

I’m not sure this issue is related to udisks2 since, although I don’t use it, it’s still installed on my system.

1 Like

Thank you @demyers that has worked (it has added the extra /dev/md/XX symlinks) and the mdadm monitor command doesn’t show the DeviceDisappeared / NewArray output anymore.

I wonder why it looks for it at a location that is different to the ARRAY lines in mdadm.conf. Would be nice to understand the root cause but thank you for the workaround to stop the daily alerts! :raised_hands: