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

To reply to this bug, email your comments to 66740 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-parted <at> gnu.org:
bug#66740; Package parted. (Wed, 25 Oct 2023 07:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to li wang <lwang8512 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-parted <at> gnu.org. (Wed, 25 Oct 2023 07:25:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: li wang <lwang8512 <at> gmail.com>
To: bug-parted <at> gnu.org
Cc: li wang <lwang8512 <at> gmail.com>
Subject: fail to run 'parted -s /dev/loop0 mklabel MSDOS'
Date: Wed, 25 Oct 2023 11:07:49 +0800
[Message part 1 (text/plain, inline)]
*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.
[Message part 2 (text/html, inline)]

Information forwarded to bug-parted <at> gnu.org:
bug#66740; Package parted. (Wed, 25 Oct 2023 15:32:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Brian C. Lane" <bcl <at> redhat.com>
To: bug-parted <at> gnu.org
Subject: Re: 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 30 days ago.

Previous Next


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