resource-agents 1:4.16.0-3ubuntu1 autopkgtests fail on questing [dd direct write flag]

Bug #2125968 reported by Renan Rodrigo
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
rust-coreutils
New
Unknown
coreutils-from (Ubuntu)
Won't Fix
Critical
Unassigned
resource-agents (Ubuntu)
Triaged
High
Unassigned
rust-coreutils (Ubuntu)
Triaged
Critical
Unassigned

Bug Description

dep8 tests for resource-agents are failing, blocking several packages:
https://objectstorage.prodstack5.canonical.com/swift/v1/AUTH_0f9aae918d5b4744bf7b827671c86842/autopkgtest-questing/questing/amd64/r/resource-agents/20250928_225900_18cdd@/log.gz

1165s Starting 'Filesystem' case 9 'monitor depth 10 when running':
1165s Setting agent environment: export OCF_RESKEY_device=/dev/loop0
1165s Setting agent environment: export OCF_RESKEY_fstype=ext3
1165s Setting agent environment: export OCF_RESKEY_directory=/run/resource-agents/ocft-Filesystem-mnt
1167s Running agent: ./Filesystem start
1168s Setting agent environment: export OCF_CHECK_LEVEL=10
1168s Running agent: ./Filesystem monitor
1169s Checking return value: FAILED. The return value 'OCF_ERR_GENERIC' != 'OCF_SUCCESS'. See details below:
1169s cat: /tmp/.ocft_runlog: No such file or directory (os error 2)

Renan Rodrigo (rr)
description: updated
tags: added: update-excuse
Renan Rodrigo (rr)
tags: added: server-todo
Changed in resource-agents (Ubuntu):
assignee: nobody → Renan Rodrigo (rr)
Revision history for this message
Renan Rodrigo (rr) wrote (last edit ):

Looking at the error, the problem lies in the Filesystem agent. There are some monitoring functions being tested, and the one which fails is a check which reads the starting bytes of a device.

This is done using `dd`. This is the exact command executed in the test:
dd if=/dev/loop0 iflag=direct bs=4k count=1 2>&1 >/dev/null

The first smell is: this passes with `coreutils-from-gnu`, but fails with `coreutils-from-uutils` with:
`dd: IO error: Invalid input`

strace shows that dd can't read from the FD:
`read(3, 0x5d3c457b94a0, 4096) = -1 EINVAL (Invalid argument)`

It seems the rust coreutils can't deal with the `direct` flag appropriately [1]. The implementation of O_DIRECT seems different than the one in the GNU version - and it seems to lack buffer alignment, which is needed for direct reads.

In the resource-agents side, a workaround would be removing the iflag from the `dd` call. However, the commit which introduces the flag (tens of years ago) states: "Reading from the device in O_DIRECT mode is imperative to bypass caches.", so that's not acceptable for the monitoring functionality.

So this needs to be looked at in the coreutils side. I am adding bug tasks.

For the package migrations blocked on this bug, I suggest adding hints so they get in. As a last resort, migration-reference is also a workaround for now.

Mind that many other packages (or at least package tests) also call/depend on the `direct` iflag, and are potentially affected by this coreutils bug.

---
Steps to reproduce:

1. Launch a questing VM with coreutils-from-uutils
2. Create a file which will be mapped to loop0:
$ sudo dd if=/dev/zero of=/example bs=1 count=0 seek=16M
Make sure to not create it in a tmpfs, as this is a different scenario - also not supported in the rust coreutils[1]
3. Map loop0 to the file:
$ sudo losetup /dev/loop0 /example
4. Try to read the data without using the `direct` iflag, see it works:
sudo dd if=/dev/loop0 bs=4k count=1
5. Try to read the data using the `direct` iflag, see it fails:
sudo dd if=/dev/loop0 iflag=direct bs=4k count=1

6. Launch a questing VM with coreutils-from-gnu
7. Repeat steps 2 to 4
8. Repeat step 5, but this time it works

---
[1] https://users.rust-lang.org/t/how-does-rust-use-directio/93210

Changed in resource-agents (Ubuntu):
status: New → Triaged
tags: removed: server-todo
Changed in resource-agents (Ubuntu):
assignee: Renan Rodrigo (rr) → nobody
importance: Undecided → High
Changed in coreutils-from (Ubuntu):
status: New → Confirmed
importance: Undecided → Critical
milestone: none → ubuntu-25.10
summary: - resource-agents 1:4.16.0-3ubuntu1 autopkgtests fail on questing
+ resource-agents 1:4.16.0-3ubuntu1 autopkgtests fail on questing [dd
+ direct write flag]
Changed in coreutils-from (Ubuntu):
status: Confirmed → Won't Fix
Revision history for this message
Renan Rodrigo (rr) wrote :

Hello Julian,

I'd like to know the rationale for marking this particular issue as won't fix. The 'direct' flag on dd is important to more users I think, and this is breaking resource-agents functionality.

Could you please weigh in?

Revision history for this message
Julian Andres Klode (juliank) wrote :

The `coreutils-from` task designates whether the `dd` binary gets redirected to gnudd as a workaround, whereas the `rust-coreutils` task is about fixing it.

Revision history for this message
Renan Rodrigo (rr) wrote :

Ack, makes sense; thanks for the clarification (:

Revision history for this message
Renan Rodrigo (rr) wrote :

Setting this to Critical as Christian have done for the coreutils-from task before

Changed in rust-coreutils (Ubuntu):
importance: Undecided → Critical
Simon Johnsson (bamf0)
Changed in rust-coreutils (Ubuntu):
status: New → Triaged
Changed in rust-coreutils:
status: Unknown → New
Revision history for this message
Christoph Böhmwalder (c8ristoph) wrote :

Reported upstream, though on Ubuntu 26.04, and without resource-agents involvement: https://github.com/uutils/coreutils/issues/12085

I believe this is triggered far more widely than described here. For example, we reproduced this in the DRBD test suite.

I suspect many users are using similar dd calls in their scripts, since this expression is a pretty common pattern when testing with block devices.

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.