Public bug reported:

mdadm 4.6-3ubuntu1 ships /usr/share/finalrd/mdadm.finalrd non-executable; 
finalrd ignores it entirely
====================================================================================================

Affects: mdadm 4.6-3ubuntu1 (stonking).  Not affected: 4.5-5ubuntu1.1
(resolute).

Summary
-------
mdadm 4.6-3ubuntu1 ships /usr/share/finalrd/mdadm.finalrd without the
executable bit (0644).  finalrd(1) both runs its hooks via
`run-parts --arg=setup` (which silently skips non-executable files) and
copies them into the shutdown initramfs with `find -executable` (which
matches nothing), so the hook is completely inert: neither the setup
phase (which copies /usr/sbin/mdadm and /usr/sbin/mdmon plus their
libraries into /run/initramfs) nor the post-pivot run (mdmon takeover,
wait-clean, stop arrays) ever happens.  Every system with md arrays
shuts down without the exitrd mdadm handling that this hook exists to
provide.

Reproduction
------------
Binary packages (archive.ubuntu.com, pool/main/m/mdadm/):

  $ dpkg-deb --fsys-tarfile mdadm_4.6-3ubuntu1_amd64.deb | tar -tv | grep 
finalrd
  -rw-r--r-- root/root       278 2026-08-20 ./usr/share/finalrd/mdadm.finalrd
  $ dpkg-deb --fsys-tarfile mdadm_4.5-5ubuntu1.1_amd64.deb | tar -tv | grep 
finalrd
  -rwxr-xr-x root/root       278 2026-08-02 ./usr/share/finalrd/mdadm.finalrd

Source package:

  $ tar -xf mdadm_4.6-3ubuntu1.debian.tar.xz && ls -l debian/local/finalrd/
  -rw-r--r-- 1 root root 278 ... mdadm.finalrd          (4.6-3ubuntu1)
  -rwxr-xr-x 1 root root 278 ... mdadm.finalrd          (4.5-5ubuntu1.1)

Content is byte-identical (278 bytes); only the mode was lost.

Runtime consequence (Ubuntu 26.10 live ISO, also applies to installed
systems with md arrays):

  $ sudo /usr/bin/finalrd
  $ sudo find /run/initramfs -name 'mdadm*' -o -name 'mdmon*'
  (no results: no /usr/sbin/mdadm, no /usr/sbin/mdmon, and
   /run/initramfs/usr/lib/systemd/system-shutdown/ is empty)

run-parts' "executing ..." line for mdadm.finalrd is absent from the
finalrd output, and finalrd's `find /usr/share/finalrd -executable`
copies nothing.

Observed result
---------------
The shutdown initramfs contains no mdadm, no mdmon and no mdadm hook, so
post-pivot arrays are never taken over by an mdmon in the exitrd, never
waited on and never stopped - on any system using the hook's documented
function ("takes over external-metadata monitoring, waits for arrays to
become clean, then stops arrays", debian/changelog 4.5-5ubuntu1).  On
Ubuntu 26.10 live media this additionally surfaced as part of
LP: #2169202 (shutdown I/O errors after removing the live medium).

Expected result
---------------
/usr/share/finalrd/mdadm.finalrd ships executable; finalrd runs its
setup phase and installs it into /run/initramfs; shutdown handles
arrays as designed.

Root cause
----------
The hook was re-added during the 4.6-3ubuntu1 Debian merge (debian/
changelog: "Merge with Debian unstable (LP: #2161533)", commit
"d/{control,mdadm.install,local/finalrd/mdadm.finalrd}: ship a finalrd
hook", 2026-08-20) and was recreated without the executable bit.  No
changelog entry mentions a permission change; the 4.5 packaging shipped
it 0755.

Fix
---
Restore the mode in the packaging, either:

  chmod +x debian/local/finalrd/mdadm.finalrd

(dh_install preserves the source file's mode), or force it in
debian/rules:

  override_dh_install:
        dh_install
        chmod 755 debian/mdadm/usr/share/finalrd/mdadm.finalrd

Validation
----------
After rebuilding: `dpkg-deb --fsys-tarfile | tar -tv | grep finalrd`
shows -rwxr-xr-x; on a booted system `sudo /usr/bin/finalrd` then
`find /run/initramfs` shows /usr/sbin/mdadm, /usr/sbin/mdmon, their
libraries, and /run/initramfs/lib/systemd/system-shutdown/mdadm.finalrd;
post-pivot "run-parts: executing /usr/share/finalrd/mdadm.finalrd
setup" appears during finalrd assembly.

Related
-------
- casper live-media shutdown work: LP: #2169202, MR
  
https://code.launchpad.net/~chris-bainbridge/ubuntu/+source/casper/+git/casper/+merge/512434

** Affects: mdadm (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2170262

Title:
  mdadm (stonking) ships /usr/share/finalrd/mdadm.finalrd non-executable

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mdadm/+bug/2170262/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to