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

From: "Andreas K. Huettel" <[email-masked]>
Date: Thu, 01 May 2025 22:37:10 +0200

Dear all, 

I'm recently running into a strange problem in the Gentoo release build automation, and need help.

We use parted to create label and partitions in a qcow2 image available via qemu-nbd.
  https://gitweb.gentoo.org/proj/catalyst.git/tree/targets/support/create-qcow2.sh#n96

This worked fine for quite some time.

Recently, it stopped working, there is no error message at all, but the command
  parted -s /dev/nbd0 mklabel gpt
returns 1. 

If I run the same command outside the release automation manually, the return code is 0 and
everything is fine.

I inserted strace to see what's wrong. The log follows- any ideas?

Thanks in advance,
Andreas

   5852 execve("/bin/parted", ["parted", "-s", "/dev/nbd0", "mklabel", "gpt"], 0x7ffe843aef10 /* 87 vars */) = 0
   5853 brk(NULL)                               = 0x559c452fe000
   5854 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd9ec63f000
   5855 access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
   5856 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
   5857 fstat(3, {st_mode=S_IFREG|0644, st_size=46930, ...}) = 0
   5858 mmap(NULL, 46930, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fd9ec633000
   5859 close(3)                                = 0
   5860 openat(AT_FDCWD, "/usr/lib64/libparted.so.2", O_RDONLY|O_CLOEXEC) = 3
   5861 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
   5862 fstat(3, {st_mode=S_IFREG|0755, st_size=319952, ...}) = 0
   5863 mmap(NULL, 334840, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd9ec5e1000
   5864 mmap(0x7fd9ec5ec000, 184320, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb000) = 0x7fd9ec5ec000
   5865 mmap(0x7fd9ec619000, 73728, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x38000) = 0x7fd9ec619000
   5866 mmap(0x7fd9ec62b000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4a000) = 0x7fd9ec62b000
   5867 mmap(0x7fd9ec62f000, 15352, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fd9ec62f000
   5868 close(3)                                = 0
   5869 openat(AT_FDCWD, "/usr/lib64/libreadline.so.8", O_RDONLY|O_CLOEXEC) = 3
   5870 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
   5871 fstat(3, {st_mode=S_IFREG|0755, st_size=363504, ...}) = 0
   5872 mmap(NULL, 367312, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd9ec587000
   5873 mmap(0x7fd9ec59c000, 200704, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7fd9ec59c000
   5874 mmap(0x7fd9ec5cd000, 40960, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x46000) = 0x7fd9ec5cd000
   5875 mmap(0x7fd9ec5d7000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x50000) = 0x7fd9ec5d7000
   5876 mmap(0x7fd9ec5e0000, 2768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fd9ec5e0000
   5877 close(3)                                = 0
   5878 openat(AT_FDCWD, "/usr/lib64/libuuid.so.1", O_RDONLY|O_CLOEXEC) = 3
   5879 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
   5880 fstat(3, {st_mode=S_IFREG|0755, st_size=34896, ...}) = 0
   5881 mmap(NULL, 36936, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd9ec57d000
   5882 mmap(0x7fd9ec57f000, 20480, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fd9ec57f000
   5883 mmap(0x7fd9ec584000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fd9ec584000
   5884 mmap(0x7fd9ec585000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fd9ec585000
   5885 close(3)                                = 0
   5886 openat(AT_FDCWD, "/usr/lib64/libtinfo.so.6", O_RDONLY|O_CLOEXEC) = 3
   5887 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
   5888 fstat(3, {st_mode=S_IFREG|0755, st_size=240720, ...}) = 0
   5889 mmap(NULL, 244344, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd9ec541000
   5890 mmap(0x7fd9ec548000, 126976, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fd9ec548000
   5891 mmap(0x7fd9ec567000, 69632, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7fd9ec567000
   5892 mmap(0x7fd9ec578000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x36000) = 0x7fd9ec578000
   5893 close(3)                                = 0
   5894 openat(AT_FDCWD, "/usr/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
   5895 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260e\2\0\0\0\0\0"..., 832) = 832
   5896 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
   5897 fstat(3, {st_mode=S_IFREG|0755, st_size=1831232, ...}) = 0
   5898 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
   5899 mmap(NULL, 1862648, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd9ec37a000
   5900 mmap(0x7fd9ec39e000, 1323008, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x24000) = 0x7fd9ec39e000
   5901 mmap(0x7fd9ec4e1000, 335872, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x167000) = 0x7fd9ec4e1000
   5902 mmap(0x7fd9ec533000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b8000) = 0x7fd9ec533000
   5903 mmap(0x7fd9ec539000, 31736, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fd9ec539000
   5904 close(3)                                = 0
   5905 openat(AT_FDCWD, "/usr/lib64/libblkid.so.1", O_RDONLY|O_CLOEXEC) = 3
   5906 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
   5907 fstat(3, {st_mode=S_IFREG|0755, st_size=383968, ...}) = 0
   5908 mmap(NULL, 381888, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd9ec31c000
   5909 mmap(0x7fd9ec322000, 253952, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7fd9ec322000
   5910 mmap(0x7fd9ec360000, 77824, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x44000) = 0x7fd9ec360000
   5911 mmap(0x7fd9ec373000, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x57000) = 0x7fd9ec373000
   5912 close(3)                                = 0
   5913 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd9ec31a000
   5914 openat(AT_FDCWD, "/usr/lib64/libtinfow.so.6", O_RDONLY|O_CLOEXEC) = 3
   5915 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
   5916 fstat(3, {st_mode=S_IFREG|0755, st_size=240744, ...}) = 0
   5917 mmap(NULL, 244472, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd9ec2de000
   5918 mmap(0x7fd9ec2e5000, 126976, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fd9ec2e5000
   5919 mmap(0x7fd9ec304000, 69632, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7fd9ec304000
   5920 mmap(0x7fd9ec315000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x36000) = 0x7fd9ec315000
   5921 close(3)                                = 0
   5922 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd9ec2db000
   5923 arch_prctl(ARCH_SET_FS, 0x7fd9ec2db780) = 0
   5924 set_tid_address(0x7fd9ec2dba50)         = 2030175
   5925 set_robust_list(0x7fd9ec2dba60, 24)     = 0
   5926 rseq(0x7fd9ec2dc0a0, 0x20, 0, 0x53053053) = 0
   5927 mprotect(0x7fd9ec533000, 16384, PROT_READ) = 0
   5928 mprotect(0x7fd9ec315000, 16384, PROT_READ) = 0
   5929 mprotect(0x7fd9ec373000, 24576, PROT_READ) = 0
   5930 mprotect(0x7fd9ec578000, 16384, PROT_READ) = 0
   5931 mprotect(0x7fd9ec585000, 4096, PROT_READ) = 0
   5932 mprotect(0x7fd9ec5d7000, 12288, PROT_READ) = 0
   5933 mprotect(0x7fd9ec62b000, 12288, PROT_READ) = 0
   5934 mprotect(0x559c2088b000, 4096, PROT_READ) = 0
   5935 mprotect(0x7fd9ec679000, 8192, PROT_READ) = 0
   5936 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
   5937 munmap(0x7fd9ec633000, 46930)           = 0
   5938 getrandom("\xd3\x7e\x23\x17\xd2\x5e\x66\x43", 8, GRND_NONBLOCK) = 8
   5939 brk(NULL)                               = 0x559c452fe000
   5940 brk(0x559c4531f000)                     = 0x559c4531f000
   5941 rt_sigaction(SIGSEGV, {sa_handler=0x559c20882670, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7fd9ec3b6b80}, NULL, 8) = 0
   5942 rt_sigaction(SIGINT, {sa_handler=0x559c20882920, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7fd9ec3b6b80}, NULL, 8) = 0
   5943 rt_sigaction(SIGFPE, {sa_handler=0x559c20882560, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7fd9ec3b6b80}, NULL, 8) = 0
   5944 rt_sigaction(SIGILL, {sa_handler=0x559c20882450, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7fd9ec3b6b80}, NULL, 8) = 0
   5945 getuid()                                = 0
   5946 readlink("/dev", 0x7ffe100cf380, 1023)  = -1 EINVAL (Invalid argument)
   5947 readlink("/dev/nbd0", 0x7ffe100cf380, 1023) = -1 EINVAL (Invalid argument)
   5948 newfstatat(AT_FDCWD, "/dev/nbd0", {st_mode=S_IFBLK|0660, st_rdev=makedev(0x2b, 0), ...}, 0) = 0
   5949 openat(AT_FDCWD, "/proc/devices", O_RDONLY) = 3
   5950 read(3, "Character devices:\n  1 mem\n  4 /"..., 16384) = 630
   5951 read(3, "", 16384)                      = 0
   5952 close(3)                                = 0
   5953 openat(AT_FDCWD, "/proc/devices", O_RDONLY) = 3
   5954 read(3, "Character devices:\n  1 mem\n  4 /"..., 16384) = 630
   5955 read(3, "", 16384)                      = 0
   5956 close(3)                                = 0
   5957 openat(AT_FDCWD, "/proc/devices", O_RDONLY) = 3
   5958 read(3, "Character devices:\n  1 mem\n  4 /"..., 16384) = 630
   5959 read(3, "", 16384)                      = 0
   5960 close(3)                                = 0
   5961 newfstatat(AT_FDCWD, "/dev/nbd0", {st_mode=S_IFBLK|0660, st_rdev=makedev(0x2b, 0), ...}, 0) = 0
   5962 openat(AT_FDCWD, "/dev/nbd0", O_RDONLY) = 3
   5963 openat(AT_FDCWD, "/sys/block/nbd0/ext_range", O_RDONLY) = 4
   5964 fstat(4, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
   5965 read(4, "256\n", 4096)                  = 4
   5966 close(4)                                = 0
   5967 ioctl(3, BLKFLSBUF)                     = 0
   5968 newfstatat(AT_FDCWD, "/dev/nbd0p1", 0x7ffe100cf440, 0) = -1 ENOENT (No such file or directory)
   5969 openat(AT_FDCWD, "/dev/nbd0p1", O_WRONLY) = -1 ENOENT (No such file or directory)
   5970 newfstatat(AT_FDCWD, "/dev/nbd0p2", 0x7ffe100cf440, 0) = -1 ENOENT (No such file or directory)
   5971 openat(AT_FDCWD, "/dev/nbd0p2", O_WRONLY) = -1 ENOENT (No such file or directory)
   5972 newfstatat(AT_FDCWD, "/dev/nbd0p3", 0x7ffe100cf440, 0) = -1 ENOENT (No such file or directory)
   5973 openat(AT_FDCWD, "/dev/nbd0p3", O_WRONLY) = -1 ENOENT (No such file or directory)
   5974 newfstatat(AT_FDCWD, "/dev/nbd0p4", 0x7ffe100cf440, 0) = -1 ENOENT (No such file or directory)
   5975 openat(AT_FDCWD, "/dev/nbd0p4", O_WRONLY) = -1 ENOENT (No such file or directory)
[...]
   6474 newfstatat(AT_FDCWD, "/dev/nbd0p254", 0x7ffe100cf440, 0) = -1 ENOENT (No such file or directory)
   6475 openat(AT_FDCWD, "/dev/nbd0p254", O_WRONLY) = -1 ENOENT (No such file or directory)
   6476 newfstatat(AT_FDCWD, "/dev/nbd0p255", 0x7ffe100cf440, 0) = -1 ENOENT (No such file or directory)
   6477 openat(AT_FDCWD, "/dev/nbd0p255", O_WRONLY) = -1 ENOENT (No such file or directory)
   6478 newfstatat(AT_FDCWD, "/dev/nbd0", {st_mode=S_IFBLK|0660, st_rdev=makedev(0x2b, 0), ...}, 0) = 0
   6479 uname({sysname="Linux", nodename="catalyst", ...}) = 0
   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
   6484 ioctl(3, FDGETFDCSTAT, 0x7ffe100ce360)  = -1 EINVAL (Invalid argument)
   6485 openat(AT_FDCWD, "/sys/dev/block/43:0", O_RDONLY|O_CLOEXEC) = 4
   6486 openat(4, "dm/uuid", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
   6487 close(4)                                = 0
   6488 ioctl(3, BLKGETZONESZ, [0])             = 0
   6489 openat(AT_FDCWD, "/sys/dev/block/43:0", O_RDONLY|O_CLOEXEC) = 4
   6490 faccessat2(4, "alignment_offset", F_OK, 0) = 0
   6491 openat(4, "alignment_offset", O_RDONLY|O_CLOEXEC) = 5
   6492 fcntl(5, F_GETFL)                       = 0x8000 (flags O_RDONLY|O_LARGEFILE)
   6493 fstat(5, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
   6494 read(5, "0\n", 4096)                    = 2
   6495 close(5)                                = 0
   6496 faccessat2(4, "queue/minimum_io_size", F_OK, 0) = 0
   6497 openat(4, "queue/minimum_io_size", O_RDONLY|O_CLOEXEC) = 5
   6498 fcntl(5, F_GETFL)                       = 0x8000 (flags O_RDONLY|O_LARGEFILE)
   6499 fstat(5, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
   6500 read(5, "512\n", 4096)                  = 4
   6501 close(5)                                = 0
   6502 faccessat2(4, "queue/optimal_io_size", F_OK, 0) = 0
   6503 openat(4, "queue/optimal_io_size", O_RDONLY|O_CLOEXEC) = 5
   6504 fcntl(5, F_GETFL)                       = 0x8000 (flags O_RDONLY|O_LARGEFILE)
   6505 fstat(5, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
   6506 read(5, "131072\n", 4096)               = 7
   6507 close(5)                                = 0
   6508 faccessat2(4, "queue/physical_block_size", F_OK, 0) = 0
   6509 openat(4, "queue/physical_block_size", O_RDONLY|O_CLOEXEC) = 5
   6510 fcntl(5, F_GETFL)                       = 0x8000 (flags O_RDONLY|O_LARGEFILE)
   6511 fstat(5, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
   6512 read(5, "512\n", 4096)                  = 4
   6513 close(5)                                = 0
   6514 faccessat2(4, "queue/dax", F_OK, 0)     = 0
   6515 openat(4, "queue/dax", O_RDONLY|O_CLOEXEC) = 5
   6516 fcntl(5, F_GETFL)                       = 0x8000 (flags O_RDONLY|O_LARGEFILE)
   6517 fstat(5, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
   6518 read(5, "0\n", 4096)                    = 2
   6519 close(5)                                = 0
   6520 faccessat2(4, "diskseq", F_OK, 0)       = 0
   6521 openat(4, "diskseq", O_RDONLY|O_CLOEXEC) = 5
   6522 fcntl(5, F_GETFL)                       = 0x8000 (flags O_RDONLY|O_LARGEFILE)
   6523 fstat(5, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
   6524 read(5, "6642\n", 4096)                 = 5
   6525 close(5)                                = 0
   6526 close(4)                                = 0
   6527 ioctl(3, BLKSSZGET, [512])              = 0
   6528 ioctl(3, BLKGETSIZE64, [0])             = 0
   6529 ioctl(3, BLKGETSIZE64, [0])             = 0
   6530 fsync(3)                                = 0
   6531 close(3)                                = 0
   6532 close(1)                                = 0
   6533 close(2)                                = 0
   6534 exit_group(1)                           = ?
   6535 +++ exited with 1 +++

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