GNU bug report logs - #66740
fail to run 'parted -s /dev/loop0 mklabel MSDOS'

Previous Next

Package: parted;

Reported by: li wang <lwang8512 <at> gmail.com>

Date: Wed, 25 Oct 2023 07:25:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: "Brian C. Lane" <bcl <at> redhat.com>
To: 66740 <at> debbugs.gnu.org
Subject: bug#66740: fail to run 'parted -s /dev/loop0 mklabel MSDOS'
Date: Wed, 25 Oct 2023 08:29:17 -0700
On Wed, Oct 25, 2023 at 11:07:49AM +0800, li wang wrote:
> *test case:*
> 
> # systemctl restart systemd-udevd
> # systemctl status systemd-udevd
> 
> # dd if=/dev/zero of=./blk-file bs=1M count=200
> 
> # losetup -f
> 
> # losetup /dev/loop0 ./blk-file
> 
> # losetup -f
> 
> # parted -s /dev/loop0 mklabel MSDOS
> 
> Error: Partition(s) 1, ..., 64 on /dev/loop0 have been written, but we have
> been unable to inform the kernel of the change, probably because it/they
> are in use. As a result, the old partition(s) will remain in use. You
> should reboot now before making further changes.
> # echo $?
> 1
> 
> *root case:*
> 
> linux kernel update:
> Upstream commit 1a721de8489fa559ff4471f73c58bb74ac5580d3
> +       if (disk->flags & GENHD_FL_NO_PART)
> +               return -EINVAL;
> 
> parted: libparted/arch/linux.c
> 3075 static int _disk_sync_part_table (PedDisk* disk)
> 3077 {
> ...
> 3165                 if (!ok[i - 1] && errnums[i - 1] == ENXIO)
> 3166                         ok[i - 1] = 1; /* it already doesn't exist */
> 3167         }
> 
> *thought:*
> 
> parted codes need refresh according to kernel of return value.

Thanks, I'll have to dig into this when I have time. As a workaround you
don't need to attach the file to a loop device, parted can run on the
file directly.

Brian

-- 
Brian C. Lane (PST8PDT) - weldr.io - lorax - parted - pykickstart





This bug report was last modified 1 year and 234 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.