Subject: bug#78202: "parted -s /dev/nbd0 mklabel gpt" fails without error message only in release automation

From: "Andreas K. Huettel" <[email-masked]>
Date: Sun, 04 May 2025 14:50:52 +0200

Am Freitag, 2. Mai 2025, 18:19:36 Mitteleuropäische Sommerzeit schrieben Sie:
> > 
> 
> [snip]
> 
> >    6480 ioctl(3, BLKSSZGET, [512])              = 0
> >    6481 fadvise64(3, 0, 0, POSIX_FADV_RANDOM)   = 0
> >    6482 fstat(3, {st_mode=S_IFBLK|0660, st_rdev=makedev(0x2b, 0), ...}) = 0
> >    6483 ioctl(3, BLKGETSIZE64, [0])             = 0
> 
> That looks bad :) It's reporting the disk size is zero. No idea why, it
> seems to get the sector size and later on the io size, etc. ok but a
> zero length disk will certainly cause problems.

Yes that's a good data point indeed, thank you.

> 
> I've never used nbd much, but my guess would be that this is a setup
> timing issue, that you need to do something else to make double extra
> sure that the nbd device is really completely setup and ready to use.
> 
> Adding a sleep may help identify the problem, but I wouldn't depend on
> it as a solution.

Interestingly, 5s sleep seems to help (I went for an ample amount, since
the process is not time critical).

So we seem to be good for the moment.

Some other log reading in the meantime turned up that the problem may have
started when the build host was upgraded from kernel 6.6 to 6.12 ... 
something to maybe look at and verify later here. Unfortunately the machine
is very busy and I want to avoid too many reboots.

> 
> I'd also recommend adding some checks to make sure device nodes are
> really present before you create the filesystem, as well as 'udevadm
> settle' to make sure udev has finished up in the background. These are
> problems we used to hit in the parted test suite, and came up with this
> code:
> 
> https://github.com/bcl/parted/blob/master/tests/t-local.sh#L45

Thanks a lot!
Andreas

> Good luck!
> Brian

-- 
Andreas K. Hüttel
[email-masked]
Gentoo Linux developer 
(council, comrel, toolchain, base-system, perl, libreoffice)
https://wiki.gentoo.org/wiki/User:Dilfridge